Fix dupe domain name issues
parent
7905593480
commit
4e34a9b6a9
|
@ -70,8 +70,8 @@ limitations under the License.
|
||||||
<div :class="`column ${splitColumn ? 'is-half' : 'is-full'} is-full-mobile is-full-tablet`">
|
<div :class="`column ${splitColumn ? 'is-half' : 'is-full'} is-full-mobile is-full-tablet`">
|
||||||
<h2>{{ i18n.templates.app.configFiles }}</h2>
|
<h2>{{ i18n.templates.app.configFiles }}</h2>
|
||||||
<div ref="files" class="columns is-multiline">
|
<div ref="files" class="columns is-multiline">
|
||||||
<NginxPrism v-for="conf in confFilesOutput"
|
<NginxPrism v-for="(conf, i) in confFilesOutput"
|
||||||
:key="`${conf[0]}-${hash(conf[1])}`"
|
:key="`${conf[0]}-${i}-${hash(conf[1])}`"
|
||||||
:name="`${nginxDir}/${conf[0]}`"
|
:name="`${nginxDir}/${conf[0]}`"
|
||||||
:conf="conf[1]"
|
:conf="conf[1]"
|
||||||
:half="confFilesOutput.length > 1 && !splitColumn"
|
:half="confFilesOutput.length > 1 && !splitColumn"
|
||||||
|
@ -169,7 +169,18 @@ limitations under the License.
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
add() {
|
add() {
|
||||||
this.$data.domains.push(clone(Domain.delegated));
|
const data = clone(Domain.delegated);
|
||||||
|
|
||||||
|
// Avoid dupe domains
|
||||||
|
let count = 1;
|
||||||
|
while (this.$data.domains.some(d => d && d.server.domain.computed === data.server.domain.computed)) {
|
||||||
|
count++;
|
||||||
|
data.server.domain.computed = data.server.domain.default.replace('.com', `${count}.com`);
|
||||||
|
}
|
||||||
|
data.server.domain.value = data.server.domain.computed;
|
||||||
|
|
||||||
|
// Store
|
||||||
|
this.$data.domains.push(data);
|
||||||
this.$data.active = this.$data.domains.length - 1;
|
this.$data.active = this.$data.domains.length - 1;
|
||||||
},
|
},
|
||||||
remove(index) {
|
remove(index) {
|
||||||
|
|
|
@ -186,11 +186,10 @@ limitations under the License.
|
||||||
watch: {
|
watch: {
|
||||||
'$props.data.domain': {
|
'$props.data.domain': {
|
||||||
handler(data) {
|
handler(data) {
|
||||||
// This might cause recursion, but seems not to
|
// Ignore www. if given, enable WWW subdomain
|
||||||
|
|
||||||
// Ignore www. if given
|
|
||||||
if (data.computed.startsWith('www.')) {
|
if (data.computed.startsWith('www.')) {
|
||||||
data.computed = data.computed.slice(4);
|
data.computed = data.computed.slice(4);
|
||||||
|
this.wwwSubdomain = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use default if empty
|
// Use default if empty
|
||||||
|
|
Loading…
Reference in New Issue