Skip to content

Commit d38f83e

Browse files
authored
Merge pull request #2261 from wxtim/feat.skip-mode-task-modifiers
Skip mode modifier
2 parents 71414f4 + 376eeab commit d38f83e

File tree

9 files changed

+114
-40
lines changed

9 files changed

+114
-40
lines changed

changes.d/2261.feat.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a skip mode modifier for the task icon

src/components/cylc/SVGTask.vue

Lines changed: 51 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
161161
"
162162
/>
163163
</g>
164+
165+
<!-- runahead
166+
167+
Dot icon representing isRunahead.
168+
-->
169+
<g
170+
class="runahead"
171+
>
172+
<circle
173+
cx="50"
174+
cy="50"
175+
r="20"
176+
/>
177+
</g>
178+
179+
<!-- Run Mode is Skip
180+
181+
Fast-forward icon representing skip-mode
182+
-->
183+
<g
184+
class="skip"
185+
>
186+
<path class="skip"
187+
d="M 5 15 v 70 l 43 -35 M 50 15 v 70 l 43 -35"
188+
/>
189+
</g>
190+
164191
<!-- queued
165192
166193
Burger bar-like icon representing isQueued.
@@ -179,19 +206,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
179206
"
180207
/>
181208
</g>
182-
<!-- runahead
183-
184-
Dot icon representing isRunahead.
185-
-->
186-
<g
187-
class="runahead"
188-
>
189-
<circle
190-
cx="50"
191-
cy="50"
192-
r="20"
193-
/>
194-
</g>
195209

