diff --git a/changes.d/2016.feat.md b/changes.d/2016.feat.md new file mode 100644 index 000000000..ff2e9fe4e --- /dev/null +++ b/changes.d/2016.feat.md @@ -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. diff --git a/cypress/component/treeItem.cy.js b/cypress/component/treeItem.cy.js new file mode 100644 index 000000000..fc052f1c5 --- /dev/null +++ b/cypress/component/treeItem.cy.js @@ -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 . + */ + +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'] + }) + }) +}) diff --git a/src/components/cylc/commandMenu/Menu.vue b/src/components/cylc/commandMenu/Menu.vue index a3e532ce9..8f8a9a849 100644 --- a/src/components/cylc/commandMenu/Menu.vue +++ b/src/components/cylc/commandMenu/Menu.vue @@ -126,6 +126,8 @@ import { mapGetters, mapState } from 'vuex' import WorkflowState from '@/model/WorkflowState.model' import { eventBus } from '@/services/eventBus' import CopyBtn from '@/components/core/CopyBtn.vue' +import { upperFirst } from 'lodash-es' +import { formatFlowNums } from '@/utils/tasks' export default { name: 'CommandMenu', @@ -199,14 +201,14 @@ export default { // can happen briefly when switching workflows return } - let ret = this.node.type + let ret = upperFirst(this.node.type) if (this.node.type !== 'cycle') { // NOTE: cycle point nodes don't have associated node data at present - ret += ' - ' + ret += ' • ' if (this.node.type === 'workflow') { - ret += this.node.node.statusMsg || this.node.node.status || 'state unknown' + ret += upperFirst(this.node.node.statusMsg || this.node.node.status || 'state unknown') } else { - ret += this.node.node.state || 'state unknown' + ret += upperFirst(this.node.node.state || 'state unknown') if (this.node.node.isHeld) { ret += ' (held)' } @@ -216,6 +218,9 @@ export default { if (this.node.node.isRunahead) { ret += ' (runahead)' } + if (this.node.node.flowNums) { + ret += ` • Flows: ${formatFlowNums(this.node.node.flowNums)}` + } } } return ret diff --git a/src/components/cylc/common/FlowNumsChip.vue b/src/components/cylc/common/FlowNumsChip.vue new file mode 100644 index 000000000..38fb09b9b --- /dev/null +++ b/src/components/cylc/common/FlowNumsChip.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/components/cylc/table/Table.vue b/src/components/cylc/table/Table.vue index c6390c10b..fd2c6413b 100644 --- a/src/components/cylc/table/Table.vue +++ b/src/components/cylc/table/Table.vue @@ -28,7 +28,11 @@ along with this program. If not, see . v-model:items-per-page="itemsPerPage" > - + +