change targetNamespace to targetServiceNamespace

This commit is contained in:
Nancy Butler 2019-12-12 10:49:33 -07:00 committed by Vincent Fiduccia
parent c31f9b27ef
commit 5cb875cd84
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
4 changed files with 24 additions and 11 deletions

View File

@ -62,7 +62,7 @@ export default {
/>
<input
v-else
v-model="inputString"
v-model="string"
class="input-string"
:placeholder="placeholder"
:disabled="disableInputs"

View File

@ -208,6 +208,7 @@ export default {
:clearable="false"
class="inline"
:reduce="opt=>opt.value"
label="value"
@input="update"
/>
</div>
@ -223,6 +224,7 @@ export default {
:reduce="opt=>opt.value"
:clearable="false"
class="inline"
label="value"
@input="update"
/>
<Checkbox v-if="kind==='app'" v-model="pickVersion" label="Target one version" />
@ -236,6 +238,7 @@ export default {
placeholder="Select a version"
:clearable="false"
class="inline"
label="value"
:reduce="opt=>opt.value"
@input="update"
/>

View File

@ -29,14 +29,9 @@ export default {
mixins: [CreateEditView, LoadDeps],
data() {
let spec = this.value.spec;
const spec = this.value.spec ? JSON.parse(JSON.stringify(this.value.spec)) : {};
let kind = 'app';
if ( !this.value.spec ) {
spec = {};
this.value.spec = spec;
}
if ( spec.ipAddresses ) {
kind = 'ip';
} else if ( spec.fqdn ) {
@ -44,6 +39,7 @@ export default {
}
return {
spec,
kind,
ipAddresses: spec.ipAddresses,
fqdn: spec.fqdn,
@ -54,6 +50,17 @@ export default {
return KIND_LABELS;
}
},
methods: {
update(spec) {
const targetNS = spec.targetNamespace;
if (targetNS) {
delete spec.targetNamespace;
spec.targetServiceNamespace = targetNS;
}
this.value.spec = spec;
}
}
};
</script>
@ -72,7 +79,7 @@ export default {
<div class="spacer"></div>
<Target v-model="value.spec" :kind-labels="kindLabels">
<Target v-model="spec" :kind-labels="kindLabels" @input="update">
<template v-slot:fqdn="slotProps">
<LabeledInput v-model="fqdn" :mode="mode" label="DNS FQDN" @input="e=>slotProps.update(e)" />
</template>

View File

@ -24,11 +24,14 @@ export default {
headers = [], methods = [], path = {}, cookies = []
} = this.spec;
let hostHeader = { name: 'host', value: { exact: '' } };
let hostHeader;
if (headers.length) {
hostHeader = pullAt(headers, findIndex(headers, header => header.name === 'host' && Object.keys(header.value)[0] === 'exact'))[0];
}
if (!hostHeader) {
hostHeader = { name: 'host', value: { exact: '' } };
}
return {
httpMethods: ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
@ -42,7 +45,7 @@ export default {
computed: {
formatted() {
const all = {
headers: !!this.host.value.exact ? [this.host, ...this.headers] : this.headers,
headers: !!this.host.value.exact ? [this.hostHeader, ...this.headers] : this.headers,
methods: this.methods,
path: this.path,
cookies: this.cookies
@ -94,7 +97,7 @@ export default {
const pathString = Object.values(stringmatch)[0];
const method = Object.keys(stringmatch)[0];
if (!pathString.match(/^\/.+/)) {
if (pathString.charAt(0) !== '/') {
this.$set(this.path, method, `/${ pathString }`);
} else {
this.path[method] = pathString;