Skip to content

Commit 1627259

Browse files
committed
feat(AddInternalProviderModal, CreateDomainModal): add unique event IDs for task registration to improve error handling
1 parent f758dd0 commit 1627259

File tree

2 files changed

+66
-24
lines changed

2 files changed

+66
-24
lines changed

core/ui/src/components/domains/AddInternalProviderModal.vue

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -668,21 +668,27 @@ export default {
668668
this.loading.getClusterStatus = true;
669669
this.error.getClusterStatus = "";
670670
const taskAction = "get-cluster-status";
671+
const eventId = this.getUuid();
672+
671673
// register to task error
672-
this.$root.$off(taskAction + "-aborted");
673-
this.$root.$once(taskAction + "-aborted", this.getClusterStatusAborted);
674+
this.$root.$once(
675+
`${taskAction}-aborted-${eventId}`,
676+
this.getClusterStatusAborted
677+
);
678+
674679
// register to task completion
675-
this.$root.$off(taskAction + "-completed");
676680
this.$root.$once(
677-
taskAction + "-completed",
681+
`${taskAction}-completed-${eventId}`,
678682
this.getClusterStatusCompleted
679683
);
684+
680685
const res = await to(
681686
this.createClusterTask({
682687
action: taskAction,
683688
extra: {
684689
title: this.$t("action." + taskAction),
685690
isNotificationHidden: true,
691+
eventId,
686692
},
687693
})
688694
);
@@ -707,18 +713,27 @@ export default {
707713
this.error.nodesList = "";
708714
this.loading.nodesList = true;
709715
const taskAction = "list-nodes";
716+
const eventId = this.getUuid();
717+
710718
// register to task error
711-
this.$root.$off(taskAction + "-aborted");
712-
this.$root.$once(taskAction + "-aborted", this.listNodesAborted);
719+
this.$root.$once(
720+
`${taskAction}-aborted-${eventId}`,
721+
this.listNodesAborted
722+
);
723+
713724
// register to task completion
714-
this.$root.$off(taskAction + "-completed");
715-
this.$root.$once(taskAction + "-completed", this.listNodesCompleted);
725+
this.$root.$once(
726+
`${taskAction}-completed-${eventId}`,
727+
this.listNodesCompleted
728+
);
729+
716730
const res = await to(
717731
this.createClusterTask({
718732
action: taskAction,
719733
extra: {
720734
title: this.$t("action." + taskAction),
721735
isNotificationHidden: true,
736+
eventId,
722737
},
723738
})
724739
);
@@ -743,21 +758,27 @@ export default {
743758
this.error.listMountPoints = "";
744759
this.loading.listMountPoints = true;
745760
const taskAction = "list-mountpoints";
761+
const eventId = this.getUuid();
762+
746763
// register to task error
747-
this.$root.$off(taskAction + "-aborted");
748-
this.$root.$once(taskAction + "-aborted", this.listMountPointsAborted);
764+
this.$root.$once(
765+
`${taskAction}-aborted-${eventId}`,
766+
this.listMountPointsAborted
767+
);
768+
749769
// register to task completion
750-
this.$root.$off(taskAction + "-completed");
751770
this.$root.$once(
752-
taskAction + "-completed",
771+
`${taskAction}-completed-${eventId}`,
753772
this.listMountPointsCompleted
754773
);
774+
755775
const res = await to(
756776
this.createNodeTask(this.selectedNode.id, {
757777
action: taskAction,
758778
extra: {
759779
title: this.$t("action." + taskAction),
760780
isNotificationHidden: true,
781+
eventId,
761782
},
762783
})
763784
);

core/ui/src/components/domains/CreateDomainModal.vue

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -917,21 +917,27 @@ export default {
917917
this.loading.getClusterStatus = true;
918918
this.error.getClusterStatus = "";
919919
const taskAction = "get-cluster-status";
920+
const eventId = this.getUuid();
921+
920922
// register to task error
921-
this.$root.$off(taskAction + "-aborted");
922-
this.$root.$once(taskAction + "-aborted", this.getClusterStatusAborted);
923+
this.$root.$once(
924+
`${taskAction}-aborted-${eventId}`,
925+
this.getClusterStatusAborted
926+
);
927+
923928
// register to task completion
924-
this.$root.$off(taskAction + "-completed");
925929
this.$root.$once(
926-
taskAction + "-completed",
930+
`${taskAction}-completed-${eventId}`,
927931
this.getClusterStatusCompleted
928932
);
933+
929934
const res = await to(
930935
this.createClusterTask({
931936
action: taskAction,
932937
extra: {
933938
title: this.$t("action." + taskAction),
934939
isNotificationHidden: true,
940+
eventId,
935941
},
936942
})
937943
);
@@ -957,18 +963,27 @@ export default {
957963
this.error.nodesList = "";
958964
this.loading.nodesList = true;
959965
const taskAction = "list-nodes";
966+
const eventId = this.getUuid();
967+
960968
// register to task error
961-
this.$root.$off(taskAction + "-aborted");
962-
this.$root.$once(taskAction + "-aborted", this.listNodesAborted);
969+
this.$root.$once(
970+
`${taskAction}-aborted-${eventId}`,
971+
this.listNodesAborted
972+
);
973+
963974
// register to task completion
964-
this.$root.$off(taskAction + "-completed");
965-
this.$root.$once(taskAction + "-completed", this.listNodesCompleted);
975+
this.$root.$once(
976+
`${taskAction}-completed-${eventId}`,
977+
this.listNodesCompleted
978+
);
979+
966980
const res = await to(
967981
this.createClusterTask({
968982
action: taskAction,
969983
extra: {
970984
title: this.$t("action." + taskAction),
971985
isNotificationHidden: true,
986+
eventId,
972987
},
973988
})
974989
);
@@ -993,21 +1008,27 @@ export default {
9931008
this.error.listMountPoints = "";
9941009
this.loading.listMountPoints = true;
9951010
const taskAction = "list-mountpoints";
1011+
const eventId = this.getUuid();
1012+
9961013
// register to task error
997-
this.$root.$off(taskAction + "-aborted");
998-
this.$root.$once(taskAction + "-aborted", this.listMountPointsAborted);
1014+
this.$root.$once(
1015+
`${taskAction}-aborted-${eventId}`,
1016+
this.listMountPointsAborted
1017+
);
1018+
9991019
// register to task completion
1000-
this.$root.$off(taskAction + "-completed");
10011020
this.$root.$once(
1002-
taskAction + "-completed",
1021+
`${taskAction}-completed-${eventId}`,
10031022
this.listMountPointsCompleted
10041023
);
1024+
10051025
const res = await to(
10061026
this.createNodeTask(this.selectedNode.id, {
10071027
action: taskAction,
10081028
extra: {
10091029
title: this.$t("action." + taskAction),
10101030
isNotificationHidden: true,
1031+
eventId,
10111032
},
10121033
})
10131034
);

0 commit comments

Comments
 (0)