Show generic app install errors in the dialog
This commit is contained in:
@@ -60,6 +60,9 @@ const secondaryDomains = ref({});
|
||||
const upstreamUri = ref('');
|
||||
|
||||
async function submit() {
|
||||
formError.value = {};
|
||||
busy.value = true;
|
||||
|
||||
const config = {
|
||||
subdomain: location.value,
|
||||
domain: domain.value.domain,
|
||||
@@ -88,25 +91,23 @@ async function submit() {
|
||||
}
|
||||
config.secondaryDomains = finalSecondaryDomains;
|
||||
|
||||
if (manifest.value.id === PROXY_APP_ID) {
|
||||
config.upstreamUri = upstreamUri.value;
|
||||
}
|
||||
if (manifest.value.id === PROXY_APP_ID) config.upstreamUri = upstreamUri.value;
|
||||
|
||||
busy.value = true;
|
||||
const error = await appsModel.install(manifest.value, config);
|
||||
busy.value = false;
|
||||
const [error] = await appsModel.install(manifest.value, config);
|
||||
|
||||
if (!error) {
|
||||
dialog.value.close();
|
||||
return window.location.href = '#/apps';
|
||||
}
|
||||
|
||||
formError.value = {};
|
||||
busy.value = false;
|
||||
if (error.status === 'Conflict' && error.message.indexOf('port') !== -1) {
|
||||
const match = error.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 === 412) {
|
||||
formError.value.generic = error.body.message;
|
||||
} else {
|
||||
console.error('Failed to install:', error);
|
||||
}
|
||||
@@ -182,6 +183,8 @@ defineExpose({
|
||||
<div class="description" v-html="description"></div>
|
||||
</div>
|
||||
<div v-else-if="step === STEP.INSTALL">
|
||||
<div class="text-danger" v-if="formError.generic">{{ formError.generic }}</div>
|
||||
|
||||
<form @submit.prevent="submit()" autocomplete="off">
|
||||
<fieldset :disabled="busy">
|
||||
<input style="display: none;" type="submit" :disabled="!formValid" />
|
||||
|
||||
Reference in New Issue
Block a user