mirror of
https://github.com/status-im/consul.git
synced 2025-01-31 16:07:58 +00:00
967afbaaf4
Moves all Route/model hook loading to use Outlet components which listen on route change.
29 lines
700 B
JavaScript
29 lines
700 B
JavaScript
import Route from 'consul-ui/routing/route';
|
|
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) {
|
|
this._super(...arguments);
|
|
controller.setProperties(model);
|
|
},
|
|
});
|