This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
PRIORITY - ALWAYS Lowest level stuff first, i.e. TODO at server, api route changes etc then back here in order lowest level first as affects the most stuff exponentially so best to do it early
|
||||
=-=-=-=-
|
||||
|
||||
SERVER JOBS LOG
|
||||
[{"created":"2020-05-23T19:48:28.975283Z","statusText":"ProcessTestJob done sleeping setting job to finished","jobId":"668fea2d-6a24-4008-a416-02c03cf99eeb"},{"created":"2020-05-23T19:47:58.97211Z","statusText":"ProcessTestJob started, sleeping for 30000 seconds...","jobId":"668fea2d-6a24-4008-a416-02c03cf99eeb"},{"created":"2020-05-23T19:47:58.962139Z","statusText":"Process job \"TestJob TestJob\"","jobId":"668fea2d-6a24-4008-a416-02c03cf99eeb"},{"created":"2020-05-23T19:46:58.667705Z","statusText":"ProcessTestJob done sleeping setting job to finished","jobId":"d3a38c52-accc-40f6-b05c-5790e4365fa2"},{"created":"2020-05-23T19:46:28.678575Z","statusText":"ProcessTestJob started, sleeping for 30000 seconds...","jobId":"d3a38c52-accc-40f6-b05c-5790e4365fa2"},{"created":"2020-05-23T19:46:28.657195Z","statusText":"Process job \"TestJob TestJob\"","jobId":"d3a38c52-accc-40f6-b05c-5790e4365fa2"},{"created":"2020-05-23T18:43:55.188958Z","statusText":"Backup - fully complete, server re-opened","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T18:43:55.185356Z","statusText":"Pruning old backup sets","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T18:43:55.161551Z","statusText":"Attachments backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T18:43:47.424751Z","statusText":"Data backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T18:43:47.416537Z","statusText":"Starting backup job manual / on demand ","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T18:43:47.405213Z","statusText":"Process job \"Backup (on demand) Backup\"","jobId":"1e6f6eb5-5ac9-488d-895e-81b09d42c889"},{"created":"2020-05-23T18:43:02.277264Z","statusText":"Bulk job TagAdd processed 2 of 2","jobId":"8aa2e015-fedc-4b6b-8a57-b313caa4b724"},{"created":"2020-05-23T18:43:00.975154Z","statusText":"Bulk job TagAdd started...","jobId":"8aa2e015-fedc-4b6b-8a57-b313caa4b724"},{"created":"2020-05-23T18:43:00.951671Z","statusText":"Process job \"Bulk operation: Add tag \"my-new-tag\" on Widget (2 specified) BulkCoreBizObjectOperation:TagAdd\"","jobId":"8aa2e015-fedc-4b6b-8a57-b313caa4b724"},{"created":"2020-05-23T18:42:45.832246Z","statusText":"ProcessTestJob done sleeping setting job to finished","jobId":"cb797c33-8716-4b11-a5c4-399ace0ddd8e"},{"created":"2020-05-23T18:42:15.812871Z","statusText":"ProcessTestJob started, sleeping for 30000 seconds...","jobId":"cb797c33-8716-4b11-a5c4-399ace0ddd8e"},{"created":"2020-05-23T18:42:15.7808Z","statusText":"Process job \"TestJob TestJob\"","jobId":"cb797c33-8716-4b11-a5c4-399ace0ddd8e"},{"created":"2020-05-23T15:54:52.665018Z","statusText":"Backup - fully complete, server re-opened","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:54:52.549576Z","statusText":"Npgsql -> Exception while connecting\r\nNpgsql -> The operation has timed out.\r\n","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:54:52.467139Z","statusText":"Backup failed with errors:","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:54:27.546309Z","statusText":"Starting backup job scheduled ","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:52:51.70968Z","statusText":"Backup - fully complete, server re-opened","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:52:51.705316Z","statusText":"Pruning old backup sets","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:52:51.699977Z","statusText":"Attachments backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:52:43.919157Z","statusText":"Data backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:52:43.909642Z","statusText":"Starting backup job scheduled ","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:58.70602Z","statusText":"Backup - fully complete, server re-opened","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:58.702804Z","statusText":"Pruning old backup sets","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:58.679318Z","statusText":"Attachments backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:51.46409Z","statusText":"Data backup starting","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:51.460855Z","statusText":"Starting backup job manual / on demand ","jobId":"00000000-0000-0000-0000-000000000000"},{"created":"2020-05-23T15:51:51.449611Z","statusText":"Process job \"Backup (on demand) Backup\"","jobId":"99ae8921-8328-42fe-9f34-0e39f0849eba"}]
|
||||
|
||||
CURRENTLY: JOBS UI
|
||||
For now, just show a report of jobs log
|
||||
|
||||
@@ -108,6 +108,7 @@ export default {
|
||||
"More",
|
||||
"Logout",
|
||||
"Active",
|
||||
"Copy",
|
||||
"New",
|
||||
"Cancel",
|
||||
"Close",
|
||||
|
||||
@@ -190,6 +190,7 @@ export default {
|
||||
let vm = this;
|
||||
// vm.formState.loading = true;
|
||||
let url = "backup/status";
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
window.$gz.api
|
||||
.get(url)
|
||||
.then(res => {
|
||||
|
||||
@@ -1,21 +1,257 @@
|
||||
<template>
|
||||
<UnderConstruction />
|
||||
<v-row v-if="this.formState.ready">
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
<v-col cols="12">
|
||||
<v-btn @click="getDataFromApi" class="m-6">
|
||||
<v-icon>fa-sync</v-icon>
|
||||
</v-btn>
|
||||
<v-simple-table>
|
||||
<template v-slot:default>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-left"></th>
|
||||
<th class="text-left"></th>
|
||||
<th class="text-left"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in obj" :key="item.id">
|
||||
<td>{{ item.created }}</td>
|
||||
<td>{{ item.jobId }}</td>
|
||||
<td>{{ item.status }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</template>
|
||||
</v-simple-table>
|
||||
<!-- </v-col> -->
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UnderConstruction from "../components/underconstruction.vue";
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const FORM_KEY = "ops-jobs";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
UnderConstruction
|
||||
created() {
|
||||
let vm = this;
|
||||
initForm(vm)
|
||||
.then(() => {
|
||||
vm.formState.ready = true;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
vm.getDataFromApi();
|
||||
vm.formState.loading = false;
|
||||
})
|
||||
.catch(err => {
|
||||
vm.formState.ready = true;
|
||||
window.$gz.errorHandler.handleFormError(err, vm);
|
||||
});
|
||||
},
|
||||
beforeCreate() {
|
||||
window.$gz.eventBus.$emit("menu-change", {
|
||||
isMain: true,
|
||||
icon: "fa-robot",
|
||||
title: this.$ay.t("ServerJobs"),
|
||||
helpUrl: "form-ops-jobs"
|
||||
});
|
||||
data() {
|
||||
return {
|
||||
obj: [],
|
||||
rawObj: [],
|
||||
formState: {
|
||||
ready: false,
|
||||
loading: true,
|
||||
errorBoxMessage: null,
|
||||
appError: null,
|
||||
serverError: {}
|
||||
},
|
||||
//cache display format stuff
|
||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
|
||||
languageName: window.$gz.locale.getBrowserLanguages(),
|
||||
hour12: window.$gz.locale.getHour12()
|
||||
};
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
},
|
||||
methods: {
|
||||
translation() {
|
||||
return window.$gz.translation;
|
||||
},
|
||||
locale() {
|
||||
return window.$gz.locale;
|
||||
},
|
||||
form() {
|
||||
return window.$gz.form;
|
||||
},
|
||||
fieldValueChanged(ref) {
|
||||
if (!this.formState.loading && !this.formState.readOnly) {
|
||||
window.$gz.form.fieldValueChanged(this, ref);
|
||||
}
|
||||
},
|
||||
getDataFromApi() {
|
||||
let vm = this;
|
||||
vm.formState.loading = true;
|
||||
let url = "job-operations/logs/all-jobs";
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
window.$gz.api
|
||||
.get(url)
|
||||
.then(res => {
|
||||
if (res.error) {
|
||||
if (res.error.code == "2010") {
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-error",
|
||||
vm.$ay.t("ErrorAPI2010")
|
||||
);
|
||||
window.$gz._.delay(function() {
|
||||
vm.$router.go(-1);
|
||||
}, 2000);
|
||||
}
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
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 = [];
|
||||
}
|
||||
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
loading: false
|
||||
});
|
||||
generateMenu(vm);
|
||||
}
|
||||
})
|
||||
.catch(function handleGetDataFromAPIError(error) {
|
||||
window.$gz.form.setFormState({
|
||||
vm: vm,
|
||||
loading: false
|
||||
});
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
},
|
||||
testJob() {
|
||||
let vm = this;
|
||||
vm.formState.loading = true;
|
||||
let url = "job-operations/test-job";
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
window.$gz.api
|
||||
.upsert(url, {})
|
||||
.then(res => {
|
||||
vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
}
|
||||
})
|
||||
.catch(function handleSubmitError(error) {
|
||||
vm.formState.loading = false;
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
isMain: true,
|
||||
icon: "fa-robot",
|
||||
title: vm.$ay.t("ServerJobs"),
|
||||
helpUrl: "form-ops-jobs",
|
||||
menuItems: [
|
||||
{
|
||||
title: vm.$ay.t("Copy"),
|
||||
icon: "fa-copy",
|
||||
surface: false,
|
||||
key: FORM_KEY + ":copylog",
|
||||
vm: vm
|
||||
},
|
||||
{
|
||||
title: vm.$ay.t("OpsTestJob"),
|
||||
icon: "fa-robot",
|
||||
surface: false,
|
||||
key: FORM_KEY + ":TEST_JOB",
|
||||
vm: vm
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
//
|
||||
//
|
||||
function clickHandler(menuItem) {
|
||||
if (!menuItem) {
|
||||
return;
|
||||
}
|
||||
let m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "copylog":
|
||||
//put the log info on the clipboard:
|
||||
window.$gz.util.copyToClipboard(
|
||||
"SERVER JOBS LOG\n" + JSON.stringify(m.vm.rawObj, null, 1)
|
||||
);
|
||||
break;
|
||||
case "TEST_JOB":
|
||||
m.vm.testJob();
|
||||
break;
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
FORM_KEY + "::context click: [" + m.key + "]"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
//
|
||||
//
|
||||
function initForm(vm) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
(async function() {
|
||||
try {
|
||||
await fetchTranslatedText(vm);
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
resolve();
|
||||
})();
|
||||
});
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
// Ensures UI translated text is available
|
||||
//
|
||||
function fetchTranslatedText(vm) {
|
||||
let tKeysRequired = ["OpsTestJob"];
|
||||
|
||||
return window.$gz.translation.fetch(tKeysRequired);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user