forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor workflow step toward TS & reuse.
- Loading branch information
Showing
5 changed files
with
126 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
client/src/components/WorkflowInvocationState/WorkflowStepIcon.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts" setup> | ||
import { computed } from "vue"; | ||
import WorkflowIcons from "@/components/Workflow/icons"; | ||
interface WorkflowStepIconProps { | ||
stepType: "tool" | "data_input" | "data_collection_input" | "subworkflow" | "parameter_input" | "pause"; | ||
} | ||
const props = defineProps<WorkflowStepIconProps>(); | ||
const stepIcon = computed(() => { | ||
return WorkflowIcons[props.stepType]; | ||
}); | ||
const cssClasses = computed(() => { | ||
return ["fa", "mr-1", stepIcon.value]; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<i :class="cssClasses"></i> | ||
</template> |
76 changes: 76 additions & 0 deletions
76
client/src/components/WorkflowInvocationState/WorkflowStepTitle.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<script setup lang="ts"> | ||
import { computed, watch } from "vue"; | ||
import { useToolStore } from "@/stores/toolStore"; | ||
import { useWorkflowStore } from "@/stores/workflowStore"; | ||
interface WorkflowInvocationStepTitleProps { | ||
stepIndex: number; | ||
stepLabel?: string; | ||
stepType: string; | ||
stepToolId?: string; | ||
stepSubworkflowId?: string; | ||
} | ||
const props = defineProps<WorkflowInvocationStepTitleProps>(); | ||
const workflowStore = useWorkflowStore(); | ||
const toolStore = useToolStore(); | ||
const subWorkflow = computed(() => { | ||
if (props.stepSubworkflowId) { | ||
return workflowStore.getStoredWorkflowByInstanceId(props.stepSubworkflowId); | ||
} | ||
return null; | ||
}); | ||
const toolName = computed(() => { | ||
if (props.stepToolId) { | ||
return toolStore.getToolNameById(props.stepToolId); | ||
} | ||
return ""; | ||
}); | ||
const title = computed(() => { | ||
const oneBasedStepIndex = props.stepIndex + 1; | ||
if (props.stepLabel) { | ||
return `Step ${oneBasedStepIndex}: ${props.stepLabel}`; | ||
} | ||
const workflowStepType = props.stepType; | ||
switch (workflowStepType) { | ||
case "tool": | ||
return `Step ${oneBasedStepIndex}: ${toolName.value}`; | ||
case "subworkflow": { | ||
const subworkflow = subWorkflow.value; | ||
const label = subworkflow ? subworkflow.name : "Subworkflow"; | ||
return `Step ${oneBasedStepIndex}: ${label}`; | ||
} | ||
case "parameter_input": | ||
return `Step ${oneBasedStepIndex}: Parameter input`; | ||
case "data_input": | ||
return `Step ${oneBasedStepIndex}: Data input`; | ||
case "data_collection_input": | ||
return `Step ${oneBasedStepIndex}: Data collection input`; | ||
default: | ||
return `Step ${oneBasedStepIndex}: Unknown step type '${workflowStepType}'`; | ||
} | ||
}); | ||
function initStores() { | ||
if (props.stepToolId && !toolStore.getToolForId(props.stepToolId)) { | ||
toolStore.fetchToolForId(props.stepToolId); | ||
} | ||
if (props.stepSubworkflowId) { | ||
workflowStore.fetchWorkflowForInstanceId(props.stepSubworkflowId); | ||
} | ||
} | ||
watch(props, () => { | ||
initStores(); | ||
}); | ||
initStores(); | ||
</script> | ||
|
||
<template> | ||
<span>{{ title }}</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters