Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/cylc/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template #item.task.name="{ item }">
<div
class="d-flex align-center flex-nowrap"
:class="{ 'flow-none': isFlowNone(item.task.node.flowNums) }"
:class="{ 'dimmed': item.task.node.graphDepth }"
:data-cy-task-name="item.task.name"
>
<div v-bind="jobIconParentProps">
Expand Down Expand Up @@ -147,7 +147,6 @@ import {
import {
getRunTime,
formatDuration,
isFlowNone,
isTruthyOrZero,
} from '@/utils/tasks'
import { useCyclePointsOrderDesc } from '@/composables/localStorage'
Expand Down
10 changes: 6 additions & 4 deletions src/components/cylc/tree/TreeItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<div
v-else-if="node.type === 'task'"
class="d-flex align-center"
:class="{ 'flow-none': isFlowNone(node.node.flowNums) }"
>
<!-- Task summary -->
<Task
Expand Down Expand Up @@ -179,7 +178,6 @@ import JobLeaf from '@/components/cylc/tree/JobLeaf.vue'
import {
jobMessageOutputs,
latestJob,
isFlowNone,
} from '@/utils/tasks'
import { getIndent, getNodeChildren } from '@/components/cylc/tree/util'
import { once } from '@/utils/reactivity'
Expand Down Expand Up @@ -251,7 +249,6 @@ export default {

return {
isExpanded,
isFlowNone,
latestJob,
renderChildren,
toggleExpandCollapse,
Expand Down Expand Up @@ -285,7 +282,12 @@ export default {
}
},
nodeDataClass () {
return ['node-data', `node-data-${this.node.type}`]
return {
'node-data': true,
[`node-data-${this.node.type}`]: true,
// dim nodes (tasks & families) that are outside the n=0 window
dimmed: this.node.node?.graphDepth,
}
},
expandCollapseBtnStyle () {
return {
Expand Down
11 changes: 11 additions & 0 deletions src/services/mock/json/workflows/one.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@
"id": "~user/one//20000102T0000Z/root",
"name": "root",
"state": "failed",
"graphDepth": 0,
"cyclePoint": "20000102T0000Z"
},
{
"__typename": "FamilyProxy",
"id": "~user/one//20000102T0000Z/BAD",
"name": "BAD",
"state": "failed",
"graphDepth": 0,
"cyclePoint": "20000102T0000Z",
"firstParent": {
"id": "~user/one//20000102T0000Z/root",
Expand All @@ -84,6 +86,7 @@
"id": "~user/one//20000102T0000Z/GOOD",
"name": "GOOD",
"state": "succeeded",
"graphDepth": 0,
"cyclePoint": "20000102T0000Z",
"firstParent": {
"id": "~user/one//20000102T0000Z/root",
Expand All @@ -101,6 +104,7 @@
"id": "~user/one//20000102T0000Z/SUCCEEDED",
"name": "SUCCEEDED",
"state": "succeeded",
"graphDepth": 0,
"cyclePoint": "20000102T0000Z",
"firstParent": {
"id": "~user/one//20000102T0000Z/GOOD",
Expand All @@ -123,6 +127,7 @@
"id": "~user/one//20000102T0000Z/checkpoint",
"name": "checkpoint",
"state": "running",
"graphDepth": 0,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand All @@ -147,6 +152,7 @@
"id": "~user/one//20000102T0000Z/eventually_succeeded",
"name": "eventually_succeeded",
"state": "succeeded",
"graphDepth": 0,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand All @@ -171,6 +177,7 @@
"id": "~user/one//20000102T0000Z/failed",
"name": "failed",
"state": "failed",
"graphDepth": 0,
"isHeld": true,
"isQueued": false,
"isRunahead": false,
Expand All @@ -194,6 +201,7 @@
"id": "~user/one//20000102T0000Z/retrying",
"name": "retrying",
"state": "waiting",
"graphDepth": 0,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand All @@ -217,6 +225,7 @@
"id": "~user/one//20000102T0000Z/sleepy",
"name": "sleepy",
"state": "submitted",
"graphDepth": 1,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand All @@ -240,6 +249,7 @@
"id": "~user/one//20000102T0000Z/succeeded",
"name": "succeeded",
"state": "succeeded",
"graphDepth": 0,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand Down Expand Up @@ -267,6 +277,7 @@
"id": "~user/one//20000102T0000Z/waiting",
"name": "waiting",
"state": "waiting",
"graphDepth": 0,
"isHeld": false,
"isQueued": false,
"isRunahead": false,
Expand Down
5 changes: 3 additions & 2 deletions src/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ html {
}

.c-tree, .c-table, .c-graph {
.flow-none {
opacity: 0.6;
// Dim nodes that are outside the n=0 (active) window, i.e. n != 0.
.dimmed {
opacity: 0.5;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dimming didn't seem to be that visible on my display. So I've cranked it up a notch

}
}
10 changes: 0 additions & 10 deletions src/utils/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ export function formatFlowNums (flowNums) {
return JSON.parse(flowNums).join(', ') || 'None'
}

/**
* Return whether a task is in the None flow.
*
* @param {string=} flowNums
* @returns {boolean}
*/
export function isFlowNone (flowNums) {
return Boolean(flowNums && !JSON.parse(flowNums).length)
}

export function isTruthyOrZero (value) {
return value === 0 || Boolean(value)
}
5 changes: 2 additions & 3 deletions src/views/Graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
:task="node"
:jobs="node.children"
:jobTheme="jobTheme"
:class="{ 'flow-none': isFlowNone(node.node.flowNums) }"
:class="{ 'dimmed': node.node.graphDepth }"
/>
</g>
<!-- the edges
Expand Down Expand Up @@ -129,7 +129,6 @@ import {
mdiFileRotateRight,
mdiVectorSelection
} from '@mdi/js'
import { isFlowNone } from '@/utils/tasks'

// NOTE: Use TaskProxies not nodesEdges{nodes} to list nodes as this is what
// the tree view uses which allows the requests to overlap with this and other
Expand Down Expand Up @@ -175,6 +174,7 @@ fragment TaskProxyData on TaskProxy {
meanElapsedTime
}
flowNums

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is flowNums used by this view any more?

Run through the modified queries and check usage. Note the field might be used by a component used by the view rather than in the view code itself.

If happy the field is not being used, remove it from the query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look up at the co pilot suggestion

graphDepth
runtime {
runMode
}
Expand Down Expand Up @@ -275,7 +275,6 @@ export default {
autoRefresh,
spacing,
groupCycle,
isFlowNone,
}
},

Expand Down
20 changes: 8 additions & 12 deletions src/views/Guide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<GraphNode
v-bind="task"
:transform="`translate(0, ${ 240 * index })`"
:class="{ 'flow-none': isFlowNone(task.task.node.flowNums) }"
:class="{ 'dimmed': task.task.node.graphDepth }"
v-on:click.stop.capture
/>
<text
Expand Down Expand Up @@ -410,8 +410,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</p>

<p>
Note that the "future" tasks (the ones ahead of the workflow) are
grey. This indicates that are are not yet being managed by Cylc.
Note that the tasks outside of the active window (i.e. the ones
that are not n=0) are greyed out. This highlights the tasks that
Cylc is currently managing.
</p>
</v-card-text>
</v-card>
Expand All @@ -429,7 +430,6 @@ import { workflowViews } from '@/views/views'
import { TaskStateUserOrder } from '@/model/TaskState.model'
import { Tokens } from '@/utils/uid'
import { uniqueId } from 'lodash-es'
import { isFlowNone } from '@/utils/tasks'

export default {
name: 'Guide',
Expand All @@ -453,7 +453,7 @@ export default {
task: {
name: 'a',
tokens: new Tokens('2000/a', true),
node: { state: 'succeeded' },
node: { state: 'succeeded', graphDepth: 1 },
},
jobs: [{
name: '01',
Expand All @@ -465,7 +465,7 @@ export default {
task: {
name: 'b',
tokens: new Tokens('2000/b', true),
node: { state: 'running' },
node: { state: 'running', graphDepth: 0 },
},
jobs: [{
name: '01',
Expand All @@ -477,24 +477,20 @@ export default {
task: {
name: 'c',
tokens: new Tokens('2000/c', true),
node: { state: 'waiting', flowNums: '[]' },
node: { state: 'waiting', graphDepth: 1 },
},
jobs: [],
},
{
task: {
name: 'd',
tokens: new Tokens('2000/d', true),
node: { state: 'waiting', flowNums: '[]' },
node: { state: 'waiting', graphDepth: 2 },
},
jobs: [],
},
]
}),

methods: {
isFlowNone,
},
}
</script>

Expand Down
1 change: 1 addition & 0 deletions src/views/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ fragment TaskProxyData on TaskProxy {
runMode
}
flowNums
graphDepth
}

fragment JobData on Job {
Expand Down
2 changes: 2 additions & 0 deletions src/views/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ fragment FamilyProxyData on FamilyProxy {
isRetry
isWallclock
isXtriggered
graphDepth
}

fragment TaskProxyData on TaskProxy {
Expand All @@ -150,6 +151,7 @@ fragment TaskProxyData on TaskProxy {
runMode
}
flowNums
graphDepth
}

fragment JobData on Job {
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/specs/graph.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,15 @@ describe('Graph View', () => {
})

describe('Flow nums', () => {
it('Shows flow=None task dimmed', () => {
it('Shows n!=0 task dimmed', () => {
cy.visit('/#/graph/one')
waitForGraphLayout()
cy.get('.c-graph-node.flow-none').as('flowNone')
cy.get('.c-graph-node.dimmed').as('dimmed')
.should('have.css', 'opacity')
.then((opacity) => {
expect(parseFloat(opacity)).to.be.closeTo(0.6, 0.2)
})
cy.get('@flowNone')
cy.get('@dimmed')
.contains('sleepy')
})
})
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/specs/table.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,15 @@ describe('State saving', () => {
})

describe('Flow nums', () => {
it('Only shows flow nums when not 1, and flow=None is dimmed', () => {
it('Only shows flow nums when not 1, and n!=0 tasks are dimmed', () => {
cy.visit('/#/table/one')
cy.get('[data-cy-task-name=failed]')
.find('[data-cy=flow-num-chip]')
.contains('1, 2')
cy.get('[data-cy-task-name=checkpoint]')
.find('[data-cy=flow-num-chip]')
.should('not.exist')
cy.get('[data-cy-task-name=sleepy].flow-none')
cy.get('[data-cy-task-name=sleepy].dimmed')
.should('have.css', 'opacity')
.then((opacity) => {
expect(parseFloat(opacity)).to.be.closeTo(0.6, 0.2)
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/specs/tree.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,29 +419,29 @@ describe('Tree view', () => {
})

describe('Flow nums', () => {
it('Only shows flow nums when not 1, and flow=None is dimmed', () => {
it('Only shows flow nums when not 1, and n!=0 tasks are dimmed', () => {
cy.visit('/#/tree/one')
cy.get('[data-node-name=failed]')
.find('[data-cy=flow-num-chip]')
.contains('1, 2')
cy.get('[data-node-name=checkpoint]')
.find('[data-cy=flow-num-chip]')
.should('not.exist')
cy.get('[data-node-name=sleepy] .flow-none')
cy.get('[data-node-name=sleepy] .dimmed')
.should('have.css', 'opacity')
.then((opacity) => {
expect(parseFloat(opacity)).to.be.closeTo(0.6, 0.2)
})
cy.get('[data-node-name=sleepy] .node-expand-collapse-button').click()
// node expand/collapse button should not be dimmed
.parents('.flow-none')
.parents('.dimmed')
.should('not.exist')
// task icon should be dimmed
.get('[data-node-name=sleepy] .c-task')
.parents('.flow-none')
.parents('.dimmed')
// children should not be dimmed
.get('[data-node-name=sleepy] .c-treeitem')
.parents('.flow-none')
.parents('.dimmed')
.should('not.exist')
})
})
Expand Down
12 changes: 0 additions & 12 deletions tests/unit/utils/tasks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
formatDuration,
jobMessageOutputs,
formatFlowNums,
isFlowNone,
getRunTime,
isTruthyOrZero,
} from '@/utils/tasks'
Expand Down Expand Up @@ -177,17 +176,6 @@ describe('tasks', () => {
})
})

describe('isFlowNone', () => {
it.each([
[undefined, false],
['[]', true],
['[ ]', true],
['[1]', false],
])('isFlowNone(%o) -> %o', (input, expected) => {
expect(isFlowNone(input)).toEqual(expected)
})
})

describe('isTruthyOrZero', () => {
it.each([
[undefined, false],
Expand Down