HUGE REFACTOR / CLEANUP
if there is a issue it's probably something in here that was changed
This commit is contained in:
@@ -155,20 +155,13 @@
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* Xeslint-disable */
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const FORM_KEY = "ops-notification-settings";
|
||||
|
||||
export default {
|
||||
async created() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
try {
|
||||
await initForm(vm);
|
||||
|
||||
vm.rights = window.$gz.role.getRights(
|
||||
window.$gz.type.OpsNotificationSettings
|
||||
);
|
||||
@@ -234,7 +227,7 @@ export default {
|
||||
if (this.formState.loading) {
|
||||
return;
|
||||
}
|
||||
let canSave = val.dirty && val.valid && !val.readOnly;
|
||||
const canSave = val.dirty && val.valid && !val.readOnly;
|
||||
if (canSave) {
|
||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
|
||||
} else {
|
||||
@@ -265,13 +258,11 @@ export default {
|
||||
}
|
||||
},
|
||||
async getDataFromApi() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
vm.formState.loading = true;
|
||||
let url = "global-ops-notification-setting";
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.get(url);
|
||||
|
||||
const res = await window.$gz.api.get("global-ops-notification-setting");
|
||||
if (res.error) {
|
||||
if (res.error.code == "2010") {
|
||||
window.$gz.form.handleObjectNotFound(vm);
|
||||
@@ -297,14 +288,15 @@ export default {
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
try {
|
||||
if (vm.canSave) {
|
||||
vm.formState.loading = true;
|
||||
let url = "global-ops-notification-setting";
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
let res = await window.$gz.api.upsert(url, vm.obj);
|
||||
|
||||
const res = await window.$gz.api.upsert(
|
||||
"global-ops-notification-setting",
|
||||
vm.obj
|
||||
);
|
||||
vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
@@ -323,13 +315,15 @@ export default {
|
||||
}
|
||||
},
|
||||
async testConfiguration() {
|
||||
let vm = this;
|
||||
const vm = this;
|
||||
vm.formState.loading = true;
|
||||
vm.testDialog = false;
|
||||
let url = `global-ops-notification-setting/test-smtp-settings/${vm.testAddress}`;
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
try {
|
||||
let res = await window.$gz.api.upsert(url, {});
|
||||
const res = await window.$gz.api.upsert(
|
||||
`global-ops-notification-setting/test-smtp-settings/${vm.testAddress}`,
|
||||
{}
|
||||
);
|
||||
vm.formState.loading = false;
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
@@ -352,7 +346,7 @@ async 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 "save":
|
||||
@@ -374,7 +368,7 @@ async function clickHandler(menuItem) {
|
||||
//
|
||||
//
|
||||
function generateMenu(vm) {
|
||||
let menuOptions = {
|
||||
const menuOptions = {
|
||||
isMain: true,
|
||||
readOnly: vm.formState.readOnly,
|
||||
icon: "$ayiBullhorn",
|
||||
@@ -447,8 +441,7 @@ async function fetchTranslatedText(vm) {
|
||||
//
|
||||
//
|
||||
async function populateSelectionLists(vm) {
|
||||
await window.$gz.enums.fetchEnumList("NotifyMailSecurity"); //prefetch
|
||||
//populate
|
||||
await window.$gz.enums.fetchEnumList("NotifyMailSecurity");
|
||||
vm.selectLists.NotifyMailSecurity = window.$gz.enums.getSelectionList(
|
||||
"NotifyMailSecurity"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user