-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2016 from cylc/flow-nums
Show flow numbers
- Loading branch information
Showing
26 changed files
with
476 additions
and
134 deletions.
There are no files selected for viewing
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 @@ | ||
Show [flow numbers](https://cylc.github.io/cylc-doc/stable/html/glossary.html#term-flow) when applicable. Removed tasks (flow=None) are now dimmed. |
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,79 @@ | ||
/* | ||
* Copyright (C) NIWA & British Crown (Met Office) & Contributors. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import TreeItem from '@/components/cylc/tree/TreeItem.vue' | ||
import { | ||
simpleCyclepointNode, | ||
} from '$tests/unit/components/cylc/tree/tree.data' | ||
|
||
// Get lists of: a) all tree item nodes; b) only visible ones. | ||
Cypress.Commands.add('getNodeTypes', () => { | ||
cy.get('.c-treeitem') | ||
.then(($els) => { | ||
const all = Array.from($els, ({ dataset }) => dataset.nodeType) | ||
const visible = all.filter((val, i) => $els[i].checkVisibility()) | ||
return { all, visible } | ||
}) | ||
}) | ||
|
||
// Expand/collapse the first node of this type. | ||
Cypress.Commands.add('toggleNode', (nodeType) => { | ||
cy.get(`[data-node-type=${nodeType}] .node-expand-collapse-button:first`).click() | ||
}) | ||
|
||
describe('TreeItem component', () => { | ||
it('expands/collapses children', () => { | ||
cy.vmount(TreeItem, { | ||
props: { | ||
node: simpleCyclepointNode, | ||
filteredOutNodesCache: new WeakMap(), | ||
}, | ||
}) | ||
cy.addVuetifyStyles(cy) | ||
|
||
cy.getNodeTypes() | ||
.should('deep.equal', { | ||
// Auto expand everything down to task nodes by default | ||
all: ['cycle', 'task'], | ||
visible: ['cycle', 'task'] | ||
}) | ||
|
||
cy.toggleNode('task') | ||
cy.getNodeTypes() | ||
.should('deep.equal', { | ||
all: ['cycle', 'task', 'job'], | ||
visible: ['cycle', 'task', 'job'] | ||
}) | ||
|
||
cy.toggleNode('cycle') | ||
cy.getNodeTypes() | ||
.should('deep.equal', { | ||
// All previously expanded nodes under cycle should be hidden but remain rendered | ||
all: ['cycle', 'task', 'job'], | ||
visible: ['cycle'] | ||
}) | ||
|
||
cy.toggleNode('cycle') | ||
cy.toggleNode('job') | ||
cy.getNodeTypes() | ||
.should('deep.equal', { | ||
// Job node does not use a child TreeItem | ||
all: ['cycle', 'task', 'job'], | ||
visible: ['cycle', 'task', 'job'] | ||
}) | ||
}) | ||
}) |
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
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,56 @@ | ||
<!-- | ||
Copyright (C) NIWA & British Crown (Met Office) & Contributors. | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<template> | ||
<v-chip | ||
v-if="showFlowNums" | ||
label | ||
density="compact" | ||
size="small" | ||
class="ml-1 cursor-default" | ||
:prepend-icon="mdiLabelOutline" | ||
data-cy="flow-num-chip" | ||
> | ||
{{ flowNumsStr }} | ||
<v-tooltip location="right"> | ||
Flows: {{ flowNumsStr }} | ||
</v-tooltip> | ||
</v-chip> | ||
</template> | ||
|
||
<script setup> | ||
import { formatFlowNums } from '@/utils/tasks' | ||
import { mdiLabelOutline } from '@mdi/js' | ||
import { computed } from 'vue' | ||
|
||
const props = defineProps({ | ||
flowNums: { | ||
type: String, | ||
required: false, | ||
}, | ||
}) | ||
|
||
const flowNumsStr = computed( | ||
() => props.flowNums && formatFlowNums(props.flowNums) | ||
) | ||
|
||
/** Hide flow=1 and flow=None by default */ | ||
const showFlowNums = computed( | ||
() => flowNumsStr.value && !['1', 'None'].includes(flowNumsStr.value) | ||
) | ||
|
||
</script> |
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
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
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 |
---|---|---|
|
@@ -82,6 +82,7 @@ | |
meanElapsedTime | ||
name | ||
} | ||
flowNums | ||
} | ||
fragment JobData on Job { | ||
|
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
Oops, something went wrong.