mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-30 15:11:24 +01:00
UI/fix db role ttl display (#14224)
* Format duration for display if editType ttl * Update ttl fields to default_ttl * Fix db tests * Add changelog
This commit is contained in:
parent
3ff381abe5
commit
c81146928d
3
changelog/14224.txt
Normal file
3
changelog/14224.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: Fix default TTL display and set on database role
|
||||||
|
```
|
||||||
@ -26,7 +26,7 @@ export default Model.extend({
|
|||||||
noDefault: true,
|
noDefault: true,
|
||||||
possibleValues: ['static', 'dynamic'],
|
possibleValues: ['static', 'dynamic'],
|
||||||
}),
|
}),
|
||||||
ttl: attr({
|
default_ttl: attr({
|
||||||
editType: 'ttl',
|
editType: 'ttl',
|
||||||
defaultValue: '1h',
|
defaultValue: '1h',
|
||||||
label: 'Generated credentials’s Time-to-Live (TTL)',
|
label: 'Generated credentials’s Time-to-Live (TTL)',
|
||||||
@ -98,7 +98,7 @@ export default Model.extend({
|
|||||||
roleSettingAttrs: computed(function () {
|
roleSettingAttrs: computed(function () {
|
||||||
// logic for which get displayed is on DatabaseRoleSettingForm
|
// logic for which get displayed is on DatabaseRoleSettingForm
|
||||||
let allRoleSettingFields = [
|
let allRoleSettingFields = [
|
||||||
'ttl',
|
'default_ttl',
|
||||||
'max_ttl',
|
'max_ttl',
|
||||||
'username',
|
'username',
|
||||||
'rotation_period',
|
'rotation_period',
|
||||||
|
|||||||
@ -63,6 +63,14 @@
|
|||||||
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
||||||
@value={{stringify (get @model attr.name)}}
|
@value={{stringify (get @model attr.name)}}
|
||||||
/>
|
/>
|
||||||
|
{{else if (eq attr.options.editType "ttl")}}
|
||||||
|
<InfoTableRow
|
||||||
|
@alwaysRender={{true}}
|
||||||
|
@defaultShown={{defaultDisplay}}
|
||||||
|
@label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}}
|
||||||
|
@value={{format-duration (get @model attr.name)}}
|
||||||
|
@isLink={{eq attr.name "database"}}
|
||||||
|
/>
|
||||||
{{else}}
|
{{else}}
|
||||||
<InfoTableRow
|
<InfoTableRow
|
||||||
@alwaysRender={{true}}
|
@alwaysRender={{true}}
|
||||||
|
|||||||
@ -175,7 +175,7 @@ export const AVAILABLE_PLUGIN_TYPES = [
|
|||||||
|
|
||||||
export const ROLE_FIELDS = {
|
export const ROLE_FIELDS = {
|
||||||
static: ['username', 'rotation_period'],
|
static: ['username', 'rotation_period'],
|
||||||
dynamic: ['ttl', 'max_ttl'],
|
dynamic: ['default_ttl', 'max_ttl'],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const STATEMENT_FIELDS = {
|
export const STATEMENT_FIELDS = {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ const testCases = [
|
|||||||
staticRoleFields: ['name', 'username', 'rotation_period', 'rotation_statements'],
|
staticRoleFields: ['name', 'username', 'rotation_period', 'rotation_statements'],
|
||||||
dynamicRoleFields: [
|
dynamicRoleFields: [
|
||||||
'name',
|
'name',
|
||||||
'ttl',
|
'default_ttl',
|
||||||
'max_ttl',
|
'max_ttl',
|
||||||
'creation_statements',
|
'creation_statements',
|
||||||
'revocation_statements',
|
'revocation_statements',
|
||||||
@ -22,49 +22,49 @@ const testCases = [
|
|||||||
{
|
{
|
||||||
pluginType: 'elasticsearch-database-plugin',
|
pluginType: 'elasticsearch-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statement', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statement', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mongodb-database-plugin',
|
pluginType: 'mongodb-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statement', 'revocation_statement', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statement', 'revocation_statement', 'default_ttl', 'max_ttl'],
|
||||||
statementsHidden: true,
|
statementsHidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mssql-database-plugin',
|
pluginType: 'mssql-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mysql-database-plugin',
|
pluginType: 'mysql-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mysql-aurora-database-plugin',
|
pluginType: 'mysql-aurora-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mysql-rds-database-plugin',
|
pluginType: 'mysql-rds-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'mysql-legacy-database-plugin',
|
pluginType: 'mysql-legacy-database-plugin',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pluginType: 'vault-plugin-database-oracle',
|
pluginType: 'vault-plugin-database-oracle',
|
||||||
staticRoleFields: ['username', 'rotation_period'],
|
staticRoleFields: ['username', 'rotation_period'],
|
||||||
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'ttl', 'max_ttl'],
|
dynamicRoleFields: ['creation_statements', 'revocation_statements', 'default_ttl', 'max_ttl'],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
// used to calculate checks that fields do NOT show up
|
// used to calculate checks that fields do NOT show up
|
||||||
const ALL_ATTRS = [
|
const ALL_ATTRS = [
|
||||||
{ name: 'ttl', type: 'string', options: {} },
|
{ name: 'default_ttl', type: 'string', options: {} },
|
||||||
{ name: 'max_ttl', type: 'string', options: {} },
|
{ name: 'max_ttl', type: 'string', options: {} },
|
||||||
{ name: 'username', type: 'string', options: {} },
|
{ name: 'username', type: 'string', options: {} },
|
||||||
{ name: 'rotation_period', type: 'string', options: {} },
|
{ name: 'rotation_period', type: 'string', options: {} },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user