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 progress bars out of invocation summary.
- Loading branch information
Showing
3 changed files
with
143 additions
and
94 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
client/src/components/WorkflowInvocationState/InvocationJobsProgressBar.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,63 @@ | ||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
import { InvocationJobsSummary } from "@/api/invocations"; | ||
import ProgressBar from "@/components/ProgressBar.vue"; | ||
import { | ||
errorCount as jobStatesSummaryErrorCount, | ||
jobCount as jobStatesSummaryJobCount, | ||
numTerminal, | ||
okCount as jobStatesSummaryOkCount, | ||
runningCount as jobStatesSummaryRunningCount, | ||
} from "./util"; | ||
interface Props { | ||
jobStatesSummary: InvocationJobsSummary; | ||
invocationSchedulingTerminal: boolean; | ||
invocationAndJobTerminal: boolean; | ||
} | ||
const props = defineProps<Props>(); | ||
const jobCount = computed<number>(() => { | ||
return jobStatesSummaryJobCount(props.jobStatesSummary); | ||
}); | ||
const okCount = computed<number>(() => { | ||
return jobStatesSummaryOkCount(props.jobStatesSummary); | ||
}); | ||
const runningCount = computed<number>(() => { | ||
return jobStatesSummaryRunningCount(props.jobStatesSummary); | ||
}); | ||
const errorCount = computed<number>(() => { | ||
return jobStatesSummaryErrorCount(props.jobStatesSummary); | ||
}); | ||
const newCount = computed<number>(() => { | ||
return jobCount.value - okCount.value - runningCount.value - errorCount.value; | ||
}); | ||
const jobStatesStr = computed(() => { | ||
let jobStr = `${numTerminal(props.jobStatesSummary) || 0} of ${jobCount.value} jobs complete`; | ||
if (!props.invocationSchedulingTerminal) { | ||
jobStr += " (total number of jobs will change until all steps fully scheduled)"; | ||
} | ||
return `${jobStr}.`; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<ProgressBar | ||
:note="jobStatesStr" | ||
:total="jobCount" | ||
:ok-count="okCount" | ||
:running-count="runningCount" | ||
:new-count="newCount" | ||
:error-count="errorCount" | ||
:loading="!invocationAndJobTerminal" | ||
class="jobs-progress" /> | ||
</template> |
68 changes: 68 additions & 0 deletions
68
client/src/components/WorkflowInvocationState/InvocationStepsProgressBar.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,68 @@ | ||
<script setup lang="ts"> | ||
import { computed } from "vue"; | ||
import { InvocationStep, WorkflowInvocationElementView } from "@/api/invocations"; | ||
import ProgressBar from "@/components/ProgressBar.vue"; | ||
interface Props { | ||
invocation?: WorkflowInvocationElementView; | ||
invocationState: string; | ||
invocationSchedulingTerminal: boolean; | ||
} | ||
const props = defineProps<Props>(); | ||
const stepCount = computed<number>(() => { | ||
return props.invocation?.steps.length || 0; | ||
}); | ||
type StepStateType = { [state: string]: number }; | ||
const stepStates = computed<StepStateType>(() => { | ||
const stepStates: StepStateType = {}; | ||
if (!props.invocation) { | ||
return {}; | ||
} | ||
const steps: InvocationStep[] = props.invocation?.steps || []; | ||
for (const step of steps) { | ||
if (!step) { | ||
continue; | ||
} | ||
// the API defined state here allowing null and undefined is odd... | ||
const stepState: string = step.state || "unknown"; | ||
if (!stepStates[stepState]) { | ||
stepStates[stepState] = 1; | ||
} else { | ||
stepStates[stepState] += 1; | ||
} | ||
} | ||
return stepStates; | ||
}); | ||
const stepStatesStr = computed<string>(() => { | ||
return `${stepStates.value?.scheduled || 0} of ${stepCount.value} steps successfully scheduled.`; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span> | ||
<ProgressBar v-if="!stepCount" note="Loading step state summary..." :loading="true" class="steps-progress" /> | ||
<ProgressBar | ||
v-if="invocationState == 'cancelled'" | ||
note="Invocation scheduling cancelled - expected jobs and outputs may not be generated." | ||
:error-count="1" | ||
class="steps-progress" /> | ||
<ProgressBar | ||
v-else-if="invocationState == 'failed'" | ||
note="Invocation scheduling failed - Galaxy administrator may have additional details in logs." | ||
:error-count="1" | ||
class="steps-progress" /> | ||
<ProgressBar | ||
v-else | ||
:note="stepStatesStr" | ||
:total="stepCount" | ||
:ok-count="stepStates.scheduled" | ||
:loading="!invocationSchedulingTerminal" | ||
class="steps-progress" /> | ||
</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