From 2a91a5c4e52011dffa883b453442818cb09a7eaa Mon Sep 17 00:00:00 2001 From: linda9379 <57650314+linda9379@users.noreply.github.com> Date: Wed, 25 May 2022 11:28:19 -0400 Subject: [PATCH] Remove unsupported fields for DB roles show page (#15573) * Fixed unsupported revocation statements field display for DB roles * Fixed linting * Added changelog * Fixed conditional to filter for only elasticsearch database and changed format of text in changelog * Fixed conditional and added comment for bug fix --- changelog/15573.txt | 3 +++ ui/app/models/database/role.js | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog/15573.txt diff --git a/changelog/15573.txt b/changelog/15573.txt new file mode 100644 index 000000000..49f1d267f --- /dev/null +++ b/changelog/15573.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fixed unsupported revocation statements field for DB roles +``` \ No newline at end of file diff --git a/ui/app/models/database/role.js b/ui/app/models/database/role.js index e8fc3a67a..71d0445d2 100644 --- a/ui/app/models/database/role.js +++ b/ui/app/models/database/role.js @@ -3,7 +3,7 @@ import { computed } from '@ember/object'; import { alias } from '@ember/object/computed'; import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities'; import { expandAttributeMeta } from 'vault/utils/field-to-attrs'; -import { getRoleFields } from '../../utils/database-helpers'; +import { getRoleFields } from 'vault/utils/database-helpers'; export default Model.extend({ idPrefix: 'role/', @@ -91,7 +91,11 @@ export default Model.extend({ get showFields() { let fields = ['name', 'database', 'type']; - fields = fields.concat(getRoleFields(this.type)).concat(['creation_statements', 'revocation_statements']); + fields = fields.concat(getRoleFields(this.type)).concat(['creation_statements']); + // elasticsearch does not support revocation statements: https://www.vaultproject.io/api-docs/secret/databases/elasticdb#parameters-1 + if (this.database[0] !== 'elasticsearch') { + fields = fields.concat(['revocation_statements']); + } return expandAttributeMeta(this, fields); },