This commit is contained in:
2020-12-09 19:00:23 +00:00
parent 3f8bfc0365
commit a96dea47bd
4 changed files with 104 additions and 8 deletions

View File

@@ -4,11 +4,26 @@
<v-card-title>{{ $ay.t("Extensions") }}</v-card-title>
<v-card-subtitle class="mt-1">{{ titleText() }}</v-card-subtitle>
<v-card-text>
<template v-if="errorObj">
<v-data-table
:headers="headers"
:items="errorObj"
class="elevation-1"
:disable-pagination="true"
:disable-filtering="true"
hide-default-footer
:sort-by="['created']"
:sort-desc="[true]"
:header-props="{ sortByText: $ay.t('Sort') }"
>
</v-data-table>
</template>
<v-expansion-panels focusable>
<ExtensionTags :dataListSelection="dataListSelection" />
<ExtensionExport :dataListSelection="dataListSelection" />
<ExtensionDelete
v-on:ext-close-refresh="close({ refresh: true })"
v-on:ext-show-job-log="handleError(e)"
:dataListSelection="dataListSelection"
/>
</v-expansion-panels>
@@ -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" }
];
}
</script>