This commit is contained in:
2020-07-24 16:02:42 +00:00
parent 9fa22551a1
commit 3ce7c1e119
5 changed files with 241 additions and 3 deletions

View File

@@ -45,6 +45,16 @@ todo: Localize this message or get rid of it, it's annoying and possibly useless
##########################
todo: ops backup file list not in order by date, seems to be random or something, I want newest at top oldest at bottom
todo: go over server logging and rethink it a bit, levels maybe need adjusting, more debug and less trace
need an intermediate mode where users can set it for diagnosing issues
for example, should always log when notification delivery fails, but when it succeeds that might be a debug level , not a trace level
because user may want to see what is generally going on without all the nitty gritty filling the log
or maybe trace is fine and just accept huge log files with extra detail?
Maybe enable trace and see what gets logged.
todo: logging sql queries in trace at server
maybe too much or maybe that's trace level and everything else I've done at trace sb debug so can filter OUT that sql shit
Also the user count license circumvention query is plainly visible, if it were to be executed directly instead of through EF core it may not be visible?
todo: add method to continue on to requested url when a login needs to happen
(like capture the requested url and if found after login go to it)
todo: clean out leftover openurl stuff from old system

View File

@@ -400,7 +400,12 @@ export default new Router({
component: () =>
import(/* webpackChunkName: "ops" */ "./views/ops-profile.vue")
},
{
path: "/ops-notify-queue",
name: "ops-notify-queue",
component: () =>
import(/* webpackChunkName: "ops" */ "./views/ops-notify-queue.vue")
},
{
path: "/ops-notification-settings",
name: "ops-notification-settings",

View File

@@ -63,6 +63,7 @@ export default {
appError: null,
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
//cache display format stuff
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
languageName: window.$gz.locale.getBrowserLanguages(),

View File

@@ -248,7 +248,7 @@ export default {
appError: null,
serverError: {}
},
rights: window.$gz.role.fullRightsObject()
rights: window.$gz.role.defaultRightsObject()
};
},
watch: {
@@ -456,7 +456,8 @@ async function fetchTranslatedText(vm) {
"SmtpServerPort",
"NotifyFromAddress",
"AyaNovaServerURL",
"JobCompleted"
"JobCompleted",
"NotifyQueue"
]);
}

View File

@@ -0,0 +1,221 @@
<template>
<v-row v-if="this.formState.ready">
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
<v-col cols="12">
<v-btn @click="getDataFromApi">
<v-icon>fa-sync</v-icon>
</v-btn>
<v-simple-table>
<template v-slot:default>
<thead>
<tr>
<th class="text-left">{{ $ay.t("TimeStamp") }}</th>
<th class="text-left">{{ $ay.t("ID") }}</th>
<th class="text-left">{{ $ay.t("Status") }}</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>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "ops-notify-queue";
export default {
async created() {
let vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(
window.$gz.type.OpsNotificationSettings
);
vm.formState.readOnly = !vm.rights.change;
vm.formState.ready = true;
window.$gz.eventBus.$on("menu-click", clickHandler);
await vm.getDataFromApi();
vm.formState.loading = false;
} catch (err) {
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err, vm);
}
},
data() {
return {
obj: [],
rawObj: [],
formState: {
ready: false,
loading: true,
errorBoxMessage: null,
appError: null,
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
//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: {
async getDataFromApi() {
let vm = this;
vm.formState.loading = true;
let url = "job-operations/logs/all-jobs";
window.$gz.form.deleteAllErrorBoxErrors(vm);
try {
let res = await window.$gz.api.get(url);
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 (error) {
window.$gz.form.setFormState({
vm: vm,
loading: false
});
window.$gz.errorHandler.handleFormError(error, vm);
}
}
}
};
//////////////////////
//
//
function generateMenu(vm) {
let menuOptions = {
isMain: true,
icon: "fa-bullhorn",
title: "NotifyQueue",
helpUrl: "form-ops-notify-queue",
formData: {
ayaType: window.$gz.type.ServerJob
},
menuItems: [
// {
// title: "Copy",
// icon: "fa-copy",
// surface: false,
// key: FORM_KEY + ":copylog",
// vm: vm
// }
]
};
// if (vm.rights.change) {
// menuOptions.menuItems.push({
// title: "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 + "]"
);
}
}
}
/////////////////////////////////
//
//
async function initForm(vm) {
await fetchTranslatedText(vm);
}
//////////////////////////////////////////////////////////
//
// Ensures UI translated text is available
//
async function fetchTranslatedText(vm) {
await window.$gz.translation.cacheTranslations([]);
}
</script>