From a96dea47bd64d4ecab5cc4b5a93973149fe3f6d2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 9 Dec 2020 19:00:23 +0000 Subject: [PATCH] --- .../components/extension-delete-control.vue | 20 +++-- .../src/components/extension-tags-control.vue | 2 +- ayanova/src/components/extensions-control.vue | 88 ++++++++++++++++++- ayanova/src/views/adm-attachments.vue | 2 +- 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/ayanova/src/components/extension-delete-control.vue b/ayanova/src/components/extension-delete-control.vue index 662796be..f89018ea 100644 --- a/ayanova/src/components/extension-delete-control.vue +++ b/ayanova/src/components/extension-delete-control.vue @@ -19,6 +19,7 @@ :loading="jobActive" >{{ $ay.t("StartJob") }} + @@ -36,7 +37,8 @@ export default { data: () => ({ jobActive: false, rights: window.$gz.role.defaultRightsObject(), - available: false + available: false, + notes: null }), methods: { goHelp() { @@ -46,6 +48,7 @@ export default { return true; }, async doAction() { + let vm = this; let dialogResult = await window.$gz.dialog.confirmGeneric( "EraseMultipleObjectsWarning", "error" @@ -53,8 +56,9 @@ export default { if (dialogResult == false) { return; } + vm.notes = null; //do the bulk action - let vm = this; + let url = "job-operations/bulk-delete"; let body = this.dataListSelection; @@ -90,14 +94,18 @@ export default { `job-operations/status/${jobId}` ); if (jobStatus.error) { - //throw new Error(jobStatus.error); throw new Error( window.$gz.errorHandler.errorToString(jobStatus, vm) ); } jobStatus = jobStatus.data; if (jobStatus == 4 || jobStatus == 0) { - throw new Error("Seeding job failed"); + if (jobStatus == 4) { + + vm.notes = res.data; + } + } + throw new Error("Job failed"); } if (jobStatus == 3) { vm.jobActive = false; @@ -108,7 +116,9 @@ export default { vm.$emit("ext-close-refresh"); } catch (error) { vm.jobActive = false; - window.$gz.errorHandler.handleFormError(error, vm); + + // vm.notes = window.$gz.errorHandler.errorToString(error); + //window.$gz.errorHandler.handleFormError(error, vm); window.$gz.eventBus.$emit("notify-error", vm.$ay.t("JobFailed")); } } diff --git a/ayanova/src/components/extension-tags-control.vue b/ayanova/src/components/extension-tags-control.vue index ff27c47d..457afcda 100644 --- a/ayanova/src/components/extension-tags-control.vue +++ b/ayanova/src/components/extension-tags-control.vue @@ -128,7 +128,7 @@ export default { } jobStatus = jobStatus.data; if (jobStatus == 4 || jobStatus == 0) { - throw new Error("Seeding job failed"); + throw new Error("Job failed"); } if (jobStatus == 3) { vm.jobActive = false; diff --git a/ayanova/src/components/extensions-control.vue b/ayanova/src/components/extensions-control.vue index 26b6ffb4..dc488ffe 100644 --- a/ayanova/src/components/extensions-control.vue +++ b/ayanova/src/components/extensions-control.vue @@ -4,11 +4,26 @@ {{ $ay.t("Extensions") }} {{ titleText() }} + @@ -40,7 +55,13 @@ export default { selectedRowIds: [], dataListKey: null, listView: null - } + }, + headers: [], + errorObj: null, + //cache display format stuff + timeZoneName: window.$gz.locale.getBrowserTimeZoneName(), + languageName: window.$gz.locale.getBrowserLanguages(), + hour12: window.$gz.locale.getHour12() }), methods: { titleText() { @@ -51,6 +72,45 @@ export default { this.dataListSelection.selectedRowIds.length }`; }, + async handleError(jobId) { + console.log("handleError", jobId); + return; + let res = await window.$gz.api.get(`job-operations/logs/${jobId}`); + if (res.data || res.data.length() > 0) { + /*{"data":[ + {"created":"2020-12-09T18:41:58.129408Z","statusText":"Processing job \"Bulk operation: DELETE on HeadOffice (2 specified) - BulkCoreBizObjectOperation:Delete\"","jobId":"00000000-0000-0000-0000-000000000000"}, + {"created":"2020-12-09T18:41:58.149926Z","statusText":"Bulk job Delete started...","jobId":"00000000-0000-0000-0000-000000000000"}, + {"created":"2020-12-09T18:41:58.185514Z","statusText":"Error processing item 9: Validation errors:\r\nTarget: errorbox error: LT:Customer\r\n","jobId":"00000000-0000-0000-0000-000000000000"}, + {"created":"2020-12-09T18:41:58.194434Z","statusText":"Error processing item 7: Validation errors:\r\nTarget: errorbox error: LT:Customer\r\n","jobId":"00000000-0000-0000-0000-000000000000"}, + {"created":"2020-12-09T18:41:58.196858Z","statusText":"Bulk job Delete processed 2 of 2 with 2 failures","jobId":"00000000-0000-0000-0000-000000000000"} + ]} + */ + } + //NOPE----------- + if (res.data) { + vm.rawObj = res.data; + let ret = []; + for (let i = 0; i < res.data.length; i++) { + let o = res.data[i]; + ret.push({ + id: i, + created: window.$gz.locale.utcDateToShortDateAndTimeLocalized( + o.created, + this.timeZoneName, + this.languageName, + this.hour12 + ), + status: o.statusText, + jobId: + o.jobId == "00000000-0000-0000-0000-000000000000" ? "" : o.jobId + }); + } + vm.obj = ret; + } else { + vm.rawObj = []; + vm.obj = []; + } + }, open(dls) { this.dataListSelection = dls; this.isVisible = true; @@ -65,4 +125,30 @@ export default { } } }; +///////////////////////////////// +// +// +async function initForm(vm) { + await fetchTranslatedText(vm); + await createTableHeaders(vm); +} + +////////////////////////////////////////////////////////// +// +// Ensures UI translated text is available +// +async function fetchTranslatedText(vm) { + await window.$gz.translation.cacheTranslations(["TimeStamp", "ID", "Status"]); +} + +////////////////////// +// +// +async function createTableHeaders(vm) { + vm.headers = [ + { text: vm.$ay.t("TimeStamp"), value: "created" }, + { text: vm.$ay.t("Status"), value: "status" }, + { text: vm.$ay.t("ID"), value: "jobId" } + ]; +} diff --git a/ayanova/src/views/adm-attachments.vue b/ayanova/src/views/adm-attachments.vue index f122ce98..8b3b6de7 100644 --- a/ayanova/src/views/adm-attachments.vue +++ b/ayanova/src/views/adm-attachments.vue @@ -238,7 +238,7 @@ export default { } jobStatus = jobStatus.data; if (jobStatus == 4 || jobStatus == 0) { - throw new Error("Seeding job failed"); + throw new Error("Job failed"); } if (jobStatus == 3) { vm.jobActive = false;