mirror of https://github.com/hashicorp/consul
ui: Defer requesting gateway related services until the tab is visible (#8803)
* ui: Defer requesting gateway related services until the tab is visible * Extend one route with the other as they are the same thing dsatawisepull/8826/head
parent
81baad4038
commit
dfe57406de
|
@ -6,7 +6,7 @@ import { get } from '@ember/object';
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
data: service('data-source/service'),
|
data: service('data-source/service'),
|
||||||
settings: service('settings'),
|
settings: service('settings'),
|
||||||
model: function(params, transition = {}) {
|
model: function(params, transition) {
|
||||||
const dc = this.modelFor('dc').dc.Name;
|
const dc = this.modelFor('dc').dc.Name;
|
||||||
const nspace = this.modelFor('nspace').nspace.substr(1);
|
const nspace = this.modelFor('nspace').nspace.substr(1);
|
||||||
return hash({
|
return hash({
|
||||||
|
@ -19,32 +19,19 @@ export default Route.extend({
|
||||||
urls: this.settings.findBySlug('urls'),
|
urls: this.settings.findBySlug('urls'),
|
||||||
chain: null,
|
chain: null,
|
||||||
proxies: [],
|
proxies: [],
|
||||||
})
|
}).then(model => {
|
||||||
.then(model => {
|
return ['connect-proxy', 'mesh-gateway', 'ingress-gateway', 'terminating-gateway'].includes(
|
||||||
return ['connect-proxy', 'mesh-gateway', 'ingress-gateway', 'terminating-gateway'].includes(
|
get(model, 'items.firstObject.Service.Kind')
|
||||||
get(model, 'items.firstObject.Service.Kind')
|
)
|
||||||
)
|
? model
|
||||||
? model
|
: hash({
|
||||||
: hash({
|
...model,
|
||||||
...model,
|
chain: this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`),
|
||||||
chain: this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`),
|
proxies: this.data.source(
|
||||||
proxies: this.data.source(
|
uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}`
|
||||||
uri => uri`/${nspace}/${dc}/proxies/for-service/${params.name}`
|
),
|
||||||
),
|
});
|
||||||
});
|
});
|
||||||
})
|
|
||||||
.then(model => {
|
|
||||||
return ['ingress-gateway', 'terminating-gateway'].includes(
|
|
||||||
get(model, 'items.firstObject.Service.Kind')
|
|
||||||
)
|
|
||||||
? hash({
|
|
||||||
...model,
|
|
||||||
gatewayServices: this.data.source(
|
|
||||||
uri => uri`/${nspace}/${dc}/gateways/for-service/${params.name}`
|
|
||||||
),
|
|
||||||
})
|
|
||||||
: model;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
|
@ -1,12 +1,22 @@
|
||||||
import Route from 'consul-ui/routing/route';
|
import Route from 'consul-ui/routing/route';
|
||||||
|
import { inject as service } from '@ember/service';
|
||||||
|
import { hash } from 'rsvp';
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
|
data: service('data-source/service'),
|
||||||
model: function() {
|
model: function() {
|
||||||
|
const dc = this.modelFor('dc').dc.Name;
|
||||||
|
const nspace = this.modelFor('nspace').nspace.substr(1);
|
||||||
const parent = this.routeName
|
const parent = this.routeName
|
||||||
.split('.')
|
.split('.')
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
.join('.');
|
.join('.');
|
||||||
return this.modelFor(parent);
|
const name = this.modelFor(parent).name;
|
||||||
|
return hash({
|
||||||
|
dc: dc,
|
||||||
|
nspace: nspace,
|
||||||
|
gatewayServices: this.data.source(uri => uri`/${nspace}/${dc}/gateways/for-service/${name}`),
|
||||||
|
});
|
||||||
},
|
},
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
import Route from 'consul-ui/routing/route';
|
import Route from './services';
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
model: function() {
|
templateName: 'dc/services/show/upstreams',
|
||||||
const parent = this.routeName
|
|
||||||
.split('.')
|
|
||||||
.slice(0, -1)
|
|
||||||
.join('.');
|
|
||||||
return this.modelFor(parent);
|
|
||||||
},
|
|
||||||
setupController: function(controller, model) {
|
|
||||||
this._super(...arguments);
|
|
||||||
controller.setProperties(model);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
<EventSource @src={{chain}} />
|
<EventSource @src={{chain}} />
|
||||||
<EventSource @src={{intentions}} />
|
<EventSource @src={{intentions}} />
|
||||||
<EventSource @src={{proxies}} />
|
<EventSource @src={{proxies}} />
|
||||||
<EventSource @src={{gatewayServices}} />
|
|
||||||
{{title item.Service.Service}}
|
{{title item.Service.Service}}
|
||||||
<AppView>
|
<AppView>
|
||||||
<BlockSlot @name="notification" as |status type|>
|
<BlockSlot @name="notification" as |status type|>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div id="services" class="tab-section">
|
<EventSource @src={{gatewayServices}} />
|
||||||
|
<div class="tab-section">
|
||||||
<div role="tabpanel">
|
<div role="tabpanel">
|
||||||
{{#let (hash
|
{{#let (hash
|
||||||
instances=(if instance (split instance ',') undefined)
|
instances=(if instance (split instance ',') undefined)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<div id="upstreams" class="tab-section">
|
<EventSource @src={{gatewayServices}} />
|
||||||
|
<div class="tab-section">
|
||||||
<div role="tabpanel">
|
<div role="tabpanel">
|
||||||
{{#let (hash
|
{{#let (hash
|
||||||
instances=(if instance (split instance ',') undefined)
|
instances=(if instance (split instance ',') undefined)
|
||||||
|
|
Loading…
Reference in New Issue