Skip to content

Commit

Permalink
Merge pull request #45 from cloudblue/fix/LITE-29926-change-ui-to-use…
Browse files Browse the repository at this point in the history
…-sas-token-instead-of-connection-string

LITE-29926: Update UI to use SAS Token instead of Connection String
  • Loading branch information
arnaugiralt authored Apr 9, 2024
2 parents 5d67a5a + ea5a269 commit fadf953
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion connect_bi_reporter/static/assets/settings-DHU-f3SM.js

This file was deleted.

1 change: 1 addition & 0 deletions connect_bi_reporter/static/assets/settings-yl6ZGDej.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions connect_bi_reporter/static/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
content="width=device-width, initial-scale=1.0"
/>
<title>Connect BI Reporter Extension</title>
<script type="module" crossorigin src="/static/assets/settings-DHU-f3SM.js"></script>
<script type="module" crossorigin src="/static/assets/settings-yl6ZGDej.js"></script>
<link rel="modulepreload" crossorigin href="/static/assets/vendor-1x2ovGvJ.js">
<link rel="modulepreload" crossorigin href="/static/assets/ActionsMenu-BdIbYJG3.js">
<link rel="modulepreload" crossorigin href="/static/assets/connect-BV-2I-fJ.js">
<link rel="stylesheet" crossorigin href="/static/assets/ActionsMenu-DuD_41Xi.css">
<link rel="stylesheet" crossorigin href="/static/assets/settings-CW7gT9jj.css">
<link rel="stylesheet" crossorigin href="/static/assets/settings-Bd151nFI.css">
</head>
<body>
<div id="app"></div>
Expand Down
16 changes: 8 additions & 8 deletions ui/components/AddEditCredentialDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
label="Name"
/>
<text-field
v-model="connectionString"
v-model="sasToken"
class="dialog-input"
label="Connection String"
label="SAS Token"
/>
</simple-dialog>
</template>
Expand Down Expand Up @@ -49,9 +49,9 @@ const value = defineModel({
});

const name = ref('');
const connectionString = ref('');
const sasToken = ref('');

const isValid = computed(() => name.value?.length > 0 && connectionString.value?.length > 0);
const isValid = computed(() => name.value?.length > 0 && sasToken.value?.length > 0);
const isEditMode = computed(() => props.mode === 'edit');
const title = computed(() => (isEditMode.value ? 'Edit Credentials' : 'Add Credentials'));
const submitLabel = computed(() => (isEditMode.value ? 'Save' : 'Add'));
Expand All @@ -63,19 +63,19 @@ const getCredential = async () => {
const { result: credentialToEdit, request: credentialRequest } = useRequest(useToolkit());
await credentialRequest(`/api/credentials/${props.credentialId}`);
name.value = credentialToEdit.name;
connectionString.value = credentialToEdit.connection_string;
sasToken.value = credentialToEdit.sas_token;
};

const resetForm = () => {
name.value = '';
connectionString.value = '';
sasToken.value = '';
};

const submit = async () => {
if (props.mode === 'create') {
const status = await createCredentialAction.request('/api/credentials', 'POST', {
name: name.value,
connection_string: connectionString.value,
sas_token: sasToken.value,
});
if (status < 400) emit('created');
} else {
Expand All @@ -84,7 +84,7 @@ const submit = async () => {
'PUT',
{
name: name.value,
connection_string: connectionString.value,
sas_token: sasToken.value,
},
);
if (status < 400) emit('edited');
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/settings/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ provide('fullscreen-height', fullscreenHeight);
<style scoped>
.app {
max-width: 800px;
margin: 0 auto;
margin: 20px auto;
}
</style>
18 changes: 9 additions & 9 deletions ui/tests/specs/components/AddEditCredentialDialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock('@cloudblueconnect/connect-ui-toolkit/tools/vue/toolkitPlugin');

const requestResult = {
name: 'credName',
connection_string: 'someconnnection',
sas_token: 'someconnnection',
};

describe('AddEditCredentialDialog component', () => {
Expand Down Expand Up @@ -66,10 +66,10 @@ describe('AddEditCredentialDialog component', () => {
}),
);

const connectionStringTexfield = textfields[1];
expect(connectionStringTexfield.attributes()).toEqual(
const sasTokenTextfield = textfields[1];
expect(sasTokenTextfield.attributes()).toEqual(
expect.objectContaining({
label: 'Connection String',
label: 'SAS Token',
}),
);
});
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('AddEditCredentialDialog component', () => {
wrapper.vm.submit();
expect(useRequestStub.request).toHaveBeenCalledWith('/api/credentials', 'POST', {
name: '',
connection_string: '',
sas_token: '',
});
});
});
Expand Down Expand Up @@ -147,10 +147,10 @@ describe('AddEditCredentialDialog component', () => {
}),
);

const connectionStringTexfield = textfields[1];
expect(connectionStringTexfield.attributes()).toEqual(
const sasTokenTextfield = textfields[1];
expect(sasTokenTextfield.attributes()).toEqual(
expect.objectContaining({
label: 'Connection String',
label: 'SAS Token',
modelvalue: 'someconnnection',
}),
);
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('AddEditCredentialDialog component', () => {
'PUT',
{
name: 'credName',
connection_string: 'someconnnection',
sas_token: 'someconnnection',
},
);
});
Expand Down

0 comments on commit fadf953

Please sign in to comment.