Merge pull request #14688 from mvdbeek/dev

Merge 22.05 into dev
This commit is contained in:
Marius van den Beek
2022-09-26 15:19:53 +02:00
committed by GitHub
12 changed files with 245 additions and 160 deletions
@@ -2,13 +2,19 @@
<div :step-label="model.step_label">
<FormCard :title="model.fixed_title" :icon="icon" :collapsible="true" :expanded.sync="expanded">
<template v-slot:body>
<FormMessage :message="errorText" variant="danger" :persistent="true" />
<FormDisplay
v-if="hasInputs"
:inputs="inputs"
:inputs="modelInputs"
:sustain-repeats="true"
:sustain-conditionals="true"
:replace-params="replaceParams"
:validation-scroll-to="validationScrollTo"
collapsed-enable-text="Edit"
collapsed-enable-icon="fa fa-edit"
collapsed-disable-text="Undo"
collapsed-disable-icon="fa fa-undo"
@onChange="onChange"
@onValidation="onValidation" />
<div v-else class="py-2">No options available.</div>
</template>
</FormCard>
</div>
@@ -17,52 +23,43 @@
<script>
import WorkflowIcons from "components/Workflow/icons";
import FormDisplay from "components/Form/FormDisplay";
import FormMessage from "components/Form/FormMessage";
import FormCard from "components/Form/FormCard";
import { visitInputs } from "components/Form/utilities";
import { getTool } from "./services";
export default {
components: {
FormDisplay,
FormCard,
FormMessage,
},
props: {
model: {
type: Object,
required: true,
},
replaceParams: {
type: Object,
default: null,
},
validationScrollTo: {
type: Array,
required: true,
},
historyId: {
type: String,
default: null,
},
},
data() {
return {
expanded: this.model.expanded,
errorText: null,
modelIndex: {},
modelInputs: this.model.inputs,
};
},
computed: {
icon() {
return WorkflowIcons[this.model.step_type];
},
isSimpleInput() {
return (
this.model.step_type.startsWith("data_input") ||
this.model.step_type.startsWith("data_collection_input")
);
},
inputs() {
this.model.inputs.forEach((input) => {
input.flavor = "module";
input.hide_label = this.isSimpleInput;
});
if (this.model.inputs && this.model.inputs.length > 0) {
return this.model.inputs;
}
return [];
},
hasInputs() {
return this.inputs.length > 0;
},
},
watch: {
validationScrollTo() {
if (this.validationScrollTo.length > 0) {
@@ -70,8 +67,35 @@ export default {
}
},
},
computed: {
icon() {
return WorkflowIcons[this.model.step_type];
},
},
methods: {
onChange(data) {
onCreateIndex() {
this.modelIndex = {};
visitInputs(this.modelInputs, (input, name) => {
this.modelIndex[name] = input;
});
},
onChange(data, refreshRequest) {
if (refreshRequest) {
getTool(this.model.id, this.model.version, data, this.historyId).then(
(newModel) => {
this.onCreateIndex();
visitInputs(newModel.inputs, (newInput, name) => {
const input = this.modelIndex[name];
input.options = newInput.options;
input.textable = newInput.textable;
});
this.modelInputs = JSON.parse(JSON.stringify(this.modelInputs));
},
(errorText) => {
this.errorText = errorText;
}
);
}
this.$emit("onChange", this.model.index, data);
},
onValidation(validation) {
@@ -36,15 +36,15 @@
</template>
</FormCard>
<div v-for="step in model.steps" :key="step.index">
<WorkflowRunToolStep
v-if="step.step_type == 'tool'"
<WorkflowRunDefaultStep
v-if="step.step_type == 'tool' || step.step_type == 'subworkflow'"
:model="step"
:replace-params="getReplaceParams(step.inputs)"
:validation-scroll-to="getValidationScrollTo(step.index)"
:history-id="currentHistoryId"
@onChange="onToolStepInputs"
@onValidation="onValidation" />
<WorkflowRunDefaultStep
<WorkflowRunInputStep
v-else
:model="step"
:validation-scroll-to="getValidationScrollTo(step.index)"
@@ -64,7 +64,7 @@ import FormCard from "components/Form/FormCard";
import FormElement from "components/Form/FormElement";
import UserHistories from "components/providers/UserHistories";
import WorkflowRunDefaultStep from "./WorkflowRunDefaultStep";
import WorkflowRunToolStep from "./WorkflowRunToolStep";
import WorkflowRunInputStep from "./WorkflowRunInputStep";
import { allowCachedJobs } from "components/Tool/utilities";
import { getReplacements } from "./model";
import { invokeWorkflow } from "./services";
@@ -78,7 +78,7 @@ export default {
FormElement,
UserHistories,
WorkflowRunDefaultStep,
WorkflowRunToolStep,
WorkflowRunInputStep,
},
props: {
model: {
@@ -93,6 +93,7 @@ export default {
stepValidations: {},
stepScrollTo: {},
wpData: {},
inputs: {},
historyData: {},
useCachedJobs: false,
historyInputs: [
@@ -155,8 +156,7 @@ export default {
return [];
},
onDefaultStepInputs(stepId, data) {
this.stepData[stepId] = data;
this.stepData = Object.assign({}, this.stepData);
this.inputs[stepId] = data.input;
},
onToolStepInputs(stepId, data) {
this.stepData[stepId] = data;
@@ -201,6 +201,7 @@ export default {
resource_params: this.resourceData,
replacement_params: this.wpData,
use_cached_job: this.useCachedJobs,
inputs: this.inputs,
parameters: parameters,
// Tool form will submit flat maps for each parameter
// (e.g. "repeat_0|cond|param": "foo" instead of nested
@@ -0,0 +1,83 @@
<template>
<div :step-label="model.step_label">
<FormCard :title="model.fixed_title" :icon="icon" :collapsible="true" :expanded.sync="expanded">
<template v-slot:body>
<FormDisplay
v-if="hasInputs"
:inputs="inputs"
:validation-scroll-to="validationScrollTo"
@onChange="onChange"
@onValidation="onValidation" />
<div v-else class="py-2">No options available.</div>
</template>
</FormCard>
</div>
</template>
<script>
import WorkflowIcons from "components/Workflow/icons";
import FormDisplay from "components/Form/FormDisplay";
import FormCard from "components/Form/FormCard";
export default {
components: {
FormDisplay,
FormCard,
},
props: {
model: {
type: Object,
required: true,
},
validationScrollTo: {
type: Array,
required: true,
},
},
data() {
return {
expanded: this.model.expanded,
};
},
computed: {
icon() {
return WorkflowIcons[this.model.step_type];
},
isSimpleInput() {
return (
this.model.step_type.startsWith("data_input") ||
this.model.step_type.startsWith("data_collection_input")
);
},
inputs() {
this.model.inputs.forEach((input) => {
input.flavor = "module";
input.hide_label = this.isSimpleInput;
});
if (this.model.inputs && this.model.inputs.length > 0) {
return this.model.inputs;
}
return [];
},
hasInputs() {
return this.inputs.length > 0;
},
},
watch: {
validationScrollTo() {
if (this.validationScrollTo.length > 0) {
this.expanded = true;
}
},
},
methods: {
onChange(data) {
console.log("emitting default change", data);
this.$emit("onChange", this.model.index, data);
},
onValidation(validation) {
this.$emit("onValidation", this.model.index, validation);
},
},
};
</script>
@@ -1,100 +0,0 @@
<template>
<div :step-label="model.step_label">
<FormCard :title="model.fixed_title" icon="fa-wrench" :collapsible="true" :expanded.sync="expanded">
<template v-slot:body>
<FormMessage :message="errorText" variant="danger" :persistent="true" />
<FormDisplay
:inputs="modelInputs"
:sustain-repeats="true"
:sustain-conditionals="true"
:replace-params="replaceParams"
:validation-scroll-to="validationScrollTo"
collapsed-enable-text="Edit"
collapsed-enable-icon="fa fa-edit"
collapsed-disable-text="Undo"
collapsed-disable-icon="fa fa-undo"
@onChange="onChange"
@onValidation="onValidation" />
</template>
</FormCard>
</div>
</template>
<script>
import FormDisplay from "components/Form/FormDisplay";
import FormMessage from "components/Form/FormMessage";
import FormCard from "components/Form/FormCard";
import { visitInputs } from "components/Form/utilities";
import { getTool } from "./services";
export default {
components: {
FormDisplay,
FormCard,
FormMessage,
},
props: {
model: {
type: Object,
required: true,
},
replaceParams: {
type: Object,
default: null,
},
validationScrollTo: {
type: Array,
required: true,
},
historyId: {
type: String,
default: null,
},
},
data() {
return {
expanded: this.model.expanded,
errorText: null,
modelIndex: {},
modelInputs: this.model.inputs,
};
},
watch: {
validationScrollTo() {
if (this.validationScrollTo.length > 0) {
this.expanded = true;
}
},
},
methods: {
onCreateIndex() {
this.modelIndex = {};
visitInputs(this.modelInputs, (input, name) => {
this.modelIndex[name] = input;
});
},
onChange(data, refreshRequest) {
if (refreshRequest) {
getTool(this.model.id, this.model.version, data, this.historyId).then(
(newModel) => {
this.onCreateIndex();
visitInputs(newModel.inputs, (newInput, name) => {
const input = this.modelIndex[name];
input.options = newInput.options;
input.textable = newInput.textable;
});
this.modelInputs = JSON.parse(JSON.stringify(this.modelInputs));
},
(errorText) => {
this.errorText = errorText;
}
);
}
this.$emit("onChange", this.model.index, data);
},
onValidation(validation) {
this.$emit("onValidation", this.model.index, validation);
},
},
};
</script>
@@ -86,6 +86,7 @@
<script>
import { mapCacheActions } from "vuex-cache";
import { mapGetters, mapActions } from "vuex";
import WorkflowIcons from "components/Workflow/icons";
import JobStep from "./JobStep";
import ParameterStep from "./ParameterStep";
import GenericHistoryItem from "components/History/Content/GenericItem";
@@ -134,18 +135,7 @@ export default {
return ["data_input", "data_collection_input"].includes(this.workflowStepType);
},
stepIcon() {
switch (this.workflowStepType) {
case "data_input":
return "fa-file";
case "data_collection_input":
return "fa-folder-o";
case "parameter_input":
return "fa-pencil";
case "subworkflow":
return "fa-tasks";
default:
return "fa-wrench";
}
return WorkflowIcons[this.workflowStepType];
},
stepLabel() {
return this.labelForWorkflowStep(this.workflowStep.id);