diff --git a/dashboard/src/style.css b/dashboard/src/style.css index a868601a8..598627aa9 100644 --- a/dashboard/src/style.css +++ b/dashboard/src/style.css @@ -83,6 +83,12 @@ footer > .p { margin: 4px; } + +/* TODO use pankow has-error everywhere instead*/ +.text-danger { + color: var(--pankow-color-danger); +} + .content { max-width: 1280px; width: 100%; diff --git a/dashboard/src/views/BrandingView.vue b/dashboard/src/views/BrandingView.vue index 8030f99d9..f8d3070e8 100644 --- a/dashboard/src/views/BrandingView.vue +++ b/dashboard/src/views/BrandingView.vue @@ -19,9 +19,11 @@ const name = ref(''); const footer = ref(''); const avatarUrl = ref(`${API_ORIGIN}/api/v1/cloudron/avatar?${String(Math.random()).slice(2)}`); const backgroundUrl = ref(`${API_ORIGIN}/api/v1/cloudron/background?${String(Math.random()).slice(2)}`); +const backgroundError = ref(''); async function onSubmit() { busy.value = true; + backgroundError.value = ''; let [error] = await brandingModel.setName(name.value); if (error) return console.error(error); @@ -31,7 +33,16 @@ async function onSubmit() { if (newBackgroundDataUrl) { const [error] = await brandingModel.setBackground(newBackgroundDataUrl); - if (error) return console.error(error); + if (error) { + // TODO fetch() returns no proper status if entity is too large ?? + // if (error.status === 413) { + backgroundError.value = 'Image is too large'; + busy.value = false; + // } else { + // return console.error(error); + // } + return; + } } if (newAvatarDataUrl) { @@ -81,7 +92,8 @@ onMounted(async () => { - + +
{{ backgroundError }}