From 562fd3d1fe88dd963ad20f4c2cecd9e23c9be4a0 Mon Sep 17 00:00:00 2001 From: axolotle Date: Fri, 19 Feb 2021 18:56:26 +0100 Subject: [PATCH] Fix AppConfigPanel and use helper components --- app/src/components/globals/Card.vue | 3 + app/src/helpers/yunohostArguments.js | 10 ++- app/src/views/app/AppConfigPanel.vue | 97 ++++++++++++++-------------- 3 files changed, 57 insertions(+), 53 deletions(-) diff --git a/app/src/components/globals/Card.vue b/app/src/components/globals/Card.vue index 1cf36f85..6704b7f2 100644 --- a/app/src/components/globals/Card.vue +++ b/app/src/components/globals/Card.vue @@ -89,4 +89,7 @@ export default { margin-left: .5rem; } } +.collapse:not(.show) + .card-footer { + display: none; +} diff --git a/app/src/helpers/yunohostArguments.js b/app/src/helpers/yunohostArguments.js index fd9dc687..42bd3c53 100644 --- a/app/src/helpers/yunohostArguments.js +++ b/app/src/helpers/yunohostArguments.js @@ -88,7 +88,11 @@ export function formatYunoHostArgument (arg) { // Checkbox } else if (arg.type === 'boolean') { field.component = 'CheckboxItem' - value = arg.default || false + if (typeof arg.default === 'number') { + value = arg.default === 1 + } else { + value = arg.default || false + } // Special (store related) } else if (['user', 'domain'].includes(arg.type)) { field.component = 'SelectItem' @@ -106,8 +110,8 @@ export function formatYunoHostArgument (arg) { if (field.component !== 'CheckboxItem' && arg.optional !== true) { validation.required = validators.required } - // Default value - if (arg.default) { + // Default value if still `null` + if (value === null && arg.default) { value = arg.default } // Help message diff --git a/app/src/views/app/AppConfigPanel.vue b/app/src/views/app/AppConfigPanel.vue index e9a706cd..3edc1672 100644 --- a/app/src/views/app/AppConfigPanel.vue +++ b/app/src/views/app/AppConfigPanel.vue @@ -5,37 +5,26 @@ {{ $t('experimental_warning') }} - - - - -

{{ panel.name }} {{ panel.help }}

+ + -
- - {{ $t('words.collapse') }} - -
-
+
+ {{ section.name }} {{ section.help }} - - - {{ section.name }} {{ section.help }} - - - - - - - - - - - - + +
+ @@ -46,14 +35,18 @@