You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/02/12 19:14:13 UTC

git commit: AMBARI-4637 The user is not always redirected to the login page when unauthenticated. (atkach)

Updated Branches:
  refs/heads/trunk 15fc0eca3 -> 2213e103b


AMBARI-4637 The user is not always redirected to the login page when unauthenticated. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2213e103
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2213e103
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2213e103

Branch: refs/heads/trunk
Commit: 2213e103b07e0951891a0df57d4db78a86cbd49a
Parents: 15fc0ec
Author: atkach <at...@hortonworks.com>
Authored: Wed Feb 12 20:14:09 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Wed Feb 12 20:14:09 2014 +0200

----------------------------------------------------------------------
 ambari-web/app/models/cluster_states.js           | 12 +++++++-----
 ambari-web/app/router.js                          |  7 +++++++
 ambari-web/app/routes/add_host_routes.js          |  4 +++-
 ambari-web/app/routes/add_security.js             |  2 +-
 ambari-web/app/routes/add_service_routes.js       |  2 +-
 ambari-web/app/routes/high_availability_routes.js |  2 +-
 ambari-web/app/routes/main.js                     |  2 +-
 ambari-web/app/routes/reassign_master_routes.js   |  4 +++-
 ambari-web/app/routes/rollbackHA_routes.js        |  2 +-
 ambari-web/app/routes/stack_upgrade.js            |  4 +++-
 10 files changed, 28 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/models/cluster_states.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/cluster_states.js b/ambari-web/app/models/cluster_states.js
index f075111..a1f3bc2 100644
--- a/ambari-web/app/models/cluster_states.js
+++ b/ambari-web/app/models/cluster_states.js
@@ -180,13 +180,15 @@ App.clusterStatus = Ember.Object.create({
   },
   clusterStatusErrorCallBack: function(request, ajaxOptions, error, opt) {
     console.log("ERROR");
-    if(opt.newValue.errorCallBack) {
-      opt.newValue.errorCallBack();
-    } else {
-      var doc = $.parseXML(request.responseText);
-      var msg = 'Error ' + (request.status) + ' ';
+    var msg, doc;
+    try {
+      msg = 'Error ' + (request.status) + ' ';
+      doc = $.parseXML(request.responseText);
       msg += $(doc).find("body p").text();
+    } catch (e) {
+      msg += JSON.parse(request.responseText).message;
     }
+
     App.ModalPopup.show({
       header: Em.I18n.t('common.error'),
       secondary: false,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index b3a196d..efe6f3f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -17,6 +17,13 @@
  */
 
 var App = require('app');
+
+App.WizardRoute = Em.Route.extend({
+  isRoutable: function() {
+    return (typeof this.get('route') === 'string' && App.router.getAuthenticated());
+  }.property().volatile()
+});
+
 App.Router = Em.Router.extend({
 
   enableLogging: true,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/add_host_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_host_routes.js b/ambari-web/app/routes/add_host_routes.js
index 53dca53..5eb42a4 100644
--- a/ambari-web/app/routes/add_host_routes.js
+++ b/ambari-web/app/routes/add_host_routes.js
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 
-module.exports = Em.Route.extend({
+var App = require('app');
+
+module.exports = App.WizardRoute.extend({
   route: '/hosts/add',
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/add_security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
index b9e7796..f5a97de 100644
--- a/ambari-web/app/routes/add_security.js
+++ b/ambari-web/app/routes/add_security.js
@@ -17,7 +17,7 @@
  */
 var App = require('app');
 
-module.exports = Em.Route.extend({
+module.exports = App.WizardRoute.extend({
   route: '/addSecurity',
   enter: function (router) {
     console.log('in /security/add:enter');

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/add_service_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_service_routes.js b/ambari-web/app/routes/add_service_routes.js
index 521b2a9..54fa0ff 100644
--- a/ambari-web/app/routes/add_service_routes.js
+++ b/ambari-web/app/routes/add_service_routes.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-module.exports = Em.Route.extend({
+module.exports = App.WizardRoute.extend({
   route: '/services/add',
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/high_availability_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/high_availability_routes.js b/ambari-web/app/routes/high_availability_routes.js
index 4cd755d..5a865ea 100644
--- a/ambari-web/app/routes/high_availability_routes.js
+++ b/ambari-web/app/routes/high_availability_routes.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-module.exports = Em.Route.extend({
+module.exports = App.WizardRoute.extend({
   route: '/highAvailability/enable',
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index d9c92c9..6d187c8 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -113,7 +113,7 @@ module.exports = Em.Route.extend({
 
   jobs : Em.Route.extend({
     route : '/jobs',
-    enter: function () {
+    enter: function (router) {
       if(!App.db.getShowJobsForNonAdmin() && !App.get('isAdmin')){
         Em.run.next(function () {
           router.transitionTo('main.dashboard');

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/reassign_master_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js
index 404b98a..6ff239e 100644
--- a/ambari-web/app/routes/reassign_master_routes.js
+++ b/ambari-web/app/routes/reassign_master_routes.js
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 
-module.exports = Em.Route.extend({
+var App = require('app');
+
+module.exports = App.WizardRoute.extend({
   route: '/reassign',
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/rollbackHA_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/rollbackHA_routes.js b/ambari-web/app/routes/rollbackHA_routes.js
index 7f2fe0a..33944a2 100644
--- a/ambari-web/app/routes/rollbackHA_routes.js
+++ b/ambari-web/app/routes/rollbackHA_routes.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-module.exports = Em.Route.extend({
+module.exports = App.WizardRoute.extend({
   route: '/highAvailability/rollbackHA',
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2213e103/ambari-web/app/routes/stack_upgrade.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/stack_upgrade.js b/ambari-web/app/routes/stack_upgrade.js
index f5d0205..3d7c4bf 100644
--- a/ambari-web/app/routes/stack_upgrade.js
+++ b/ambari-web/app/routes/stack_upgrade.js
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 
-module.exports = Em.Route.extend({
+var App = require('app');
+
+module.exports = App.WizardRoute.extend({
   route: 'admin/cluster/upgrade',
 
   enter: function (router) {