196210
<!-- xtriggered
197211
@@ -278,8 +292,9 @@ const animResetTime = inject('animResetTime', () => ref(0), true)
278292
// Get modifier (if any) for the task state.
279293
const modifier = computed(() => {
280294
if (props.task.isHeld) return 'held'
281-
if (props.task.isQueued) return 'queued'
282295
if (props.task.isRunahead) return 'runahead'
296+
if (props.task.runtime?.runMode === 'Skip') return 'skip'
297+
if (props.task.isQueued) return 'queued'
283298
if (props.task.isRetry) return 'retry'
284299
if (props.task.isWallclock) return 'wallclock'
285300
if (props.task.isXtriggered) return 'xtriggered'
@@ -384,11 +399,15 @@ const modifierTransform = _getModifierTransform()
384399
fill: none;
385400
stroke: none;
386401
}
387-
.queued rect {
402+
.runahead circle {
388403
fill: none;
389404
stroke: none;
390405
}
391-
.runahead circle {
406+
.skip{
407+
fill: none;
408+
stroke: none;
409+
}
410+
.queued rect {
392411
fill: none;
393412
stroke: none;
394413
}
@@ -472,14 +491,6 @@ const modifierTransform = _getModifierTransform()
472491
}
473492
}
474493
475-
&.queued .modifier {
476-
.queued path {
477-
stroke: $foreground;
478-
stroke-linecap: round;
479-
stroke-width: 16px;
480-
}
481-
}
482-
483494
&.runahead .modifier {
484495
.outline {
485496
stroke: $foreground;
@@ -489,6 +500,22 @@ const modifierTransform = _getModifierTransform()
489500
}
490501
}
491502
503+
&.skip .modifier {
504+
.skip path {
505+
stroke: $background;
506+
fill: $foreground;
507+
stroke-width: 0px;
508+
}
509+
}
510+
511+
&.queued .modifier {
512+
.queued path {
513+
stroke: $foreground;
514+
stroke-linecap: round;
515+
stroke-width: 16px;
516+
}
517+
}
518+
492519
&.xtriggered .modifier {
493520
.xtriggered {
494521
stroke: $foreground;

src/components/cylc/commandMenu/Menu.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ export default {
232232
} else {
233233
ret += upperFirst(this.node.node.state || 'state unknown')
234234
if (this.node.node.isHeld) ret += ' (held)'
235-
if (this.node.node.isQueued) ret += ' (queued)'
236235
if (this.node.node.isRunahead) ret += ' (beyond runahead limit)'
236+
if (this.node.node.runtime?.runMode === 'Skip') ret += ' (skip mode)'
237+
if (this.node.node.isQueued) ret += ' (queued)'
237238
if (this.node.node.isRetry) ret += ' (awaiting retry)'
238239
else if (this.node.node.isWallclock) ret += ' (awaiting wallclock)'
239240
else if (this.node.node.isXtriggered) ret += ' (awaiting xtrigger)'

src/views/Graph.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ fragment TaskProxyData on TaskProxy {
175175
meanElapsedTime
176176
}
177177
flowNums
178+
runtime {
179+
runMode
180+
}
178181
}
179182
180183
fragment JobData on Job {

src/views/Guide.vue

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
138138
<template v-slot:prepend>
139139
<task
140140
style="font-size: 2em;"
141-
:task="{state: 'waiting', isQueued: true}"
141+
:task="{state: 'waiting', isRunahead: true}"
142142
class="mr-4"
143143
/>
144144
</template>
145145
<v-list-item-title>
146-
Queued
146+
Runahead
147147
</v-list-item-title>
148148
<v-list-item-subtitle>
149-
The task is ready to run but is held back by a queue,
150-
which restricts the number of active tasks.
149+
The task is ready to run but is beyond the runahead limit,
150+
which restricts the number of active cycle points.
151151
</v-list-item-subtitle>
152152
</v-list-item>
153153
<v-list-item>
154154
<template v-slot:prepend>
155155
<task
156156
style="font-size: 2em;"
157-
:task="{state: 'waiting', isRunahead: true}"
157+
:task="{state: 'waiting', runtime: { runMode: 'Skip' }}"
158158
class="mr-4"
159159
/>
160160
</template>
161161
<v-list-item-title>
162-
Runahead
162+
Skip Mode
163163
</v-list-item-title>
164164
<v-list-item-subtitle>
165-
The task is ready to run but is beyond the runahead limit,
166-
which restricts the number of active cycle points.
165+
This task will be run in skip mode.
166+
</v-list-item-subtitle>
167+
</v-list-item>
168+
<v-list-item>
169+
<template v-slot:prepend>
170+
<task
171+
style="font-size: 2em;"
172+
:task="{state: 'waiting', isQueued: true}"
173+
class="mr-4"
174+
/>
175+
</template>
176+
<v-list-item-title>
177+
Queued
178+
</v-list-item-title>
179+
<v-list-item-subtitle>
180+
The task is ready to run but is held back by a queue,
181+
which restricts the number of active tasks.
167182
</v-list-item-subtitle>
168183
</v-list-item>
169184
<v-list-item>

src/views/Table.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ fragment TaskProxyData on TaskProxy {
136136
firstParent {
137137
id
138138
}
139+
runtime {
140+
runMode
141+
}
139142
flowNums
140143
}
141144

src/views/Tree.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ fragment TaskProxyData on TaskProxy {
196196
firstParent {
197197
id
198198
}
199+
runtime {
200+
runMode
201+
}
199202
flowNums
200203
}
201204

tests/component/specs/cylc-icons.cy.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,19 @@ const TaskComponent = defineComponent({
5656
function makeTask (
5757
state = 'waiting',
5858
isHeld = false,
59-
isQueued = false,
6059
isRunahead = false,
60+
runtime = { runMode: 'Live' },
61+
isQueued = false,
6162
isRetry = false,
6263
isWallclock = false,
6364
isXtriggered = false,
6465
) {
6566
return {
6667
state,
6768
isHeld,
68-
isQueued,
6969
isRunahead,
70+
runtime,
71+
isQueued,
7072
isRetry,
7173
isWallclock,
7274
isXtriggered,
@@ -125,17 +127,25 @@ describe('Task component', () => {
125127
let task
126128
for (const modifier of [
127129
'isHeld',
128-
'isQueued',
129130
'isRunahead',
131+
'skip',
132+
'isQueued',
130133
'isXtriggered',
131134
'isRetry',
132135
'isWallclock'
133136
]) {
134137
task = makeTask()
135-
task[modifier] = true
138+
let filename
139+
if (modifier === 'skip') {
140+
task.runtime.runMode = 'Skip'
141+
filename = 'isSkip'
142+
} else {
143+
task[modifier] = true
144+
filename = modifier
145+
}
136146
cy.mount(TaskComponent, { props: { task } })
137147
cy.get('.c8-task').last().screenshot(
138-
`task-${modifier}`,
148+
`task-${filename}`,
139149
{
140150
overwrite: true,
141151
disableTimersAndAnimations: false,

tests/unit/components/cylc/common/SVGTask.vue.spec.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,27 @@ describe('modifier', () => {
3535
[['isWallclock', 'isXtriggered'], 'wallclock'],
3636
[['isHeld', 'isWallclock', 'isXtriggered'], 'held'],
3737
// Some cases in the middle of the list:
38-
[['isQueued', 'isRunahead', 'isXtriggered'], 'queued'],
38+
[['isQueued', 'isRunahead', 'isXtriggered'], 'runahead'],
3939
[['isRunahead', 'isRetry', 'isWallclock'], 'runahead'],
40+
// Skip is handled before queued and after runahead
41+
[['isRunahead', 'skip'], 'runahead'],
42+
[['isQueued', 'skip'], 'skip'],
4043
])('returns the correct modifier for %o', (switchedOn, expected) => {
4144
const wrapper = mount(SVGTask, {
4245
props: {
4346
task: Object.fromEntries(
44-
switchedOn.map((modifier) => [modifier, true])
47+
// switchedOn.map((modifier) => [modifier, true])
48+
switchedOn.map(mapper)
4549
),
4650
}
4751
})
52+
function mapper (key) {
53+
if (key === 'skip') {
54+
return ['runtime', { runMode: 'Skip' }]
55+
} else {
56+
return [key, true]
57+
}
58+
}
4859
expect(wrapper.vm.modifier).toBe(expected)
4960
expect(wrapper.get('.c8-task').classes()).toContain(expected)
5061
})

0 commit comments

Comments
 (0)