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