From 28ecc176ccbd6d3c3bb664468f81ae2a9d524696 Mon Sep 17 00:00:00 2001 From: claire bontempo <68122737+hellobontempo@users.noreply.github.com> Date: Thu, 14 Oct 2021 13:14:33 -0700 Subject: [PATCH] UI/remove empty rows from DB config pages (#12819) * adds helper so only rows with values display * adds changelog * add argument to is-empty-value helper to check for default * adds test to helper for added named argument --- changelog/12819.txt | 3 ++ ui/app/helpers/is-empty-value.js | 5 ++- .../components/database-connection.hbs | 6 ++-- .../helpers/is-empty-value-test.js | 31 ++++++++++++++++--- 4 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 changelog/12819.txt diff --git a/changelog/12819.txt b/changelog/12819.txt new file mode 100644 index 0000000000000..80e772b4827bd --- /dev/null +++ b/changelog/12819.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Removes empty rows from DB config views +``` diff --git a/ui/app/helpers/is-empty-value.js b/ui/app/helpers/is-empty-value.js index 2c43bdd99bcb0..6f3de8abd1495 100644 --- a/ui/app/helpers/is-empty-value.js +++ b/ui/app/helpers/is-empty-value.js @@ -1,6 +1,9 @@ import { helper } from '@ember/component/helper'; -export default helper(function isEmptyValue([value] /*, hash*/) { +export default helper(function isEmptyValue([value], { hasDefault = false }) { + if (hasDefault) { + value = hasDefault; + } if (typeof value === 'object' && value !== null) { return Object.keys(value).length === 0; } diff --git a/ui/app/templates/components/database-connection.hbs b/ui/app/templates/components/database-connection.hbs index 19aee380418fc..69b34a7c33f77 100644 --- a/ui/app/templates/components/database-connection.hbs +++ b/ui/app/templates/components/database-connection.hbs @@ -310,14 +310,14 @@ {{#let attr.options.defaultShown as |defaultDisplay|}} {{#if (eq attr.type "object")}} {{else if (eq attr.type "array")}} {{else}}