Skip to content

Commit

Permalink
Remove unsupported fields for DB roles show page (hashicorp#15573)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
linda9379 authored and Gabrielopesantos committed Jun 6, 2022
1 parent 2a394a9 commit e81b51e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/15573.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fixed unsupported revocation statements field for DB roles
```
8 changes: 6 additions & 2 deletions ui/app/models/database/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down Expand Up @@ -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);
},

Expand Down

0 comments on commit e81b51e

Please sign in to comment.