HUGE REFACTOR / CLEANUP

if there is a issue it's probably something in here that was changed
This commit is contained in:
2021-09-28 20:19:44 +00:00
parent 51eddfede9
commit d0afdd9855
238 changed files with 3127 additions and 8614 deletions

View File

@@ -5,7 +5,6 @@
<v-btn @click="getDataFromApi" class="mb-6">
<v-icon>$ayiSync</v-icon>
</v-btn>
<v-data-table
:headers="headers"
:items="obj"
@@ -26,20 +25,13 @@
</v-col>
</v-row>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
const FORM_KEY = "ops-notify-queue";
export default {
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.rights = window.$gz.role.getRights(
window.$gz.type.OpsNotificationSettings
);
@@ -66,8 +58,6 @@ export default {
serverError: {}
},
rights: window.$gz.role.defaultRightsObject(),
//cache display format stuff
timeZoneName: window.$gz.locale.getResolvedTimeZoneName(),
languageName: window.$gz.locale.getResolvedLanguage(),
hour12: window.$gz.locale.getHour12()
@@ -78,23 +68,21 @@ export default {
},
methods: {
async deleteItem(item) {
let vm = this;
const vm = this;
try {
let dialogResult = await window.$gz.dialog.confirmDelete();
const dialogResult = await window.$gz.dialog.confirmDelete();
if (dialogResult != true) {
return;
}
//do the delete
vm.formState.loading = true;
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.remove(`notify/notify-event/${item.id}`);
const res = await window.$gz.api.remove(
`notify/notify-event/${item.id}`
);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
} else {
//refresh
await vm.getDataFromApi();
}
} catch (ex) {
@@ -104,13 +92,11 @@ export default {
}
},
async getDataFromApi() {
let vm = this;
const vm = this;
vm.formState.loading = true;
let url = "notify/queue";
window.$gz.form.deleteAllErrorBoxErrors(vm);
try {
let res = await window.$gz.api.get(url);
const res = await window.$gz.api.get("notify/queue");
if (res.error) {
if (res.error.code == "2010") {
window.$gz.form.handleObjectNotFound(vm);
@@ -120,12 +106,9 @@ export default {
} else {
if (res.data) {
vm.rawObj = res.data;
/*{"data":[{"id":6,"created":"2020-07-24T17:52:05.777883Z","eventDate":"2020-07-24T17:52:05.777886Z","deliverAfter":"2021-07-24T17:52:05.777886Z",
"userId":1,"eventType":10,"ayaType":2,"name":"Small Frozen Chicken 117-1"}]} */
let ret = [];
const ret = [];
for (let i = 0; i < res.data.length; i++) {
let o = res.data[i];
const o = res.data[i];
ret.push({
id: o.id,
created: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
@@ -153,13 +136,11 @@ export default {
user: o.user
});
}
vm.obj = ret;
} else {
vm.rawObj = [];
vm.obj = [];
}
window.$gz.form.setFormState({
vm: vm,
dirty: false,
@@ -183,7 +164,7 @@ export default {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: true,
readOnly: vm.formState.readOnly,
icon: "$ayiBullhorn",
@@ -192,27 +173,9 @@ function generateMenu(vm) {
formData: {
ayaType: window.$gz.type.ServerJob
},
menuItems: [
// {
// title: "Copy",
// icon: "$ayiCopy",
// surface: false,
// key: FORM_KEY + ":copylog",
// vm: vm
// }
]
menuItems: []
};
// if (vm.rights.change) {
// menuOptions.menuItems.push({
// title: "OpsTestJob",
// icon: "$ayiRobot",
// surface: false,
// key: FORM_KEY + ":TEST_JOB",
// vm: vm
// });
// }
window.$gz.eventBus.$emit("menu-change", menuOptions);
}
@@ -223,18 +186,9 @@ function clickHandler(menuItem) {
if (!menuItem) {
return;
}
let m = window.$gz.menu.parseMenuItem(menuItem);
const 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",
@@ -272,8 +226,7 @@ async function fetchTranslatedText(vm) {
//////////////////////
//
//
async function cacheEnums(vm) {
//ensure the enum values required are pre-fetched
async function cacheEnums() {
await window.$gz.enums.fetchEnumList("NotifyEventType");
await window.$gz.enums.fetchEnumList("coreall");
}