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
This commit is contained in:
linda9379 2022-05-25 11:28:19 -04:00 committed by GitHub
parent df8ae055be
commit 2a91a5c4e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

3
changelog/15573.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Fixed unsupported revocation statements field for DB roles
```

View File

@ -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);
},