Show plain error message if primary location is in use

This commit is contained in:
Johannes Zellner
2025-03-21 12:38:55 +01:00
parent 7c1160de92
commit 8498b79493
2 changed files with 6 additions and 5 deletions

View File

@@ -101,11 +101,11 @@ async function submit() {
}
busy.value = false;
if (error.status === 'Conflict' && error.message.indexOf('port') !== -1) {
const match = error.message.match(/.*port.(.*)/);
if (error.status === 409 && error.body.message.indexOf('port') !== -1) {
const match = error.body.message.match(/.*port.(.*)/);
formError.value.port = match ? parseInt(match[1]) : null;
} else if (error.status === 'Conflict' && error.message.indexOf('primary location') !== -1) {
formError.value.location = true;
} else if (error.status === 409 && error.body.message.indexOf('primary location') !== -1) {
formError.value.location = error.body.message;
} else if (error.status === 412) {
formError.value.generic = error.body.message;
} else {
@@ -195,6 +195,7 @@ defineExpose({
<TextInput id="location" ref="locationInput" v-model="location" />
<Dropdown v-model="domain" :options="domains" option-label="domain" />
</InputGroup>
<div class="text-danger" v-if="formError.location">{{ formError.location }}</div>
</FormGroup>
<p class="text-small text-warning" v-show="domain.provider === 'noop' || domain.provider === 'manual'" v-html="$t('appstore.installDialog.manualWarning', { location: ((location ? location + '.' : '') + domain.domain) })"></p>

View File

@@ -9,7 +9,7 @@ const elem = useTemplateRef('elem');
onMounted(() => {
const observer = new IntersectionObserver(result => {
if (result[0].isIntersecting) {
if (result[0].isIntersecting && elem.value) {
visible.value = true;
observer.unobserve(elem.value);
}