diff --git a/app/app.js b/app/app.js index 892f6f7a41db025b77febd1628d844d62c55aace..f9cc0839d6991c8c3732ab9fa55ce5fca6bcc471 100644 --- a/app/app.js +++ b/app/app.js @@ -1,6 +1,6 @@ import Ember from 'ember'; import EmberData from 'ember-data'; -import Resolver from './resolver'; +import Resolver from './resolver'; // uses ember-route-alias import loadInitializers from 'ember-load-initializers'; import config from './config/environment'; diff --git a/app/resolver.js b/app/resolver.js index 2fb563d6c0488f41bec454fe1fa7c229975a58df..eaf45787fbaa7df1aefafac3bf31096ee3171549 100644 --- a/app/resolver.js +++ b/app/resolver.js @@ -1,3 +1,4 @@ import Resolver from 'ember-resolver'; +import RouteAliasResolver from 'ember-route-alias/mixins/route-alias-resolver'; -export default Resolver; +export default Resolver.extend(RouteAliasResolver); diff --git a/app/router.js b/app/router.js index b5ef63529b973fbce2fb6753e2a98efbd22bd295..80e1d9a348a99335a8948dccd147baf0a1256383 100644 --- a/app/router.js +++ b/app/router.js @@ -13,6 +13,8 @@ Router.map(function() { }); }); + this.alias('architectures', '/architectures', 'deployments'); // uses ember-route-alias, inherits nested routes + this.route('not-found', { path: '*path' }); }); diff --git a/app/routes/deployments/single.js b/app/routes/deployments/single.js index 82d600017509792fffc5c15a6f66e5891419a79e..27a006a5665ebaf4fc11748f974f08086e9de82b 100644 --- a/app/routes/deployments/single.js +++ b/app/routes/deployments/single.js @@ -14,7 +14,10 @@ export default Ember.Route.extend({ * update whenever new records are pushed into the store. * The controller can observe this. * Also note that since we changed the behavior of findAll() to use the systemId - * Ember will probably also update for other systems. These are filtered in the controller + * Ember will probably also update for other systems. These are filtered in the controller. + * + * We also load all the data, so that the transformation strategies can assume that the whole + * meta model is cached. This also allowes that the architecture view is only an alias */ const load = (type) => this.store.findAll(type); @@ -44,7 +47,7 @@ export default Ember.Route.extend({ * passing object parameters to transitionTo which break with the current path variables. * Otherwise this would use transitionTo('deployments.single.details', {...}) */ - const url = this.router.generate('deployments.single.details', { + const url = this.router.generate(`${this.get('routeName')}.details`, { // use routeName to support architectures alias systemId: this.get('session.systemId'), entityType, entityId diff --git a/package.json b/package.json index 6e11d03d89a567e86f56cc3a9eb8f275671d3022..26a5e728f0844242610caf1dea160f699c2cd8e1 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "ember-load-initializers": "^0.5.0", "ember-resolver": "^2.0.3", "ember-route-action-helper": "0.3.2", + "ember-route-alias": "0.1.4", "ember-truth-helpers": "1.2.0", "loader.js": "^4.0.0", "lodash": "^4.11.1",