From 96f5f3cf50513afca71ceed86d3379a57309ee8f Mon Sep 17 00:00:00 2001 From: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com> Date: Wed, 23 Feb 2022 10:00:20 -0600 Subject: [PATCH] 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 --- changelog/14224.txt | 3 +++ ui/app/models/database/role.js | 4 ++-- .../components/database-role-edit.hbs | 8 ++++++++ ui/app/utils/database-helpers.js | 2 +- .../database-role-setting-form-test.js | 20 +++++++++---------- 5 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 changelog/14224.txt diff --git a/changelog/14224.txt b/changelog/14224.txt new file mode 100644 index 000000000..f7e566b25 --- /dev/null +++ b/changelog/14224.txt @@ -0,0 +1,3 @@ +```release-note:bug + ui: Fix default TTL display and set on database role +``` diff --git a/ui/app/models/database/role.js b/ui/app/models/database/role.js index 345427028..fb3d71670 100644 --- a/ui/app/models/database/role.js +++ b/ui/app/models/database/role.js @@ -26,7 +26,7 @@ export default Model.extend({ noDefault: true, possibleValues: ['static', 'dynamic'], }), - ttl: attr({ + default_ttl: attr({ editType: 'ttl', defaultValue: '1h', label: 'Generated credentials’s Time-to-Live (TTL)', @@ -98,7 +98,7 @@ export default Model.extend({ roleSettingAttrs: computed(function () { // logic for which get displayed is on DatabaseRoleSettingForm let allRoleSettingFields = [ - 'ttl', + 'default_ttl', 'max_ttl', 'username', 'rotation_period', diff --git a/ui/app/templates/components/database-role-edit.hbs b/ui/app/templates/components/database-role-edit.hbs index b504c0a27..5e8a8e854 100644 --- a/ui/app/templates/components/database-role-edit.hbs +++ b/ui/app/templates/components/database-role-edit.hbs @@ -63,6 +63,14 @@ @label={{capitalize (or attr.options.label (humanize (dasherize attr.name)))}} @value={{stringify (get @model attr.name)}} /> + {{else if (eq attr.options.editType "ttl")}} + {{else}}