From f45ab60fa0ae64c1c014f70cbfdb87b41cfcca02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20G=C3=B6bel?= <dgoebel@techfak.uni-bielefeld.de>
Date: Thu, 21 Sep 2023 11:19:30 +0200
Subject: [PATCH] Send default hidden parameters when starting a workflow
 execution

#63
---
 .../ParameterSchemaDescriptionComponent.vue   | 23 ++++---------
 .../ParameterSchemaFormComponent.vue          | 32 +++++++------------
 .../description-mode/ParameterDescription.vue |  3 +-
 .../ParameterGroupDescription.vue             |  5 ++-
 .../form-mode/ParameterGroupForm.vue          |  6 ++--
 src/views/workflows/StartWorkflowView.vue     |  1 +
 6 files changed, 27 insertions(+), 43 deletions(-)

diff --git a/src/components/parameter-schema/ParameterSchemaDescriptionComponent.vue b/src/components/parameter-schema/ParameterSchemaDescriptionComponent.vue
index df8d127..79063a1 100644
--- a/src/components/parameter-schema/ParameterSchemaDescriptionComponent.vue
+++ b/src/components/parameter-schema/ParameterSchemaDescriptionComponent.vue
@@ -17,22 +17,13 @@ type ParameterGroup = {
 };
 
 const navParameterGroups = computed<ParameterGroup[]>(() =>
-  Object.keys(parameterGroups.value)
-    .map((group) => {
-      return {
-        group: group,
-        title: parameterGroups.value[group]["title"],
-        icon: parameterGroups.value[group]["fa_icon"],
-      };
-    })
-    .filter(
-      // filter all groups that have only hidden parameters
-      (group) =>
-        Object.keys(parameterGroups.value[group.group]["properties"]).filter(
-          (key) =>
-            !parameterGroups.value[group.group]["properties"][key]["hidden"],
-        ).length > 0,
-    ),
+  Object.keys(parameterGroups.value).map((group) => {
+    return {
+      group: group,
+      title: parameterGroups.value[group]["title"],
+      icon: parameterGroups.value[group]["fa_icon"],
+    };
+  }),
 );
 
 const parameterGroups = computed<Record<string, never>>(
diff --git a/src/components/parameter-schema/ParameterSchemaFormComponent.vue b/src/components/parameter-schema/ParameterSchemaFormComponent.vue
index d59dd13..4dd82b9 100644
--- a/src/components/parameter-schema/ParameterSchemaFormComponent.vue
+++ b/src/components/parameter-schema/ParameterSchemaFormComponent.vue
@@ -78,22 +78,13 @@ const parameterGroups = computed<Record<string, never>>(
 
 // Create a list with the names of all parameter groups
 const navParameterGroups = computed<ParameterGroup[]>(() =>
-  Object.keys(parameterGroups.value)
-    .map((group) => {
-      return {
-        group: group,
-        title: parameterGroups.value[group]["title"],
-        icon: parameterGroups.value[group]["fa_icon"],
-      };
-    })
-    .filter(
-      // filter all groups that have only hidden parameters
-      (group) =>
-        Object.keys(parameterGroups.value[group.group]["properties"]).filter(
-          (key) =>
-            !parameterGroups.value[group.group]["properties"][key]["hidden"],
-        ).length > 0,
-    ),
+  Object.keys(parameterGroups.value).map((group) => {
+    return {
+      group: group,
+      title: parameterGroups.value[group]["title"],
+      icon: parameterGroups.value[group]["fa_icon"],
+    };
+  }),
 );
 
 // Watchers
@@ -115,14 +106,13 @@ function updateSchema(schema: Record<string, any>) {
   const b = Object.keys(schema["definitions"]).map((groupName) => [
     groupName,
     Object.fromEntries(
-      Object.entries(schema["definitions"][groupName]["properties"])
-        // @ts-ignore
-        .filter(([_, parameter]) => !parameter["hidden"])
-        .map(([parameterName, parameter]) => [
+      Object.entries(schema["definitions"][groupName]["properties"]).map(
+        ([parameterName, parameter]) => [
           parameterName,
           // @ts-ignore
           parameter["default"],
-        ]),
+        ],
+      ),
     ),
   ]);
   formState.formInput = Object.fromEntries(b);
diff --git a/src/components/parameter-schema/description-mode/ParameterDescription.vue b/src/components/parameter-schema/description-mode/ParameterDescription.vue
index cd7a63e..bace411 100644
--- a/src/components/parameter-schema/description-mode/ParameterDescription.vue
+++ b/src/components/parameter-schema/description-mode/ParameterDescription.vue
@@ -32,7 +32,7 @@ const defaultValue = computed<string | undefined>(
 const enumValues = computed<string[] | undefined>(
   () => props.parameter["enum"]?.map((val: string) => val.toString()),
 );
-const hidden = computed<boolean>(() => props.parameter["hidden"] ?? false);
+// const hidden = computed<boolean>(() => props.parameter["hidden"] ?? false);
 const parameterPattern = computed<string | undefined>(
   () => props.parameter["pattern"],
 );
@@ -48,7 +48,6 @@ const showRightColum = computed<boolean>(
 <template>
   <div
     class="row border-top border-bottom border-secondary align-items-start py-2"
-    v-if="!hidden"
   >
     <div class="fs-6 col-3">
       <font-awesome-icon :icon="icon" v-if="icon" class="me-2" />
diff --git a/src/components/parameter-schema/description-mode/ParameterGroupDescription.vue b/src/components/parameter-schema/description-mode/ParameterGroupDescription.vue
index 93b8b94..6ced29b 100644
--- a/src/components/parameter-schema/description-mode/ParameterGroupDescription.vue
+++ b/src/components/parameter-schema/description-mode/ParameterGroupDescription.vue
@@ -20,19 +20,22 @@ const props = defineProps({
 const title = computed<string>(() => props.parameterGroup["title"]);
 const icon = computed<string>(() => props.parameterGroup["fa_icon"]);
 const description = computed<string>(() => props.parameterGroup["description"]);
+/*
 const groupHidden = computed<boolean>(() =>
   Object.keys(parameters.value).reduce(
     (acc: boolean, val: string) => acc && parameters.value[val]["hidden"],
     true,
   ),
 );
+
+ */
 const parameters = computed<Record<string, never>>(
   () => props.parameterGroup["properties"],
 );
 </script>
 
 <template>
-  <div class="mb-5" v-if="!groupHidden">
+  <div class="mb-5">
     <div class="row">
       <h2 :id="props.parameterGroupName">
         <font-awesome-icon :icon="icon" class="me-3" v-if="icon" />{{ title }}
diff --git a/src/components/parameter-schema/form-mode/ParameterGroupForm.vue b/src/components/parameter-schema/form-mode/ParameterGroupForm.vue
index f84a78d..4dae916 100644
--- a/src/components/parameter-schema/form-mode/ParameterGroupForm.vue
+++ b/src/components/parameter-schema/form-mode/ParameterGroupForm.vue
@@ -71,7 +71,7 @@ watch(
 </script>
 
 <template>
-  <div class="card mb-3" v-if="!groupHidden">
+  <div class="card mb-3" :hidden="groupHidden">
     <h2 class="card-header" :id="props.parameterGroupName">
       <font-awesome-icon :icon="icon" class="me-2" v-if="icon" />
       {{ title }}
@@ -82,7 +82,7 @@ watch(
         v-for="(parameter, parameterName) in parameters"
         :key="parameterName"
       >
-        <template v-if="!parameter['hidden']">
+        <div :hidden="parameter['hidden']">
           <div class="input-group">
             <span class="input-group-text" :id="parameterName + '-help'">
               <font-awesome-icon
@@ -170,7 +170,7 @@ watch(
               </p>
             </div>
           </div>
-        </template>
+        </div>
       </template>
     </div>
   </div>
diff --git a/src/views/workflows/StartWorkflowView.vue b/src/views/workflows/StartWorkflowView.vue
index d5eeae0..6081630 100644
--- a/src/views/workflows/StartWorkflowView.vue
+++ b/src/views/workflows/StartWorkflowView.vue
@@ -73,6 +73,7 @@ function startWorkflow(
       parameters: parameters,
       notes: notes,
       report_output_bucket: report_output_bucket,
+      mode: props.workflowModeId,
     })
       .then(() => {
         router.push({
-- 
GitLab