Skip to content

Commit 805dab2

Browse files
committed
Test fix and more robust logic
1 parent 0d84c55 commit 805dab2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/cylc/cylcObject/Menu.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ import {
137137
mdiPencil
138138
} from '@mdi/js'
139139
import { mapGetters, mapState } from 'vuex'
140+
import WorkflowState from '@/model/WorkflowState.model'
140141
141142
export default {
142143
name: 'CylcObjectMenu',
@@ -246,8 +247,11 @@ export default {
246247
},
247248
isDisabled (mutation, authorised) {
248249
if (this.node.type !== 'workflow') {
249-
this.workflowStatus = this.getNodes(
250-
'workflow', [this.node.tokens.workflow_id])[0].node.status
250+
const nodeReturned = this.getNodes(
251+
'workflow', [this.node.tokens.workflow_id])
252+
if (nodeReturned.length) {
253+
this.workflowStatus = nodeReturned[0].node.status
254+
} else { this.workflowStatus = WorkflowState.RUNNING.name }
251255
} else {
252256
this.workflowStatus = this.node.node.status
253257
}

tests/e2e/specs/menu.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
describe('CylcObject Menu component', () => {
19-
const collapsedWorkflowMenuLength = 6 // (5 mutations + "show more" btn)
19+
const collapsedWorkflowMenuLength = 7 // (6 mutations + "show more" btn)
2020
const expandedWorkflowMenuLength = 21
2121

2222
it('should not be displayed initially on load', () => {

0 commit comments

Comments
 (0)