KMSE provider list menu fix (#15979)

* KMSE provider list menu fix

- Backend value had to be mapped to the payload so capabilities call
can be triggered. Based on the response from capabilities, options are
rendered in the more menu dropdown.

* update serializer to retain existing values
This commit is contained in:
Arnav Palnitkar 2022-06-14 11:36:26 -07:00 committed by GitHub
parent bd16f2a0de
commit 86a9c1f7d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -35,6 +35,7 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter {
});
}
async query(store, type, query) {
const { backend } = query;
const url = this.buildURL(type.modelName, null, null, 'query', query);
return this.ajax(url, 'GET', this.listPayload).then(async (resp) => {
// additional data is needed to fullfil the list view requirements
@ -43,6 +44,7 @@ export default class KeymgmtKeyAdapter extends ApplicationAdapter {
resp.data.keys.map((name) => this.findRecord(store, type, name, this._mockSnapshot(query.backend)))
);
resp.data.keys = records.map((record) => record.data);
resp.backend = backend;
return resp;
});
}

View File

@ -3,6 +3,17 @@ import ApplicationSerializer from '../application';
export default class KeymgmtProviderSerializer extends ApplicationSerializer {
primaryKey = 'name';
normalizeItems(payload) {
let normalized = super.normalizeItems(payload);
if (Array.isArray(normalized)) {
normalized.forEach((provider) => {
provider.id = provider.name;
provider.backend = payload.backend;
});
}
return normalized;
}
serialize(snapshot) {
const json = super.serialize(...arguments);
return {

View File

@ -43,7 +43,12 @@
{{else}}
{{#if (or @item.canReadSecretData @item.canRead)}}
<li class="action">
<SecretLink @mode="show" @secret={{@item.id}} class="has-text-black has-text-weight-semibold">
<SecretLink
@mode="show"
@secret={{@item.id}}
@queryParams={{secret-query-params @backendModel.type @item.type asQueryParams=true}}
class="has-text-black has-text-weight-semibold"
>
Details
</SecretLink>
</li>
@ -57,7 +62,12 @@
{{/if}}
{{#if (or @item.canEditSecretData @item.canEdit)}}
<li class="action">
<SecretLink @mode="edit" @secret={{@item.id}} class="has-text-black has-text-weight-semibold">
<SecretLink
@mode="edit"
@secret={{@item.id}}
@queryParams={{secret-query-params @backendModel.type @item.type asQueryParams=true}}
class="has-text-black has-text-weight-semibold"
>
{{if @backendModel.isV2KV "Create new version" "Edit"}}
</SecretLink>
</li>