Skip to content

Commit 5cfffc3

Browse files
committed
Include preparing tasks in submitted task state badge total
1 parent 4c93303 commit 5cfffc3

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/components/cylc/TaskStateBadge.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
location="top"
2626
:open-delay="400"
2727
>
28-
{{ value }} {{ state }} task{{ value > 1 ? 's': '' }}.
28+
{{ value }} {{ displayName }} task{{ value > 1 ? 's': '' }}.
2929
<template v-if="latestTasks.length">
3030
Latest:
3131
<span
@@ -41,7 +41,9 @@
4141
</template>
4242

4343
<script setup>
44-
defineProps({
44+
import { computed } from 'vue'
45+
46+
const props = defineProps({
4547
state: {
4648
type: String,
4749
required: true
@@ -59,4 +61,8 @@ defineProps({
5961
default: 5,
6062
},
6163
})
64+
65+
const displayName = computed(
66+
() => props.state === 'submitted' ? 'preparing/submitted' : props.state
67+
)
6268
</script>

src/components/cylc/tree/GScanTreeItem.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,15 @@ function getStatesInfo (node, stateTotals = {}, latestTasks = {}) {
117117
118118
// the non-zero state totals from this node with all the others from the tree
119119
for (const state of taskStatesOrdered) {
120-
const nodeTotal = node.node.stateTotals[state]
120+
let nodeTotal = node.node.stateTotals[state]
121+
const nodeLatestTasks = node.node.latestStateTasks?.[state] ?? []
122+
if (state === TaskState.SUBMITTED.name) { // include preparing tasks
123+
nodeTotal += node.node.stateTotals.preparing
124+
nodeLatestTasks.push(...(node.node.latestStateTasks?.preparing ?? []))
125+
}
121126
if (nodeTotal) {
122127
stateTotals[state] = (stateTotals[state] ?? 0) + nodeTotal
123128
}
124-
const nodeLatestTasks = node.node.latestStateTasks?.[state]
125129
if (nodeLatestTasks?.length) {
126130
latestTasks[state] = [
127131
...(latestTasks[state] ?? []),

0 commit comments

Comments
 (0)