Skip to content

Commit ff8a7b2

Browse files
committed
feat(CloneOrMoveAppModal): add eventId for task registration and completion tracking
1 parent 6d3d452 commit ff8a7b2

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

core/ui/src/components/software-center/CloneOrMoveAppModal.vue

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -414,21 +414,27 @@ export default {
414414
async listNodes() {
415415
this.error.nodesList = "";
416416
const taskAction = "list-nodes";
417+
const eventId = this.getUuid();
417418
418419
// register to task error
419-
this.$root.$off(taskAction + "-aborted");
420-
this.$root.$once(taskAction + "-aborted", this.listNodesAborted);
420+
this.$root.$once(
421+
`${taskAction}-aborted-${eventId}`,
422+
this.listNodesAborted
423+
);
421424
422425
// register to task completion
423-
this.$root.$off(taskAction + "-completed");
424-
this.$root.$once(taskAction + "-completed", this.listNodesCompleted);
426+
this.$root.$once(
427+
`${taskAction}-completed-${eventId}`,
428+
this.listNodesCompleted
429+
);
425430
426431
const res = await to(
427432
this.createClusterTask({
428433
action: taskAction,
429434
extra: {
430435
title: this.$t("action." + taskAction),
431436
isNotificationHidden: true,
437+
eventId,
432438
},
433439
})
434440
);
@@ -453,15 +459,17 @@ export default {
453459
this.loading.getClusterStatus = true;
454460
this.error.getClusterStatus = "";
455461
const taskAction = "get-cluster-status";
462+
const eventId = this.getUuid();
456463
457464
// register to task error
458-
this.$root.$off(taskAction + "-aborted");
459-
this.$root.$once(taskAction + "-aborted", this.getClusterStatusAborted);
465+
this.$root.$once(
466+
`${taskAction}-aborted-${eventId}`,
467+
this.getClusterStatusAborted
468+
);
460469
461470
// register to task completion
462-
this.$root.$off(taskAction + "-completed");
463471
this.$root.$once(
464-
taskAction + "-completed",
472+
`${taskAction}-completed-${eventId}`,
465473
this.getClusterStatusCompleted
466474
);
467475
@@ -471,6 +479,7 @@ export default {
471479
extra: {
472480
title: this.$t("action." + taskAction),
473481
isNotificationHidden: true,
482+
eventId,
474483
},
475484
})
476485
);
@@ -495,23 +504,27 @@ export default {
495504
this.error.listMountPoints = "";
496505
this.loading.listMountPoints = true;
497506
const taskAction = "list-mountpoints";
507+
const eventId = this.getUuid();
498508
499509
// register to task error
500-
this.$root.$off(taskAction + "-aborted");
501-
this.$root.$once(taskAction + "-aborted", this.listMountPointsAborted);
510+
this.$root.$once(
511+
`${taskAction}-aborted-${eventId}`,
512+
this.listMountPointsAborted
513+
);
502514
503515
// register to task completion
504-
this.$root.$off(taskAction + "-completed");
505516
this.$root.$once(
506-
taskAction + "-completed",
517+
`${taskAction}-completed-${eventId}`,
507518
this.listMountPointsCompleted
508519
);
520+
509521
const res = await to(
510522
this.createNodeTask(this.selectedNode.id, {
511523
action: taskAction,
512524
extra: {
513525
title: this.$t("action." + taskAction),
514526
isNotificationHidden: true,
527+
eventId,
515528
},
516529
})
517530
);
@@ -530,14 +543,15 @@ export default {
530543
this.loading.listMountPoints = false;
531544
},
532545
listMountPointsCompleted(taskContext, taskResult) {
533-
this.additionalVolumes = taskResult.output.mountpoints;
546+
const additionalVolumes = taskResult.output.mountpoints;
534547
// Add default disk at the end, push default property
535548
if (taskResult.output.default_disk) {
536-
this.additionalVolumes.push({
549+
additionalVolumes.push({
537550
...taskResult.output.default_disk,
538551
default: true, // mark as default disk
539552
});
540553
}
554+
this.additionalVolumes = additionalVolumes;
541555
this.loading.listMountPoints = false;
542556
},
543557
async cloneOrMove(volumes) {

0 commit comments

Comments
 (0)