2020-10-01 08:33:22 +00:00
|
|
|
import Route from 'consul-ui/routing/route';
|
2020-04-08 09:56:36 +00:00
|
|
|
import { get } from '@ember/object';
|
|
|
|
|
|
|
|
export default Route.extend({
|
|
|
|
model: function() {
|
|
|
|
const parent = this.routeName
|
|
|
|
.split('.')
|
|
|
|
.slice(0, -1)
|
|
|
|
.join('.');
|
|
|
|
return this.modelFor(parent);
|
|
|
|
},
|
|
|
|
afterModel: function(model, transition) {
|
|
|
|
if (
|
|
|
|
get(model, 'item.Kind') !== 'connect-proxy' ||
|
|
|
|
get(model, 'item.Proxy.Expose.Paths.length') < 1
|
|
|
|
) {
|
|
|
|
const parent = this.routeName
|
|
|
|
.split('.')
|
|
|
|
.slice(0, -1)
|
|
|
|
.join('.');
|
|
|
|
this.replaceWith(parent);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setupController: function(controller, model) {
|
2020-10-01 08:33:22 +00:00
|
|
|
this._super(...arguments);
|
2020-04-08 09:56:36 +00:00
|
|
|
controller.setProperties(model);
|
|
|
|
},
|
|
|
|
});
|