This commit is contained in:
2020-08-10 20:49:49 +00:00
parent f8b1541785
commit 99f1276222
2 changed files with 18 additions and 6 deletions

View File

@@ -5,13 +5,10 @@ PRIORITY - ALWAYS Lowest level stuff first, i.e. TODO at server, api route chang
todo: Logo form todo: Logo form
translations
clear image (remove it)
Decide upon reasonable maximum sizes for each Decide upon reasonable maximum sizes for each
(check RI/WBI etc manual what do they take for limits?) (check RI/WBI etc manual what do they take for limits?)
Can it send a placeholder if empty instead of a 404?
or, with the gray background do I even need a placeholder anymore?
Handle too large at client, don't even send to server Handle too large at client, don't even send to server
todo: AyaNova customer branding to login form / upload logos etc **UPDATED, SEE CASES, WILL IMPLEMENT MIGHT AS WELL DO IT NOW todo: AyaNova customer branding to login form / upload logos etc **UPDATED, SEE CASES, WILL IMPLEMENT MIGHT AS WELL DO IT NOW

View File

@@ -17,6 +17,7 @@
accept="image/*" accept="image/*"
show-size show-size
:label="$ay.t('SmallLogo')" :label="$ay.t('SmallLogo')"
:rules="rules"
></v-file-input> ></v-file-input>
<v-btn color="primary" text @click="remove('small')">{{ <v-btn color="primary" text @click="remove('small')">{{
$ay.t("Delete") $ay.t("Delete")
@@ -36,6 +37,7 @@
accept="image/*" accept="image/*"
show-size show-size
:label="$ay.t('MediumLogo')" :label="$ay.t('MediumLogo')"
:rules="rules"
></v-file-input> ></v-file-input>
<v-btn color="primary" text @click="remove('medium')">{{ <v-btn color="primary" text @click="remove('medium')">{{
$ay.t("Delete") $ay.t("Delete")
@@ -55,6 +57,7 @@
accept="image/*" accept="image/*"
show-size show-size
:label="$ay.t('LargeLogo')" :label="$ay.t('LargeLogo')"
:rules="rules"
></v-file-input> ></v-file-input>
<v-btn color="primary" text @click="remove('small')">{{ <v-btn color="primary" text @click="remove('small')">{{
$ay.t("Delete") $ay.t("Delete")
@@ -94,6 +97,9 @@ export default {
vm.smallUrl = `${window.$gz.api.logoUrl("small")}?x=${Date.now()}`; vm.smallUrl = `${window.$gz.api.logoUrl("small")}?x=${Date.now()}`;
vm.mediumUrl = `${window.$gz.api.logoUrl("medium")}?x=${Date.now()}`; vm.mediumUrl = `${window.$gz.api.logoUrl("medium")}?x=${Date.now()}`;
vm.largeUrl = `${window.$gz.api.logoUrl("large")}?x=${Date.now()}`; vm.largeUrl = `${window.$gz.api.logoUrl("large")}?x=${Date.now()}`;
vm.fileSizeExceededWarning = vm.$ay
.t("AyaFileFileTooLarge")
.replace("{0}", "512KiB");
vm.formState.loading = false; vm.formState.loading = false;
} catch (err) { } catch (err) {
@@ -109,6 +115,7 @@ export default {
mediumUrl: null, mediumUrl: null,
largeUrl: null, largeUrl: null,
smallUrl: null, smallUrl: null,
fileSizeExceededWarning: "",
formState: { formState: {
ready: false, ready: false,
dirty: false, dirty: false,
@@ -119,7 +126,10 @@ export default {
appError: null, appError: null,
serverError: {} serverError: {}
}, },
rights: window.$gz.role.getRights(window.$gz.type.Global) rights: window.$gz.role.getRights(window.$gz.type.Global),
rules: [
value => !value || value.size < 512000 || this.fileSizeExceededWarning
]
}; };
}, },
methods: { methods: {
@@ -143,6 +153,10 @@ export default {
default: default:
return; return;
} }
if (fileData.size > 512000) {
window.$gz.eventBus.$emit("notify-error", vm.fileSizeExceededWarning);
return;
}
try { try {
let res = await window.$gz.api.uploadLogo(fileData, size); let res = await window.$gz.api.uploadLogo(fileData, size);
if (res.error) { if (res.error) {
@@ -281,7 +295,8 @@ async function fetchTranslatedText(vm) {
"SmallLogo", "SmallLogo",
"MediumLogo", "MediumLogo",
"LargeLogo", "LargeLogo",
"GlobalLogo" "GlobalLogo",
"AyaFileFileTooLarge"
]); ]);
} }
</script> </script>