Skip to content

Commit

Permalink
ZKUI-319 - make typescript happy
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Mar 30, 2023
1 parent c1f2670 commit 8e8470b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LocationDetailsFormProps } from '.';
import { FormGroup, FormSection } from '@scality/core-ui';
import { Input, Select } from '@scality/core-ui/dist/next';
import {
LocationAzureAuth,
LocationAzureClientSecret,
LocationAzureSharedAccessSignature,
LocationAzureSharedKey,
Expand Down Expand Up @@ -35,7 +36,7 @@ export default class LocationDetailsAzure extends React.Component<
| LocationAzureClientSecret
| LocationAzureSharedAccessSignature
| LocationAzureSharedKey = this.props.details.auth || {
type: 'location-azure-shared-key',
type: LocationAzureAuth.TypeEnum['SharedKey'],
accountKey: '',
accountName: this.props.details.accessKey || '',
};
Expand Down Expand Up @@ -83,7 +84,7 @@ export default class LocationDetailsAzure extends React.Component<
case 'location-azure-shared-key':
this.setState({
auth: {
type: 'location-azure-shared-key',
type: LocationAzureAuth.TypeEnum['SharedKey'],
accountName: '',
accountKey: '',
},
Expand All @@ -92,7 +93,7 @@ export default class LocationDetailsAzure extends React.Component<
case 'location-azure-client-secret':
this.setState({
auth: {
type: 'location-azure-client-secret',
type: LocationAzureAuth.TypeEnum['ClientSecret'],
clientId: '',
clientKey: '',
},
Expand All @@ -101,7 +102,7 @@ export default class LocationDetailsAzure extends React.Component<
case 'location-azure-shared-access-signature':
this.setState({
auth: {
type: 'location-azure-shared-access-signature',
type: LocationAzureAuth.TypeEnum['SharedAccessSignature'],
storageSasToken: '',
},
});
Expand Down Expand Up @@ -182,7 +183,7 @@ export default class LocationDetailsAzure extends React.Component<
id="locationType"
placeholder="Select an option..."
onChange={this.onAuthTypeChange}
value={this.state.auth.type}
value={this.state.auth.type.toString()}
>
<Select.Option value={'location-azure-shared-key'}>
Azure Shared Key
Expand All @@ -198,7 +199,7 @@ export default class LocationDetailsAzure extends React.Component<
/>

{'accountName' in this.state.auth &&
this.state.auth.type === 'location-azure-shared-key' ? (
this.state.auth.type === LocationAzureAuth.TypeEnum['SharedKey'] ? (
<>
<FormGroup
label="Storage Account Name"
Expand Down Expand Up @@ -286,7 +287,8 @@ export default class LocationDetailsAzure extends React.Component<
)}

{'storageSasToken' in this.state.auth &&
this.state.auth.type === 'location-azure-shared-access-signature' ? (
this.state.auth.type ===
LocationAzureAuth.TypeEnum['SharedAccessSignature'] ? (
<>
<FormGroup
label="SAS Token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ const LocationDetailsAzureArchive = ({
};

const isServiceBus =
formState.queue.type === 'location-azure-servicebus-topic-v1' ||
formState.queue.type === 'location-azure-servicebus-queue-v1';
formState.queue.type === LocationAzureQueue.TypeEnum['ServicebusTopicV1'] ||
formState.queue.type === LocationAzureQueue.TypeEnum['ServicebusQueueV1'];

return (
<>
Expand Down Expand Up @@ -246,7 +246,7 @@ const LocationDetailsAzureArchive = ({
id="queue.type"
placeholder="Select an option..."
onChange={onChangeQueueType}
value={formState.queue.type}
value={formState.queue.type.toString()}
>
<Select.Option value={'location-azure-servicebus-topic-v1'}>
Azure Service Bus Topic
Expand All @@ -260,7 +260,8 @@ const LocationDetailsAzureArchive = ({
</Select>
}
/>
{formState.queue.type === 'location-azure-servicebus-topic-v1' &&
{formState.queue.type ===
LocationAzureQueue.TypeEnum['ServicebusTopicV1'] &&
'topicName' in formState.queue ? (
<>
<FormGroup
Expand Down Expand Up @@ -330,7 +331,8 @@ const LocationDetailsAzureArchive = ({
<></>
)}

{formState.queue.type === 'location-azure-servicebus-queue-v1' &&
{formState.queue.type ===
LocationAzureQueue.TypeEnum['ServicebusQueueV1'] &&
'queueName' in formState.queue &&
'endpoint' in formState.queue ? (
<>
Expand Down Expand Up @@ -384,7 +386,8 @@ const LocationDetailsAzureArchive = ({
<></>
)}

{formState.queue.type === 'location-azure-storage-queue-v1' &&
{formState.queue.type ===
LocationAzureQueue.TypeEnum['StorageQueueV1'] &&
'endpoint' in formState.queue ? (
<>
<FormGroup
Expand Down Expand Up @@ -447,7 +450,7 @@ const LocationDetailsAzureArchive = ({
id="auth"
placeholder="Select an option..."
onChange={onAuthTypeChange}
value={formState.auth.type}
value={formState.auth.type.toString()}
>
<Select.Option value={'location-azure-client-secret'}>
Azure Client Secret
Expand All @@ -465,7 +468,7 @@ const LocationDetailsAzureArchive = ({
}
/>
{'accountName' in formState.auth &&
formState.auth.type === 'location-azure-shared-key' ? (
formState.auth.type === LocationAzureAuth.TypeEnum['SharedKey'] ? (
<>
<FormGroup
label="Azure Account Name"
Expand Down Expand Up @@ -509,7 +512,7 @@ const LocationDetailsAzureArchive = ({
)}

{'clientId' in formState.auth &&
formState.auth.type === 'location-azure-client-secret' ? (
formState.auth.type === LocationAzureAuth.TypeEnum['ClientSecret'] ? (
<>
<FormGroup
label="Tenant ID"
Expand Down Expand Up @@ -569,7 +572,8 @@ const LocationDetailsAzureArchive = ({
)}

{'storageSasToken' in formState.auth &&
formState.auth.type === 'location-azure-shared-access-signature' ? (
formState.auth.type ===
LocationAzureAuth.TypeEnum['SharedAccessSignature'] ? (
<>
<FormGroup
label="SAS token for Storage"
Expand Down

0 comments on commit 8e8470b

Please sign in to comment.