git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
Repository: ambari Updated Branches: refs/heads/trunk 2051c64e7 - e1634809f AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e1634809 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e1634809 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e1634809 Branch: refs/heads/trunk Commit: e1634809f0c4c6a6acfe1b2672b4ddfcaf2d5e92 Parents: 2051c64 Author: Yusaku Sako yus...@hortonworks.com Authored: Wed Aug 27 23:09:59 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Wed Aug 27 23:09:59 2014 -0700 -- .../controllers/global/cluster_controller.js| 44 1 file changed, 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e1634809/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 246ad8b..bc09b0a 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -347,50 +347,6 @@ App.ClusterController = Em.Controller.extend({ }, callback) }, - loadAmbariViews: function () { -App.ajax.send({ - name: 'views.info', - sender: this, - success: 'loadAmbariViewsSuccess' -}); - }, - - loadAmbariViewsSuccess: function (data) { -if (data.items.length) { - App.ajax.send({ -name: 'views.instances', -sender: this, -success: 'loadViewInstancesSuccess' - }); -} else { - this.set('ambariViews', []); -} - }, - - loadViewInstancesSuccess: function (data) { -this.set('ambariViews', []); -var self = this; -data.items.forEach(function (view) { - view.versions.forEach(function (version) { -version.instances.forEach(function (instance) { - var current_instance = Em.Object.create({ -iconPath: instance.ViewInstanceInfo.icon_path || /img/ambari-view-default.png, -label: instance.ViewInstanceInfo.label || version.ViewVersionInfo.label || instance.ViewInstanceInfo.view_name, -visible: instance.ViewInstanceInfo.visible || false, -version: instance.ViewInstanceInfo.version, -description: instance.ViewInstanceInfo.description || Em.I18n.t('views.main.instance.noDescription'), -viewName: instance.ViewInstanceInfo.view_name, -instanceName: instance.ViewInstanceInfo.instance_name, -href: instance.ViewInstanceInfo.context_path - }); - if( current_instance.visible){ -self.get('ambariViews').pushObject(current_instance); - } -}, this); - }, this); -}, this); - }, - /** * * @param callback
[28/45] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e1634809 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e1634809 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e1634809 Branch: refs/heads/branch-alerts-dev Commit: e1634809f0c4c6a6acfe1b2672b4ddfcaf2d5e92 Parents: 2051c64 Author: Yusaku Sako yus...@hortonworks.com Authored: Wed Aug 27 23:09:59 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Wed Aug 27 23:09:59 2014 -0700 -- .../controllers/global/cluster_controller.js| 44 1 file changed, 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/e1634809/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 246ad8b..bc09b0a 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -347,50 +347,6 @@ App.ClusterController = Em.Controller.extend({ }, callback) }, - loadAmbariViews: function () { -App.ajax.send({ - name: 'views.info', - sender: this, - success: 'loadAmbariViewsSuccess' -}); - }, - - loadAmbariViewsSuccess: function (data) { -if (data.items.length) { - App.ajax.send({ -name: 'views.instances', -sender: this, -success: 'loadViewInstancesSuccess' - }); -} else { - this.set('ambariViews', []); -} - }, - - loadViewInstancesSuccess: function (data) { -this.set('ambariViews', []); -var self = this; -data.items.forEach(function (view) { - view.versions.forEach(function (version) { -version.instances.forEach(function (instance) { - var current_instance = Em.Object.create({ -iconPath: instance.ViewInstanceInfo.icon_path || /img/ambari-view-default.png, -label: instance.ViewInstanceInfo.label || version.ViewVersionInfo.label || instance.ViewInstanceInfo.view_name, -visible: instance.ViewInstanceInfo.visible || false, -version: instance.ViewInstanceInfo.version, -description: instance.ViewInstanceInfo.description || Em.I18n.t('views.main.instance.noDescription'), -viewName: instance.ViewInstanceInfo.view_name, -instanceName: instance.ViewInstanceInfo.instance_name, -href: instance.ViewInstanceInfo.context_path - }); - if( current_instance.visible){ -self.get('ambariViews').pushObject(current_instance); - } -}, this); - }, this); -}, this); - }, - /** * * @param callback
[30/45] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cd0081c5 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cd0081c5 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cd0081c5 Branch: refs/heads/branch-alerts-dev Commit: cd0081c55f53f87076c191f21648f9f6477119e7 Parents: af67390 Author: Yusaku Sako yus...@hortonworks.com Authored: Wed Aug 27 23:59:35 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Wed Aug 27 23:59:35 2014 -0700 -- .../controllers/global/cluster_controller.js| 44 1 file changed, 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cd0081c5/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 246ad8b..bc09b0a 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -347,50 +347,6 @@ App.ClusterController = Em.Controller.extend({ }, callback) }, - loadAmbariViews: function () { -App.ajax.send({ - name: 'views.info', - sender: this, - success: 'loadAmbariViewsSuccess' -}); - }, - - loadAmbariViewsSuccess: function (data) { -if (data.items.length) { - App.ajax.send({ -name: 'views.instances', -sender: this, -success: 'loadViewInstancesSuccess' - }); -} else { - this.set('ambariViews', []); -} - }, - - loadViewInstancesSuccess: function (data) { -this.set('ambariViews', []); -var self = this; -data.items.forEach(function (view) { - view.versions.forEach(function (version) { -version.instances.forEach(function (instance) { - var current_instance = Em.Object.create({ -iconPath: instance.ViewInstanceInfo.icon_path || /img/ambari-view-default.png, -label: instance.ViewInstanceInfo.label || version.ViewVersionInfo.label || instance.ViewInstanceInfo.view_name, -visible: instance.ViewInstanceInfo.visible || false, -version: instance.ViewInstanceInfo.version, -description: instance.ViewInstanceInfo.description || Em.I18n.t('views.main.instance.noDescription'), -viewName: instance.ViewInstanceInfo.view_name, -instanceName: instance.ViewInstanceInfo.instance_name, -href: instance.ViewInstanceInfo.context_path - }); - if( current_instance.visible){ -self.get('ambariViews').pushObject(current_instance); - } -}, this); - }, this); -}, this); - }, - /** * * @param callback
[12/22] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e7a2679 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e7a2679 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e7a2679 Branch: refs/heads/branch-alerts-dev Commit: 0e7a2679b84d3a15d054a0727abb3d75808eed8c Parents: 6ca9fb8 Author: Yusaku Sako yus...@hortonworks.com Authored: Fri Aug 22 14:34:30 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Fri Aug 22 14:34:30 2014 -0700 -- .../controllers/global/cluster_controller.js| 2 - ambari-web/app/controllers/main.js | 1 + .../app/controllers/main/views_controller.js| 80 +- ambari-web/app/mappers/users_mapper.js | 2 +- ambari-web/app/messages.js | 2 - ambari-web/app/router.js| 108 +++ ambari-web/app/routes/main.js | 22 ambari-web/app/routes/views.js | 53 + ambari-web/app/utils/ajax/ajax.js | 2 +- ambari-web/app/views/main/menu.js | 7 +- ambari-web/app/views/main/views_view.js | 4 +- ambari-web/test/mappers/users_mapper_test.js| 2 +- 12 files changed, 209 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 6a6cdd2..246ad8b 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -22,7 +22,6 @@ App.ClusterController = Em.Controller.extend({ name: 'clusterController', isLoaded: false, ambariProperties: null, - ambariViews: [], clusterDataLoadedPercent: 'width:0', // 0 to 1 isGangliaUrlLoaded: false, @@ -249,7 +248,6 @@ App.ClusterController = Em.Controller.extend({ loadClusterData: function () { var self = this; this.loadAmbariProperties(); -this.loadAmbariViews(); if (!App.get('clusterName')) { return; } http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/main.js -- diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js index 55db450..b5d83c4 100644 --- a/ambari-web/app/controllers/main.js +++ b/ambari-web/app/controllers/main.js @@ -44,6 +44,7 @@ App.MainController = Em.Controller.extend({ */ initialize: function(){ App.router.get('clusterController').loadClusterData(); +App.router.get('mainViewsController').loadAmbariViews(); }, dataLoading: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/main/views_controller.js -- diff --git a/ambari-web/app/controllers/main/views_controller.js b/ambari-web/app/controllers/main/views_controller.js index 5d64da6..687554b 100644 --- a/ambari-web/app/controllers/main/views_controller.js +++ b/ambari-web/app/controllers/main/views_controller.js @@ -21,9 +21,87 @@ var App = require('app'); App.MainViewsController = Em.Controller.extend({ name:'mainViewsController', + isDataLoaded: false, + + ambariViews: [], + + dataLoading: function () { +var viewsController = this; +var dfd = $.Deferred(); +if (this.get('isDataLoaded')) { + dfd.resolve(this.get('ambariViews')); +} else { + var interval = setInterval(function () { +if (viewsController.get('isDataLoaded')) { + dfd.resolve(viewsController.get('ambariViews')); + clearInterval(interval); +} + }, 50); +} +return dfd.promise(); + }, + + + loadAmbariViews: function () { +App.ajax.send({ + name: 'views.info', + sender: this, + success: 'loadAmbariViewsSuccess', + error: 'loadAmbariViewsError' +}); + }, + + loadAmbariViewsSuccess: function (data, opt, params) { +if (data.items.length) { + App.ajax.send({ +name: 'views.instances', +sender: this, +success: 'loadViewInstancesSuccess', +error: 'loadViewInstancesError' + }); +} else { + this.set('ambariViews', []); + this.set('isDataLoaded', true); +} + }, + + loadAmbariViewsError: function () { +this.set('ambariViews', []); +this.set('isDataLoaded', true); + }, + + loadViewInstancesSuccess: function (data, opt, params) {
[10/22] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cb1a5c0b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb1a5c0b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb1a5c0b Branch: refs/heads/branch-alerts-dev Commit: cb1a5c0baa049d670215e76505dd661d105333bb Parents: 3b64d3f Author: Yusaku Sako yus...@hortonworks.com Authored: Fri Aug 22 14:24:14 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Fri Aug 22 14:24:14 2014 -0700 -- ambari-web/app/routes/views.js | 53 + 1 file changed, 53 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cb1a5c0b/ambari-web/app/routes/views.js -- diff --git a/ambari-web/app/routes/views.js b/ambari-web/app/routes/views.js new file mode 100644 index 000..d72dbf0 --- /dev/null +++ b/ambari-web/app/routes/views.js @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); +var stringUtils = require('utils/string_utils'); + +module.exports = Em.Route.extend({ + route: '/views', + enter: function (router) { +router.getAuthenticated().done(function (loggedIn) { + if (loggedIn) { +router.get('mainViewsController').loadAmbariViews(); + } else { +Em.run.next(function () { + router.transitionTo('login'); +}); + } +}); + }, + index: Em.Route.extend({ +route: '/', +connectOutlets: function (router) { + router.get('mainViewsController').dataLoading().done(function() { +router.get('applicationController').connectOutlet('mainViews'); + }); +} + }), + viewDetails: Em.Route.extend({ +route: '/:viewName/:version/:instanceName', +connectOutlets: function (router, params) { + // find and set content for `mainViewsDetails` and associated controller + router.get('mainViewsController').dataLoading().done(function() { +router.get('applicationController').connectOutlet('mainViewsDetails', App.router.get('mainViewsController.ambariViews') + .findProperty('href', ['/views', params.viewName, params.version, params.instanceName].join('/'))); + }); +} + }) +});
[26/46] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b750cd8f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b750cd8f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b750cd8f Branch: refs/heads/branch-alerts-dev Commit: b750cd8f22443cfb77e7849f6fe42dff400a6200 Parents: 20519ec Author: Yusaku Sako yus...@hortonworks.com Authored: Wed Aug 20 19:17:06 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Wed Aug 20 19:22:30 2014 -0700 -- ambari-web/app/controllers.js | 1 - .../controllers/global/cluster_controller.js| 44 ambari-web/app/controllers/main.js | 1 + .../app/controllers/main/views_controller.js| 80 +- ambari-web/app/mappers/users_mapper.js | 2 +- ambari-web/app/messages.js | 2 - ambari-web/app/router.js| 108 +++ ambari-web/app/routes/main.js | 22 ambari-web/app/routes/views.js | 53 + ambari-web/app/utils/ajax/ajax.js | 2 +- ambari-web/app/views/main/menu.js | 7 +- ambari-web/app/views/main/views_view.js | 4 +- ambari-web/test/mappers/users_mapper_test.js| 2 +- 13 files changed, 209 insertions(+), 119 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b750cd8f/ambari-web/app/controllers.js -- diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js index 063af6a..c4a1001 100644 --- a/ambari-web/app/controllers.js +++ b/ambari-web/app/controllers.js @@ -54,7 +54,6 @@ require('controllers/main/admin/highAvailability/resourceManager/step4_controlle require('controllers/main/admin/repositories'); require('controllers/main/admin/stack_upgrade_controller'); require('controllers/main/admin/serviceAccounts_controller'); -require('controllers/main/admin/access_controller'); require('controllers/main/admin/advanced'); require('utils/polling'); require('controllers/main/admin/security'); http://git-wip-us.apache.org/repos/asf/ambari/blob/b750cd8f/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index d612039..3d14754 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -22,7 +22,6 @@ App.ClusterController = Em.Controller.extend({ name: 'clusterController', isLoaded: false, ambariProperties: null, - ambariViews: [], clusterDataLoadedPercent: 'width:0', // 0 to 1 isGangliaUrlLoaded: false, @@ -249,7 +248,6 @@ App.ClusterController = Em.Controller.extend({ loadClusterData: function () { var self = this; this.loadAmbariProperties(); -this.loadAmbariViews(); if (!App.get('clusterName')) { return; } @@ -349,48 +347,6 @@ App.ClusterController = Em.Controller.extend({ }, callback) }, - loadAmbariViews: function () { -App.ajax.send({ - name: 'views.info', - sender: this, - success: 'loadAmbariViewsSuccess' -}); - }, - - loadAmbariViewsSuccess: function (data) { -if (data.items.length) { - App.ajax.send({ -name: 'views.instances', -sender: this, -success: 'loadViewInstancesSuccess' - }); -} else { - this.set('ambariViews', []); -} - }, - - loadViewInstancesSuccess: function (data) { -this.set('ambariViews', []); -var self = this; -data.items.forEach(function (view) { - view.versions.forEach(function (version) { -version.instances.forEach(function (instance) { - var current_instance = Em.Object.create({ -iconPath: instance.ViewInstanceInfo.icon_path || /img/ambari-view-default.png, -label: instance.ViewInstanceInfo.label || version.ViewVersionInfo.label || instance.ViewInstanceInfo.view_name, -visible: instance.ViewInstanceInfo.visible || false, -version: instance.ViewInstanceInfo.version, -description: instance.ViewInstanceInfo.description || Em.I18n.t('views.main.instance.noDescription'), -viewName: instance.ViewInstanceInfo.view_name, -instanceName: instance.ViewInstanceInfo.instance_name, -href: instance.ViewInstanceInfo.context_path - }); - self.get('ambariViews').pushObject(current_instance); -}, this); - }, this); -
git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
Repository: ambari Updated Branches: refs/heads/trunk 3b64d3f7c - cb1a5c0ba AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cb1a5c0b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cb1a5c0b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cb1a5c0b Branch: refs/heads/trunk Commit: cb1a5c0baa049d670215e76505dd661d105333bb Parents: 3b64d3f Author: Yusaku Sako yus...@hortonworks.com Authored: Fri Aug 22 14:24:14 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Fri Aug 22 14:24:14 2014 -0700 -- ambari-web/app/routes/views.js | 53 + 1 file changed, 53 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/cb1a5c0b/ambari-web/app/routes/views.js -- diff --git a/ambari-web/app/routes/views.js b/ambari-web/app/routes/views.js new file mode 100644 index 000..d72dbf0 --- /dev/null +++ b/ambari-web/app/routes/views.js @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); +var stringUtils = require('utils/string_utils'); + +module.exports = Em.Route.extend({ + route: '/views', + enter: function (router) { +router.getAuthenticated().done(function (loggedIn) { + if (loggedIn) { +router.get('mainViewsController').loadAmbariViews(); + } else { +Em.run.next(function () { + router.transitionTo('login'); +}); + } +}); + }, + index: Em.Route.extend({ +route: '/', +connectOutlets: function (router) { + router.get('mainViewsController').dataLoading().done(function() { +router.get('applicationController').connectOutlet('mainViews'); + }); +} + }), + viewDetails: Em.Route.extend({ +route: '/:viewName/:version/:instanceName', +connectOutlets: function (router, params) { + // find and set content for `mainViewsDetails` and associated controller + router.get('mainViewsController').dataLoading().done(function() { +router.get('applicationController').connectOutlet('mainViewsDetails', App.router.get('mainViewsController.ambariViews') + .findProperty('href', ['/views', params.viewName, params.version, params.instanceName].join('/'))); + }); +} + }) +});
[2/2] git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e7a2679 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e7a2679 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e7a2679 Branch: refs/heads/trunk Commit: 0e7a2679b84d3a15d054a0727abb3d75808eed8c Parents: 6ca9fb8 Author: Yusaku Sako yus...@hortonworks.com Authored: Fri Aug 22 14:34:30 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Fri Aug 22 14:34:30 2014 -0700 -- .../controllers/global/cluster_controller.js| 2 - ambari-web/app/controllers/main.js | 1 + .../app/controllers/main/views_controller.js| 80 +- ambari-web/app/mappers/users_mapper.js | 2 +- ambari-web/app/messages.js | 2 - ambari-web/app/router.js| 108 +++ ambari-web/app/routes/main.js | 22 ambari-web/app/routes/views.js | 53 + ambari-web/app/utils/ajax/ajax.js | 2 +- ambari-web/app/views/main/menu.js | 7 +- ambari-web/app/views/main/views_view.js | 4 +- ambari-web/test/mappers/users_mapper_test.js| 2 +- 12 files changed, 209 insertions(+), 76 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index 6a6cdd2..246ad8b 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -22,7 +22,6 @@ App.ClusterController = Em.Controller.extend({ name: 'clusterController', isLoaded: false, ambariProperties: null, - ambariViews: [], clusterDataLoadedPercent: 'width:0', // 0 to 1 isGangliaUrlLoaded: false, @@ -249,7 +248,6 @@ App.ClusterController = Em.Controller.extend({ loadClusterData: function () { var self = this; this.loadAmbariProperties(); -this.loadAmbariViews(); if (!App.get('clusterName')) { return; } http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/main.js -- diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js index 55db450..b5d83c4 100644 --- a/ambari-web/app/controllers/main.js +++ b/ambari-web/app/controllers/main.js @@ -44,6 +44,7 @@ App.MainController = Em.Controller.extend({ */ initialize: function(){ App.router.get('clusterController').loadClusterData(); +App.router.get('mainViewsController').loadAmbariViews(); }, dataLoading: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/0e7a2679/ambari-web/app/controllers/main/views_controller.js -- diff --git a/ambari-web/app/controllers/main/views_controller.js b/ambari-web/app/controllers/main/views_controller.js index 5d64da6..687554b 100644 --- a/ambari-web/app/controllers/main/views_controller.js +++ b/ambari-web/app/controllers/main/views_controller.js @@ -21,9 +21,87 @@ var App = require('app'); App.MainViewsController = Em.Controller.extend({ name:'mainViewsController', + isDataLoaded: false, + + ambariViews: [], + + dataLoading: function () { +var viewsController = this; +var dfd = $.Deferred(); +if (this.get('isDataLoaded')) { + dfd.resolve(this.get('ambariViews')); +} else { + var interval = setInterval(function () { +if (viewsController.get('isDataLoaded')) { + dfd.resolve(viewsController.get('ambariViews')); + clearInterval(interval); +} + }, 50); +} +return dfd.promise(); + }, + + + loadAmbariViews: function () { +App.ajax.send({ + name: 'views.info', + sender: this, + success: 'loadAmbariViewsSuccess', + error: 'loadAmbariViewsError' +}); + }, + + loadAmbariViewsSuccess: function (data, opt, params) { +if (data.items.length) { + App.ajax.send({ +name: 'views.instances', +sender: this, +success: 'loadViewInstancesSuccess', +error: 'loadViewInstancesError' + }); +} else { + this.set('ambariViews', []); + this.set('isDataLoaded', true); +} + }, + + loadAmbariViewsError: function () { +this.set('ambariViews', []); +this.set('isDataLoaded', true); + }, + + loadViewInstancesSuccess: function (data, opt, params) { +
git commit: AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku)
Repository: ambari Updated Branches: refs/heads/trunk 20519ec85 - b750cd8f2 AMBARI-6967. Admin View: default login behavior (route to Admin View, Cluster Dashboard, or Views Landing page). (yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b750cd8f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b750cd8f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b750cd8f Branch: refs/heads/trunk Commit: b750cd8f22443cfb77e7849f6fe42dff400a6200 Parents: 20519ec Author: Yusaku Sako yus...@hortonworks.com Authored: Wed Aug 20 19:17:06 2014 -0700 Committer: Yusaku Sako yus...@hortonworks.com Committed: Wed Aug 20 19:22:30 2014 -0700 -- ambari-web/app/controllers.js | 1 - .../controllers/global/cluster_controller.js| 44 ambari-web/app/controllers/main.js | 1 + .../app/controllers/main/views_controller.js| 80 +- ambari-web/app/mappers/users_mapper.js | 2 +- ambari-web/app/messages.js | 2 - ambari-web/app/router.js| 108 +++ ambari-web/app/routes/main.js | 22 ambari-web/app/routes/views.js | 53 + ambari-web/app/utils/ajax/ajax.js | 2 +- ambari-web/app/views/main/menu.js | 7 +- ambari-web/app/views/main/views_view.js | 4 +- ambari-web/test/mappers/users_mapper_test.js| 2 +- 13 files changed, 209 insertions(+), 119 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/b750cd8f/ambari-web/app/controllers.js -- diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js index 063af6a..c4a1001 100644 --- a/ambari-web/app/controllers.js +++ b/ambari-web/app/controllers.js @@ -54,7 +54,6 @@ require('controllers/main/admin/highAvailability/resourceManager/step4_controlle require('controllers/main/admin/repositories'); require('controllers/main/admin/stack_upgrade_controller'); require('controllers/main/admin/serviceAccounts_controller'); -require('controllers/main/admin/access_controller'); require('controllers/main/admin/advanced'); require('utils/polling'); require('controllers/main/admin/security'); http://git-wip-us.apache.org/repos/asf/ambari/blob/b750cd8f/ambari-web/app/controllers/global/cluster_controller.js -- diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js index d612039..3d14754 100644 --- a/ambari-web/app/controllers/global/cluster_controller.js +++ b/ambari-web/app/controllers/global/cluster_controller.js @@ -22,7 +22,6 @@ App.ClusterController = Em.Controller.extend({ name: 'clusterController', isLoaded: false, ambariProperties: null, - ambariViews: [], clusterDataLoadedPercent: 'width:0', // 0 to 1 isGangliaUrlLoaded: false, @@ -249,7 +248,6 @@ App.ClusterController = Em.Controller.extend({ loadClusterData: function () { var self = this; this.loadAmbariProperties(); -this.loadAmbariViews(); if (!App.get('clusterName')) { return; } @@ -349,48 +347,6 @@ App.ClusterController = Em.Controller.extend({ }, callback) }, - loadAmbariViews: function () { -App.ajax.send({ - name: 'views.info', - sender: this, - success: 'loadAmbariViewsSuccess' -}); - }, - - loadAmbariViewsSuccess: function (data) { -if (data.items.length) { - App.ajax.send({ -name: 'views.instances', -sender: this, -success: 'loadViewInstancesSuccess' - }); -} else { - this.set('ambariViews', []); -} - }, - - loadViewInstancesSuccess: function (data) { -this.set('ambariViews', []); -var self = this; -data.items.forEach(function (view) { - view.versions.forEach(function (version) { -version.instances.forEach(function (instance) { - var current_instance = Em.Object.create({ -iconPath: instance.ViewInstanceInfo.icon_path || /img/ambari-view-default.png, -label: instance.ViewInstanceInfo.label || version.ViewVersionInfo.label || instance.ViewInstanceInfo.view_name, -visible: instance.ViewInstanceInfo.visible || false, -version: instance.ViewInstanceInfo.version, -description: instance.ViewInstanceInfo.description || Em.I18n.t('views.main.instance.noDescription'), -viewName: instance.ViewInstanceInfo.view_name, -instanceName: instance.ViewInstanceInfo.instance_name, -href: instance.ViewInstanceInfo.context_path - }); -