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

@@ -3,7 +3,12 @@
<v-col>
<v-form ref="form">
<!-- Prevent implicit submission of the form on enter key, this is not necessary on a form with a text area which is why I never noticed it with the other forms -->
<button
type="submit"
disabled
style="display: none"
aria-hidden="true"
></button>
<v-row>
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<v-col cols="12">
@@ -73,27 +78,22 @@
</v-row>
</template>
<script>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Xeslint-disable */
////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//NOTE: This is a simple form with no need for business rules or validation so stripped out any extraneous code related to all that
//
const FORM_KEY = "adm-global-logo";
export default {
beforeDestroy() {
window.$gz.eventBus.$off("menu-click", clickHandler);
},
async created() {
let vm = this;
const vm = this;
try {
await initForm(vm);
vm.formState.ready = true;
vm.readOnly = !vm.rights.change;
window.$gz.eventBus.$on("menu-click", clickHandler);
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
//modify the menu as necessary
generateMenu(vm);
vm.smallUrl = `${window.$gz.api.logoUrl("small")}?x=${Date.now()}`;
vm.mediumUrl = `${window.$gz.api.logoUrl("medium")}?x=${Date.now()}`;
@@ -101,7 +101,6 @@ export default {
vm.fileSizeExceededWarning = vm.$ay
.t("AyaFileFileTooLarge")
.replace("{0}", "512KiB");
vm.formState.loading = false;
} catch (err) {
vm.formState.ready = true;
@@ -139,7 +138,7 @@ export default {
},
async upload(size) {
//similar code in wiki-control
let vm = this;
const vm = this;
let fileData = null;
switch (size) {
case "small":
@@ -162,7 +161,7 @@ export default {
return;
}
try {
let res = await window.$gz.api.uploadLogo(fileData, size);
const res = await window.$gz.api.uploadLogo(fileData, size);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error);
} else {
@@ -186,18 +185,18 @@ export default {
},
async remove(size) {
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;
}
let url = "logo/" + size;
const url = "logo/" + size;
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.remove(url);
const res = await window.$gz.api.remove(url);
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
@@ -230,15 +229,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 "save":
// m.vm.submit();
// break;
// case "delete":
// m.vm.remove();
// break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
@@ -252,7 +245,7 @@ function clickHandler(menuItem) {
//
//
function generateMenu(vm) {
let menuOptions = {
const menuOptions = {
isMain: false,
readOnly: vm.formState.readOnly,
icon: null,
@@ -260,27 +253,6 @@ function generateMenu(vm) {
helpUrl: "adm-global-logo",
menuItems: []
};
// if (vm.rights.change) {
// menuOptions.menuItems.push({
// title: "Save",
// icon: "$ayiSave",
// surface: true,
// key: FORM_KEY + ":save",
// vm: vm
// });
// if (vm.rights.delete) {
// menuOptions.menuItems.push({
// title: "ResetToDefault",
// icon: "fa - undo",
// surface: false,
// key: FORM_KEY + ":delete",
// vm: vm
// });
// }
// }
window.$gz.eventBus.$emit("menu-change", menuOptions);
}