@@ -142,42 +142,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
142
142
</v-flex >
143
143
<!-- We check the latestStateTasks below as offline workflows won't have a latestStateTasks property -->
144
144
<v-flex
145
- v-if =" scope.node.type === 'workflow' && scope.node. node.latestStateTasks"
145
+ v-if =" scope.node.node.latestStateTasks"
146
146
class =" text-right c-gscan-workflow-states"
147
147
>
148
- <!-- task summary tooltips -->
149
- <span
150
- v-for =" [state, tasks] in getLatestStateTasks(Object.entries(scope.node.node.latestStateTasks))"
151
- :key =" `${scope.node.id}-summary-${state}`"
152
- :class =" getTaskStateClasses(scope.node.node, state)"
153
- >
154
- <v-tooltip color =" black" top >
155
- <template v-slot :activator =" { on } " >
156
- <!-- a v-tooltip does not work directly set on Cylc job component, so we use a dummy button to wrap it -->
157
- <!-- NB: most of the classes/directives in these button are applied so that the user does not notice it is a button -->
158
- <v-btn
159
- v-on =" on"
160
- class =" ma-0 pa-0"
161
- min-width =" 0"
162
- min-height =" 0"
163
- style =" font-size : 120% ; width : auto "
164
- :ripple =" false"
165
- dark
166
- icon
167
- >
168
- <job :status =" state" />
169
- </v-btn >
170
- </template >
171
- <!-- tooltip text -->
172
- <span >
173
- <span class =" grey--text" >{{ countTasksInState(scope.node.node, state) }} {{ state }}. Recent {{ state }} tasks:</span >
174
- <br />
175
- <span v-for =" (task, index) in tasks.slice(0, maximumTasksDisplayed)" :key =" index" >
176
- {{ task }}<br v-if =" index !== tasks.length -1" />
177
- </span >
178
- </span >
179
- </v-tooltip >
180
- </span >
148
+ <WorkflowStateSummary
149
+ :node =" scope.node"
150
+ />
181
151
</v-flex >
182
152
</v-layout >
183
153
</v-list-item-title >
@@ -203,19 +173,19 @@ import subscriptionComponentMixin from '@/mixins/subscriptionComponent'
203
173
import TaskState from ' @/model/TaskState.model'
204
174
import SubscriptionQuery from ' @/model/SubscriptionQuery.model'
205
175
import { WorkflowState } from ' @/model/WorkflowState.model'
206
- import Job from ' @/components/cylc/Job'
207
176
import Tree from ' @/components/cylc/tree/Tree'
208
177
import WorkflowIcon from ' @/components/cylc/gscan/WorkflowIcon'
178
+ import WorkflowStateSummary from ' @/components/cylc/gscan/WorkflowStateSummary'
209
179
// import { addNodeToTree, createWorkflowNode } from '@/components/cylc/gscan/nodes'
210
180
import { filterHierarchically } from ' @/components/cylc/gscan/filters'
211
181
import { GSCAN_DELTAS_SUBSCRIPTION } from ' @/graphql/queries'
212
182
213
183
export default {
214
184
name: ' GScan' ,
215
185
components: {
216
- Job,
217
186
Tree,
218
- WorkflowIcon
187
+ WorkflowIcon,
188
+ WorkflowStateSummary
219
189
},
220
190
mixins: [
221
191
subscriptionComponentMixin
@@ -415,42 +385,6 @@ export default {
415
385
return ` /workflows/${ node .node .name } `
416
386
}
417
387
return ' '
418
- },
419
-
420
- /**
421
- * Get number of tasks we have in a given state. The states are retrieved
422
- * from `latestStateTasks`, and the number of tasks in each state is from
423
- * the `stateTotals`. (`latestStateTasks` includes old tasks).
424
- *
425
- * @param {WorkflowGraphQLData} workflow - the workflow object retrieved from GraphQL
426
- * @param {string} state - a workflow state
427
- * @returns {number|*} - the number of tasks in the given state
428
- */
429
- countTasksInState (workflow , state ) {
430
- if (Object .hasOwnProperty .call (workflow .stateTotals , state)) {
431
- return workflow .stateTotals [state]
432
- }
433
- return 0
434
- },
435
-
436
- getTaskStateClasses (workflow , state ) {
437
- const tasksInState = this .countTasksInState (workflow, state)
438
- return tasksInState === 0 ? [' empty-state' ] : []
439
- },
440
-
441
- // TODO: temporary filter, remove after b0 - https://github.com/cylc/cylc-ui/pull/617#issuecomment-805343847
442
- getLatestStateTasks (latestStateTasks ) {
443
- // Values found in: https://github.com/cylc/cylc-flow/blob/9c542f9f3082d3c3d9839cf4330c41cfb2738ba1/cylc/flow/data_store_mgr.py#L143-L149
444
- const validValues = [
445
- TaskState .SUBMITTED .name ,
446
- TaskState .SUBMIT_FAILED .name ,
447
- TaskState .RUNNING .name ,
448
- TaskState .SUCCEEDED .name ,
449
- TaskState .FAILED .name
450
- ]
451
- return latestStateTasks .filter (entry => {
452
- return validValues .includes (entry[0 ])
453
- })
454
388
}
455
389
}
456
390
}
0 commit comments