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

Parse ungrouped parameters from nextflow schema

#96
parent 4e233b83
No related branches found
No related tags found
1 merge request!93Resolve "Allow ungrouped parameters in nextflow schema"
...@@ -44,9 +44,19 @@ const navParameterGroups = computed<ParameterGroup[]>(() => { ...@@ -44,9 +44,19 @@ const navParameterGroups = computed<ParameterGroup[]>(() => {
return groups; return groups;
}); });
const parameterGroups = computed<Record<string, never>>( const parameterGroups = computed<Record<string, never>>(() => {
() => props.schema["definitions"], if (Object.keys(props.schema?.["properties"] ?? {}).length > 0) {
); return {
...props.schema?.["definitions"],
ungrouped_parameters: {
title: "Ungrouped Parameters",
properties: props.schema?.["properties"],
type: "object",
},
};
}
return props.schema?.["definitions"];
});
</script> </script>
<template> <template>
......
...@@ -104,9 +104,19 @@ const formState = reactive<{ ...@@ -104,9 +104,19 @@ const formState = reactive<{
// Computed Properties // Computed Properties
// ============================================================================= // =============================================================================
const parameterGroups = computed<Record<string, never>>( const parameterGroups = computed<Record<string, never>>(() => {
() => props.schema?.["definitions"], if (Object.keys(props.schema?.["properties"] ?? {}).length > 0) {
); return {
...props.schema?.["definitions"],
ungrouped_parameters: {
title: "Ungrouped Parameters",
properties: props.schema?.["properties"],
type: "object",
},
};
}
return props.schema?.["definitions"];
});
// 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[]>(() => {
...@@ -159,18 +169,19 @@ watch( ...@@ -159,18 +169,19 @@ watch(
/* 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 updateSchema(schema: Record<string, any>) { function updateSchema(schema: Record<string, any>) {
validateSchema = schemaCompiler.compile(schema); validateSchema = schemaCompiler.compile(schema);
const b = Object.keys(schema["definitions"]).map((groupName) => const groupedParameters = Object.keys(parameterGroups.value).map(
Object.fromEntries( (groupName) =>
Object.entries(schema["definitions"][groupName]["properties"]).map( Object.fromEntries(
([parameterName, parameter]) => [ Object.entries(parameterGroups.value[groupName]["properties"]).map(
parameterName, ([parameterName, parameter]) => [
// @ts-ignore parameterName,
parameter["default"], // @ts-ignore
], parameter["default"],
],
),
), ),
),
); );
formState.formInput = b.reduce((acc, val) => { formState.formInput = groupedParameters.reduce((acc, val) => {
return { ...acc, ...val }; return { ...acc, ...val };
}); });
loadParameters(executionRepository.popTemporaryParameters()); loadParameters(executionRepository.popTemporaryParameters());
......
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