diff --git a/components/form/InputWithSelect.vue b/components/form/InputWithSelect.vue index bf7185eed5..2178d66f29 100644 --- a/components/form/InputWithSelect.vue +++ b/components/form/InputWithSelect.vue @@ -62,7 +62,7 @@ export default { /> @@ -223,6 +224,7 @@ export default { :reduce="opt=>opt.value" :clearable="false" class="inline" + label="value" @input="update" /> @@ -236,6 +238,7 @@ export default { placeholder="Select a version" :clearable="false" class="inline" + label="value" :reduce="opt=>opt.value" @input="update" /> diff --git a/edit/rio.cattle.io.v1.externalservice.vue b/edit/rio.cattle.io.v1.externalservice.vue index 0e902d85a1..383576d430 100644 --- a/edit/rio.cattle.io.v1.externalservice.vue +++ b/edit/rio.cattle.io.v1.externalservice.vue @@ -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; + } + } }; @@ -72,7 +79,7 @@ export default {
- + diff --git a/edit/rio.cattle.io.v1.router/Match.vue b/edit/rio.cattle.io.v1.router/Match.vue index 16607b25cc..ea56f4973d 100644 --- a/edit/rio.cattle.io.v1.router/Match.vue +++ b/edit/rio.cattle.io.v1.router/Match.vue @@ -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;