Skip to content

Commit

Permalink
ZKUI-299 - fix azure location key
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Jan 6, 2023
1 parent 2be64e9 commit 683c5f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions src/react/backend/location/LocationDetails/LocationDetailsAzure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class LocationDetailsAzure extends React.Component<
| LocationAzureClientSecret
| LocationAzureSharedAccessSignature
| LocationAzureSharedKey = this.props.details.auth || {
type: 'azure-shared-key',
type: 'location-azure-shared-key',
accountKey: '',
accountName: this.props.details.accessKey || '',
};
Expand Down Expand Up @@ -80,28 +80,28 @@ export default class LocationDetailsAzure extends React.Component<

onAuthTypeChange = (newType: string) => {
switch (newType) {
case 'azure-shared-key':
case 'location-azure-shared-key':
this.setState({
auth: {
type: 'azure-shared-key',
type: 'location-azure-shared-key',
accountName: '',
accountKey: '',
},
});
return;
case 'azure-client-secret':
case 'location-azure-client-secret':
this.setState({
auth: {
type: 'azure-client-secret',
type: 'location-azure-client-secret',
clientId: '',
clientKey: '',
},
});
return;
case 'azure-shared-access-signature':
case 'location-azure-shared-access-signature':
this.setState({
auth: {
type: 'azure-shared-access-signature',
type: 'location-azure-shared-access-signature',
storageSasToken: '',
},
});
Expand Down Expand Up @@ -184,21 +184,21 @@ export default class LocationDetailsAzure extends React.Component<
onChange={this.onAuthTypeChange}
value={this.state.auth.type}
>
<Select.Option value={'azure-shared-key'}>
<Select.Option value={'location-azure-shared-key'}>
Azure Shared Key
</Select.Option>
<Select.Option value={'azure-client-secret'}>
<Select.Option value={'location-azure-client-secret'}>
Azure Client Secret
</Select.Option>
<Select.Option value={'azure-shared-access-signature'}>
<Select.Option value={'location-azure-shared-access-signature'}>
Azure Shared Access Signature
</Select.Option>
</Select>
}
/>

{'accountName' in this.state.auth &&
this.state.auth.type === 'azure-shared-key' ? (
this.state.auth.type === 'location-azure-shared-key' ? (
<>
<FormGroup
label="Azure Account Name"
Expand Down Expand Up @@ -242,7 +242,7 @@ export default class LocationDetailsAzure extends React.Component<
)}

{'clientId' in this.state.auth &&
this.state.auth.type === 'azure-client-secret' ? (
this.state.auth.type === 'location-azure-client-secret' ? (
<>
<FormGroup
label="Azure Client Id"
Expand Down Expand Up @@ -286,7 +286,7 @@ export default class LocationDetailsAzure extends React.Component<
)}

{'storageSasToken' in this.state.auth &&
this.state.auth.type === 'azure-shared-access-signature' ? (
this.state.auth.type === 'location-azure-shared-access-signature' ? (
<>
<FormGroup
label="Azure Storage Sas Token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('class <LocationDetailsAzure />', () => {
expect(onChangeFn).toHaveBeenCalledWith({
bucketMatch: false,
auth: {
type: 'azure-shared-key',
type: 'location-azure-shared-key',
accountName: '',
accountKey: '',
},
Expand Down Expand Up @@ -105,14 +105,14 @@ describe('class <LocationDetailsAzure />', () => {
// for now we just set it as empty since it's encrypted
expect(screen.getByLabelText(/Azure Account Key/i)).toHaveValue('');
});
it('should show azure details when editing an existing location with auth type azure-shared-key', () => {
it('should show azure details when editing an existing location with auth type location-azure-shared-key', () => {
//S
const locationDetails = {
bucketName: 'bn',
bucketMatch: true,
endpoint: 'https://ep',
auth: {
type: 'azure-shared-key',
type: 'location-azure-shared-key',
accountName: 'name',
accountKey: 'key',
},
Expand Down Expand Up @@ -144,14 +144,14 @@ describe('class <LocationDetailsAzure />', () => {
expect(screen.getByLabelText(/Azure Account Key/i)).toHaveValue('');
});

it('should show azure details when editing an existing location with auth type azure-client-secret', () => {
it('should show azure details when editing an existing location with auth type location-azure-client-secret', () => {
//S
const locationDetails = {
bucketName: 'bn',
bucketMatch: true,
endpoint: 'https://ep',
auth: {
type: 'azure-client-secret',
type: 'location-azure-client-secret',
clientId: 'id',
clientKey: 'key',
},
Expand Down Expand Up @@ -183,14 +183,14 @@ describe('class <LocationDetailsAzure />', () => {
expect(screen.getByLabelText(/Azure Client Key/i)).toHaveValue('');
});

it('should show azure details when editing an existing location with auth type azure-shared-access-signature', () => {
it('should show azure details when editing an existing location with auth type location-azure-shared-access-signature', () => {
//S
const locationDetails = {
bucketName: 'bn',
bucketMatch: true,
endpoint: 'https://ep',
auth: {
type: 'azure-shared-access-signature',
type: 'location-azure-shared-access-signature',
storageSasToken: 'token',
},
};
Expand Down Expand Up @@ -260,7 +260,7 @@ describe('class <LocationDetailsAzure />', () => {
return { selector };
};

it('should call onChange with expected location when seting auth type to azure-shared-key', () => {
it('should call onChange with expected location when seting auth type to location-azure-shared-key', () => {
//S
const { container, endpoint, onChange, targetBucket } =
setupAndRenderLocationDetails();
Expand All @@ -280,15 +280,15 @@ describe('class <LocationDetailsAzure />', () => {
bucketMatch: false,
endpoint,
auth: {
type: 'azure-shared-key',
type: 'location-azure-shared-key',
accountName,
accountKey,
},
bucketName: targetBucket,
});
});

it('should call onChange with expected location when seting auth type to azure-client-secret', () => {
it('should call onChange with expected location when seting auth type to location-azure-client-secret', () => {
//S
const { container, endpoint, onChange, targetBucket } =
setupAndRenderLocationDetails();
Expand All @@ -308,15 +308,15 @@ describe('class <LocationDetailsAzure />', () => {
bucketMatch: false,
endpoint,
auth: {
type: 'azure-client-secret',
type: 'location-azure-client-secret',
clientId,
clientKey,
},
bucketName: targetBucket,
});
});

it('should call onChange with expected location when seting auth type to azure-shared-access-signature', () => {
it('should call onChange with expected location when seting auth type to location-azure-shared-access-signature', () => {
//S
const { container, endpoint, onChange, targetBucket } =
setupAndRenderLocationDetails();
Expand All @@ -335,7 +335,7 @@ describe('class <LocationDetailsAzure />', () => {
bucketMatch: false,
endpoint,
auth: {
type: 'azure-shared-access-signature',
type: 'location-azure-shared-access-signature',
storageSasToken: sasToken,
},
bucketName: targetBucket,
Expand Down

0 comments on commit 683c5f5

Please sign in to comment.