Skip to content
Snippets Groups Projects
Commit cbaaeffd authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Merge branch 'feature/65-add-toogle-to-show-hidden-parameters' into 'development'

Resolve "Add toogle to show hidden parameters"

Closes #65

See merge request !59
parents 90d51a1a 0b8b3a83
No related branches found
No related tags found
2 merge requests!84Remove development branch,!59Resolve "Add toogle to show hidden parameters"
Pipeline #37453 passed
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed, ref } from "vue";
import ParameterGroupDescription from "@/components/parameter-schema/description-mode/ParameterGroupDescription.vue"; import ParameterGroupDescription from "@/components/parameter-schema/description-mode/ParameterGroupDescription.vue";
import FontAwesomeIcon from "@/components/FontAwesomeIcon.vue"; import FontAwesomeIcon from "@/components/FontAwesomeIcon.vue";
...@@ -16,15 +16,28 @@ type ParameterGroup = { ...@@ -16,15 +16,28 @@ type ParameterGroup = {
icon?: string; icon?: string;
}; };
const navParameterGroups = computed<ParameterGroup[]>(() => const showHidden = ref<boolean>(false);
Object.keys(parameterGroups.value).map((group) => {
const navParameterGroups = computed<ParameterGroup[]>(() => {
let groups = Object.keys(parameterGroups.value).map((group) => {
return { return {
group: group, group: group,
title: parameterGroups.value[group]["title"], title: parameterGroups.value[group]["title"],
icon: parameterGroups.value[group]["fa_icon"], icon: parameterGroups.value[group]["fa_icon"],
}; };
}), });
); if (!showHidden.value) {
groups = groups.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,
);
}
return groups;
});
const parameterGroups = computed<Record<string, never>>( const parameterGroups = computed<Record<string, never>>(
() => props.schema["definitions"], () => props.schema["definitions"],
...@@ -38,6 +51,7 @@ const parameterGroups = computed<Record<string, never>>( ...@@ -38,6 +51,7 @@ const parameterGroups = computed<Record<string, never>>(
<parameter-group-description <parameter-group-description
:parameter-group="group" :parameter-group="group"
:parameter-group-name="groupName" :parameter-group-name="groupName"
:show-hidden="showHidden"
/> />
</div> </div>
</div> </div>
...@@ -53,15 +67,31 @@ const parameterGroups = computed<Record<string, never>>( ...@@ -53,15 +67,31 @@ const parameterGroups = computed<Record<string, never>>(
v-for="group in navParameterGroups" v-for="group in navParameterGroups"
:key="group.group" :key="group.group"
> >
<a :href="'#' + group.group" <a :href="'#' + group.group">
><font-awesome-icon <font-awesome-icon
:icon="group.icon" :icon="group.icon"
v-if="group.icon" v-if="group.icon"
class="me-2" class="me-2"
/>{{ group.title }}</a />
{{ group.title }}</a
> >
</li> </li>
</ul> </ul>
<div class="mx-auto mb-3">
<input
type="checkbox"
class="btn-check ms-1"
id="btn-check-outlined"
v-model="showHidden"
autocomplete="off"
/>
<label class="btn btn-outline-primary" for="btn-check-outlined">
<font-awesome-icon
:icon="showHidden ? 'fa-solid fa-eye' : 'fa-solid fa-eye-slash'"
/>
Show hidden Parameters
</label>
</div>
</nav> </nav>
</nav> </nav>
</div> </div>
......
...@@ -62,12 +62,14 @@ const formState = reactive<{ ...@@ -62,12 +62,14 @@ const formState = reactive<{
pipelineNotes: string; pipelineNotes: string;
report_bucket?: string; report_bucket?: string;
errorType?: string; errorType?: string;
showHidden: boolean;
}>({ }>({
formInput: {}, formInput: {},
validated: false, validated: false,
pipelineNotes: "", pipelineNotes: "",
report_bucket: undefined, report_bucket: undefined,
errorType: undefined, errorType: undefined,
showHidden: false,
}); });
// Computed Properties // Computed Properties
...@@ -77,15 +79,26 @@ const parameterGroups = computed<Record<string, never>>( ...@@ -77,15 +79,26 @@ const parameterGroups = computed<Record<string, never>>(
); );
// Create a list with the names of all parameter groups // Create a list with the names of all parameter groups
const navParameterGroups = computed<ParameterGroup[]>(() => const navParameterGroups = computed<ParameterGroup[]>(() => {
Object.keys(parameterGroups.value).map((group) => { let groups = Object.keys(parameterGroups.value).map((group) => {
return { return {
group: group, group: group,
title: parameterGroups.value[group]["title"], title: parameterGroups.value[group]["title"],
icon: parameterGroups.value[group]["fa_icon"], icon: parameterGroups.value[group]["fa_icon"],
}; };
}), });
); if (!formState.showHidden) {
groups = groups.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,
);
}
return groups;
});
// Watchers // Watchers
// ============================================================================= // =============================================================================
...@@ -117,6 +130,7 @@ function updateSchema(schema: Record<string, any>) { ...@@ -117,6 +130,7 @@ function updateSchema(schema: Record<string, any>) {
]); ]);
formState.formInput = Object.fromEntries(b); formState.formInput = Object.fromEntries(b);
} }
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unused-vars */
function startWorkflow() { function startWorkflow() {
errorToast?.hide(); errorToast?.hide();
...@@ -251,6 +265,7 @@ onMounted(() => { ...@@ -251,6 +265,7 @@ onMounted(() => {
v-if="formState.formInput[groupName]" v-if="formState.formInput[groupName]"
:parameter-group-name="groupName" :parameter-group-name="groupName"
:parameter-group="group" :parameter-group="group"
:showHidden="formState.showHidden"
/> />
</template> </template>
</form> </form>
...@@ -303,8 +318,8 @@ onMounted(() => { ...@@ -303,8 +318,8 @@ onMounted(() => {
<nav v-if="props.schema" class="nav"> <nav v-if="props.schema" class="nav">
<ul class="ps-0"> <ul class="ps-0">
<li class="nav-link"> <li class="nav-link">
<a href="#pipelineGeneralOptions" <a href="#pipelineGeneralOptions">
><font-awesome-icon icon="fa-solid fa-gear" class="me-2" /> <font-awesome-icon icon="fa-solid fa-gear" class="me-2" />
General Pipeline Options General Pipeline Options
</a> </a>
</li> </li>
...@@ -313,15 +328,35 @@ onMounted(() => { ...@@ -313,15 +328,35 @@ onMounted(() => {
v-for="group in navParameterGroups" v-for="group in navParameterGroups"
:key="group.group" :key="group.group"
> >
<a :href="'#' + group.group" <a :href="'#' + group.group">
><font-awesome-icon <font-awesome-icon
:icon="group.icon" :icon="group.icon"
v-if="group.icon" v-if="group.icon"
class="me-2" class="me-2"
/>{{ group.title }}</a />
{{ group.title }}</a
> >
</li> </li>
</ul> </ul>
<div class="mx-auto mb-3">
<input
type="checkbox"
class="btn-check ms-1"
id="btn-check-outlined"
v-model="formState.showHidden"
autocomplete="off"
/>
<label class="btn btn-outline-primary" for="btn-check-outlined">
<font-awesome-icon
:icon="
formState.showHidden
? 'fa-solid fa-eye'
: 'fa-solid fa-eye-slash'
"
/>
Show hidden Parameters
</label>
</div>
</nav> </nav>
<!-- Loading nav links --> <!-- Loading nav links -->
<div v-else class="placeholder-glow ps-3 pt-3"> <div v-else class="placeholder-glow ps-3 pt-3">
......
...@@ -16,6 +16,10 @@ const props = defineProps({ ...@@ -16,6 +16,10 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
showHidden: {
type: Boolean,
default: false,
},
}); });
const randomIDSuffix = Math.random().toString(16).substring(2, 8); const randomIDSuffix = Math.random().toString(16).substring(2, 8);
...@@ -32,7 +36,7 @@ const defaultValue = computed<string | undefined>( ...@@ -32,7 +36,7 @@ const defaultValue = computed<string | undefined>(
const enumValues = computed<string[] | undefined>( const enumValues = computed<string[] | undefined>(
() => props.parameter["enum"]?.map((val: string) => val.toString()), () => 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>( const parameterPattern = computed<string | undefined>(
() => props.parameter["pattern"], () => props.parameter["pattern"],
); );
...@@ -48,6 +52,7 @@ const showRightColum = computed<boolean>( ...@@ -48,6 +52,7 @@ const showRightColum = computed<boolean>(
<template> <template>
<div <div
class="row border-top border-bottom border-secondary align-items-start py-2" class="row border-top border-bottom border-secondary align-items-start py-2"
v-if="showHidden || !hidden"
> >
<div class="fs-6 col-3"> <div class="fs-6 col-3">
<font-awesome-icon :icon="icon" v-if="icon" class="me-2" /> <font-awesome-icon :icon="icon" v-if="icon" class="me-2" />
......
...@@ -15,12 +15,16 @@ const props = defineProps({ ...@@ -15,12 +15,16 @@ const props = defineProps({
type: String, type: String,
required: true, required: true,
}, },
showHidden: {
type: Boolean,
default: false,
},
}); });
const title = computed<string>(() => props.parameterGroup["title"]); const title = computed<string>(() => props.parameterGroup["title"]);
const icon = computed<string>(() => props.parameterGroup["fa_icon"]); const icon = computed<string>(() => props.parameterGroup["fa_icon"]);
const description = computed<string>(() => props.parameterGroup["description"]); const description = computed<string>(() => props.parameterGroup["description"]);
/*
const groupHidden = computed<boolean>(() => const groupHidden = computed<boolean>(() =>
Object.keys(parameters.value).reduce( Object.keys(parameters.value).reduce(
(acc: boolean, val: string) => acc && parameters.value[val]["hidden"], (acc: boolean, val: string) => acc && parameters.value[val]["hidden"],
...@@ -28,14 +32,13 @@ const groupHidden = computed<boolean>(() => ...@@ -28,14 +32,13 @@ const groupHidden = computed<boolean>(() =>
), ),
); );
*/
const parameters = computed<Record<string, never>>( const parameters = computed<Record<string, never>>(
() => props.parameterGroup["properties"], () => props.parameterGroup["properties"],
); );
</script> </script>
<template> <template>
<div class="mb-5"> <div class="mb-5" v-if="props.showHidden || !groupHidden">
<div class="row"> <div class="row">
<h2 :id="props.parameterGroupName"> <h2 :id="props.parameterGroupName">
<font-awesome-icon :icon="icon" class="me-3" v-if="icon" />{{ title }} <font-awesome-icon :icon="icon" class="me-3" v-if="icon" />{{ title }}
...@@ -53,6 +56,7 @@ const parameters = computed<Record<string, never>>( ...@@ -53,6 +56,7 @@ const parameters = computed<Record<string, never>>(
:required=" :required="
props.parameterGroup['required']?.includes(parameterName) ?? false props.parameterGroup['required']?.includes(parameterName) ?? false
" "
:show-hidden="showHidden"
/> />
</template> </template>
</div> </div>
......
...@@ -23,6 +23,10 @@ const props = defineProps({ ...@@ -23,6 +23,10 @@ const props = defineProps({
type: Object, type: Object,
required: true, required: true,
}, },
showHidden: {
type: Boolean,
default: false,
},
}); });
const title = computed<string>(() => props.parameterGroup["title"]); const title = computed<string>(() => props.parameterGroup["title"]);
const icon = computed<string>(() => props.parameterGroup["fa_icon"]); const icon = computed<string>(() => props.parameterGroup["fa_icon"]);
...@@ -71,7 +75,7 @@ watch( ...@@ -71,7 +75,7 @@ watch(
</script> </script>
<template> <template>
<div class="card mb-3" :hidden="groupHidden"> <div class="card mb-3" :hidden="!showHidden && groupHidden">
<h2 class="card-header" :id="props.parameterGroupName"> <h2 class="card-header" :id="props.parameterGroupName">
<font-awesome-icon :icon="icon" class="me-2" v-if="icon" /> <font-awesome-icon :icon="icon" class="me-2" v-if="icon" />
{{ title }} {{ title }}
...@@ -82,7 +86,7 @@ watch( ...@@ -82,7 +86,7 @@ watch(
v-for="(parameter, parameterName) in parameters" v-for="(parameter, parameterName) in parameters"
:key="parameterName" :key="parameterName"
> >
<div :hidden="parameter['hidden']"> <div :hidden="!showHidden && parameter['hidden']">
<div class="input-group"> <div class="input-group">
<span class="input-group-text" :id="parameterName + '-help'"> <span class="input-group-text" :id="parameterName + '-help'">
<font-awesome-icon <font-awesome-icon
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment