Repository: ambari Updated Branches: refs/heads/trunk 56b177608 -> 1eec850c7
AMBARI-5239. Service config page generates js-error when accessed directly. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1eec850c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1eec850c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1eec850c Branch: refs/heads/trunk Commit: 1eec850c76652921e66c0d3a5c042d1af142f7a5 Parents: 56b1776 Author: Oleg Nechiporenko <[email protected]> Authored: Thu Mar 27 16:45:41 2014 +0200 Committer: Oleg Nechiporenko <[email protected]> Committed: Thu Mar 27 16:45:41 2014 +0200 ---------------------------------------------------------------------- ambari-web/app/routes/main.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1eec850c/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 2b766ab..1351f0e 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -600,17 +600,22 @@ module.exports = Em.Route.extend({ services: Em.Route.extend({ route: '/services', - index: Ember.Route.extend({ + index: Em.Route.extend({ route: '/', enter: function (router) { - Ember.run.next(function () { + Em.run.next(function () { var controller = router.get('mainController'); controller.dataLoading().done(function () { var service = router.get('mainServiceItemController.content'); if (!service || !service.get('isLoaded')) { service = App.Service.find().objectAt(0); // getting the first service to display } - router.transitionTo('service.summary', service); + if (service.get('routeToConfigs')) { + router.transitionTo('service.configs', service); + } + else { + router.transitionTo('service.summary', service); + } }); }); } @@ -650,12 +655,19 @@ module.exports = Em.Route.extend({ route: '/configs', connectOutlets: function (router, context) { var item = router.get('mainServiceItemController.content'); - if (item.get('isConfigurable')) { - router.get('mainServiceItemController').connectOutlet('mainServiceInfoConfigs', item); + //if service is not existed then route to default service + if (item.get('isLoaded')) { + if (item.get('isConfigurable')) { + router.get('mainServiceItemController').connectOutlet('mainServiceInfoConfigs', item); + } + else { + // if service doesn't have configs redirect to summary + router.transitionTo('summary'); + } } else { - // if service doesn't have configs redirect to summary - router.transitionTo('summary'); + item.set('routeToConfigs', true); + router.transitionTo('services.index'); } }, unroutePath: function (router, context) {
