This commit is contained in:
2020-07-07 19:25:15 +00:00
parent 8815ce99f4
commit 77fc5c3523

View File

@@ -56,7 +56,6 @@ export default {
if (vm.action == "Replace" && !vm.replace) {
return false;
}
//other actions
if (vm.tag) {
return true;
}
@@ -64,20 +63,30 @@ export default {
},
async doAction() {
//do the bulk action
let vm = this;
let url = "tag-list/";
let body = vm.selectedItems;
switch (vm.action) {
case "Add":
url += `bulk-add/${vm.ayaType}/${vm.tag}`;
break;
case "Remove":
url += `bulk-remove/${vm.ayaType}/${vm.tag}`;
break;
case "Replace":
url += `bulk-replace/${vm.ayaType}/${vm.tag}?toTag=${vm.replace}`;
break;
}
try {
//call api route
let jobId = await window.$gz.api.upsert(
`trial/seed/${vm.obj.seedLevel}/${vm.obj.timeZoneOffset}`
);
let jobId = await window.$gz.api.upsert(url, body);
if (jobId.error) {
throw jobId.error;
}
jobId = jobId.jobId; //it's in a sub key
//indicate loading by setting on button
vm.seedingJobActive = true;
vm.jobActive = true;
/* /// <summary>
/// Job status for opsjobs
@@ -93,7 +102,7 @@ export default {
let jobStatus = 1;
//get status
while (vm.seedingJobActive == true) {
while (vm.jobActive == true) {
await window.$gz.util.sleepAsync(1000);
//check if done
jobStatus = await window.$gz.api.get(
@@ -107,15 +116,13 @@ export default {
throw "Seeding job failed";
}
if (jobStatus == 3) {
vm.seedingJobActive = false;
vm.jobActive = false;
}
}
//Here if it's completed successfully
window.$gz.eventBus.$emit("notify-success", vm.$ay.t("JobCompleted"));
vm.$router.push("/login");
} catch (error) {
vm.seedingJobActive = false;
vm.jobActive = false;
window.$gz.errorHandler.handleFormError(error, vm);
window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed"));
}