From f78bc37ba8b8a6087eb7a303367885d84fc23d5a Mon Sep 17 00:00:00 2001 From: Mathis Neumann <mathis@simpletechs.net> Date: Wed, 20 Jul 2016 13:03:30 +0200 Subject: [PATCH] use /architectures as alias for /deployments --- app/app.js | 2 +- app/resolver.js | 3 ++- app/router.js | 2 ++ app/routes/deployments/single.js | 7 +++++-- package.json | 1 + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/app.js b/app/app.js index 892f6f7..f9cc083 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 2fb563d..eaf4578 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 b5ef635..80e1d9a 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 82d6000..27a006a 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 6e11d03..26a5e72 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", -- GitLab