@@ -77,7 +77,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
77
77
<v-btn
78
78
icon
79
79
variant =" text"
80
- :disabled =" isEditable(authorised, mutation )"
80
+ :disabled =" ! isEditable(mutation, authorised )"
81
81
@click.stop =" openDialog(mutation)"
82
82
data-cy =" mutation-edit"
83
83
class =" ml-2"
@@ -167,7 +167,6 @@ export default {
167
167
dialogKey: false ,
168
168
expanded: false ,
169
169
node: null ,
170
- workflowStatus: null ,
171
170
mutations: [],
172
171
isLoadingMutations: true ,
173
172
showMenu: false ,
@@ -246,45 +245,23 @@ export default {
246
245
},
247
246
248
247
methods: {
249
- isEditable (authorised , mutation ) {
250
- if (mutation .name === ' log' || this .isDisabled (mutation, authorised)) {
251
- return true
252
- } else {
253
- return false
254
- }
248
+ isEditable (mutation , authorised ) {
249
+ return mutation .name !== ' log' && ! this .isDisabled (mutation, authorised)
255
250
},
256
251
isDisabled (mutation , authorised ) {
257
- if (this .node .type !== ' workflow' ) {
258
- const nodeReturned = this .getNodes (
259
- ' workflow' , [this .node .tokens .workflowID ])
260
- if (nodeReturned .length ) {
261
- this .workflowStatus = nodeReturned[0 ].node .status
262
- } else { this .workflowStatus = WorkflowState .RUNNING .name }
263
- } else {
264
- this .workflowStatus = this .node .node .status
265
- }
266
- if (
267
- (! mutation ._validStates .includes (this .workflowStatus )) ||
268
- ! authorised) {
252
+ if (! authorised) {
269
253
return true
270
254
}
271
- return false
255
+ let status = this .node .node ? .status
256
+ if (this .node .type !== ' workflow' ) {
257
+ const nodeReturned = this .getNodes (' workflow' , [this .node .tokens .workflowID ])
258
+ status = nodeReturned .length
259
+ ? nodeReturned[0 ].node .status
260
+ : WorkflowState .RUNNING .name
261
+ }
262
+ return ! mutation ._validStates .includes (status)
272
263
},
273
264
openDialog (mutation ) {
274
- if (mutation .name === ' log' ) {
275
- this .$eventBus .emit (
276
- ' add-view' ,
277
- {
278
- name: ' Log' ,
279
- initialOptions: {
280
- relativeID: this .node .tokens .relativeID || null
281
- }
282
- }
283
- )
284
- this .showMenu = false
285
- return
286
- }
287
-
288
265
this .dialog = true
289
266
this .dialogMutation = mutation
290
267
// Tell Vue to re-render the dialog component:
@@ -344,14 +321,36 @@ export default {
344
321
345
322
/* Call a mutation using only the tokens for args. */
346
323
callMutationFromContext (mutation ) {
324
+ this .showMenu = false
347
325
// eslint-disable-next-line no-console
348
326
console .debug (` mutation: ${ mutation ._title } ${ this .node .id } ` )
349
- mutate (
350
- mutation,
351
- getMutationArgsFromTokens (mutation, this .node .tokens ),
352
- this .$workflowService .apolloClient
353
- )
354
- this .showMenu = false
327
+
328
+ if (mutation .name === ' log' ) {
329
+ // Navigate to the corresponding workflow then open the log view
330
+ // (no nav occurs if already on the correct workflow page)
331
+ this .$router .push ({
332
+ name: ' workspace' ,
333
+ params: {
334
+ workflowName: this .node .tokens .workflow
335
+ }
336
+ }).then (() => {
337
+ this .$eventBus .emit (
338
+ ' add-view' ,
339
+ {
340
+ name: ' Log' ,
341
+ initialOptions: {
342
+ relativeID: this .node .tokens .relativeID || null
343
+ }
344
+ }
345
+ )
346
+ })
347
+ } else {
348
+ mutate (
349
+ mutation,
350
+ getMutationArgsFromTokens (mutation, this .node .tokens ),
351
+ this .$workflowService .apolloClient
352
+ )
353
+ }
355
354
},
356
355
357
356
showMutationsMenu ({ node, event }) {
0 commit comments