Allow to overwrite dns if record already exists for an app
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { Button, SingleSelect, InputGroup, FormGroup, TextInput } from 'pankow';
|
||||
import { Button, SingleSelect, InputGroup, FormGroup, TextInput, Checkbox } from 'pankow';
|
||||
import { isValidDomain } from 'pankow/utils';
|
||||
import PortBindings from '../PortBindings.vue';
|
||||
import AppsModel from '../../models/AppsModel.js';
|
||||
@@ -90,15 +90,23 @@ async function onSubmit() {
|
||||
for (const d of redirects.value) checkForDomains.push({ domain: d.domain, subdomain: d.subdomain });
|
||||
|
||||
for (const d of checkForDomains) {
|
||||
console.log('checking', d.subdomain, d.domain)
|
||||
const [error, result] = await domainsModel.checkRecords(d.domain, d.subdomain);
|
||||
if (error) {
|
||||
errorMessage.value = error.body ? error.body.message : 'Internal error';
|
||||
busy.value = false;
|
||||
return console.error(error);
|
||||
}
|
||||
if (result.needsOverwrite) return needsOverwriteDns.value = true;
|
||||
|
||||
if (result.needsOverwrite && !overwriteDns.value) {
|
||||
busy.value = false;
|
||||
needsOverwriteDns.value = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('checking done')
|
||||
|
||||
// only use enabled ports
|
||||
const ports = {};
|
||||
const portsCombined = Object.assign(tcpPorts.value || {}, udpPorts.value || {});
|
||||
@@ -245,6 +253,7 @@ onMounted(async () => {
|
||||
<div class="has-error" v-if="errorMessage">{{ errorMessage }}</div>
|
||||
|
||||
<br/>
|
||||
<Checkbox v-if="needsOverwriteDns" v-model="overwriteDns" :label="$t('app.location.dnsoverwrite')"/>
|
||||
|
||||
<Button @click="onSubmit()" :loading="busy" :disabled="busy || app.error || app.taskId || !formValid" v-tooltip="app.error ? 'App is in error state' : (app.taskId ? 'App is busy' : '')">{{ $t('app.location.saveAction') }}</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user