ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject ambari git commit: AMBARI-11359. Create/Edit widget: Wizard doesn't navigate to the current wizard page when another window is open. (jaimin)
Date Tue, 26 May 2015 21:17:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 8ac658307 -> 5be5b138b


AMBARI-11359. Create/Edit widget: Wizard doesn't navigate to the current wizard page when
another window is open. (jaimin)


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

Branch: refs/heads/trunk
Commit: 5be5b138b835671844844ebd226c22d1d7d18d1f
Parents: 8ac6583
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Tue May 26 14:16:56 2015 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Tue May 26 14:17:04 2015 -0700

----------------------------------------------------------------------
 .../service/widgets/create/wizard_controller.js |  2 +-
 ambari-web/app/data/controller_route.js         | 76 ++++++++++++++++++++
 ambari-web/app/router.js                        | 35 ++-------
 3 files changed, 84 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5be5b138/ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js b/ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js
index 532ee7a..b7d1d5f 100644
--- a/ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js
+++ b/ambari-web/app/controllers/main/service/widgets/create/wizard_controller.js
@@ -161,7 +161,7 @@ App.WidgetWizardController = App.WizardController.extend({
   saveClusterStatus: function (clusterStatus) {
     App.clusterStatus.setClusterStatus({
       clusterState: clusterStatus,
-      wizardControllerName: 'widgetWizardController',
+      wizardControllerName: this.get('name'),
       localdb: App.db.data
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/5be5b138/ambari-web/app/data/controller_route.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/controller_route.js b/ambari-web/app/data/controller_route.js
new file mode 100644
index 0000000..b324b51
--- /dev/null
+++ b/ambari-web/app/data/controller_route.js
@@ -0,0 +1,76 @@
+/**
+ * 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');
+
+/**
+ * This is required to reroute directly to the wizard controller. This is desired in following
scenarios
+ * 1. A wizard is being navigated and another browser window is simultaneously opened by
the same or another user
+ * 2. browser window crashed while navigating through any wizard and a new browser window
is opened to complete the wizard
+ * @type {Array} Array of Objects
+ */
+module.exports = [
+  {
+    wizardControllerName: App.router.get('addHostController.name'),
+    route: 'main.hostAdd'
+  },
+  {
+    wizardControllerName: App.router.get('addSecurityController.name'),
+    route: 'main.admin.adminSecurity'
+  },
+  {
+    wizardControllerName: App.router.get('mainAdminSecurityDisableController.name'),
+    route: 'main.admin.adminSecurity'
+  },
+  {
+    wizardControllerName: App.router.get('kerberosWizardController.name'),
+    route: 'main.admin.adminKerberos.adminAddKerberos'
+  },
+  {
+    wizardControllerName: App.router.get('addServiceController.name'),
+    route: 'main.serviceAdd'
+  },
+  {
+    wizardControllerName: App.router.get('reassignMasterController.name'),
+    route: 'main.reassign'
+  },
+  {
+    wizardControllerName: App.router.get('highAvailabilityWizardController.name'),
+    route: 'main.services.enableHighAvailability'
+  },
+  {
+    wizardControllerName: App.router.get('rMHighAvailabilityWizardController.name'),
+    route: 'main.services.enableRMHighAvailability'
+  },
+  {
+    wizardControllerName: App.router.get('rollbackHighAvailabilityWizardController.name'),
+    route: 'main.services.rollbackHighAvailability'
+  },
+  {
+    wizardControllerName: App.router.get('mainAdminStackAndUpgradeController.name'),
+    route: 'main.admin.stackAndUpgrade'
+  },
+  {
+    wizardControllerName: App.router.get('widgetWizardController.name'),
+    route: 'main.createWidget'
+  },
+  {
+    wizardControllerName: App.router.get('widgetEditController.name'),
+    route: 'main.editWidget'
+  }
+];

http://git-wip-us.apache.org/repos/asf/ambari/blob/5be5b138/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index e72f971..549c34b 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -361,35 +361,14 @@ App.Router = Em.Router.extend({
     } else {
       if (this.get('clusterInstallCompleted')) {
         App.clusterStatus.updateFromServer(false).complete(function () {
-          var clusterStatusOnServer = App.clusterStatus.get('value');
           var route = 'main.dashboard.index';
-          if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('addHostController.name')) {
-            // if wizardControllerName == "addHostController", then it means someone closed
the browser or the browser was crashed when we were last in Add Hosts wizard
-            route = 'main.hostAdd';
-          } else if (clusterStatusOnServer && (clusterStatusOnServer.wizardControllerName
=== App.router.get('addSecurityController.name') || clusterStatusOnServer.wizardControllerName
=== App.router.get('mainAdminSecurityDisableController.name'))) {
-            // if wizardControllerName == "addSecurityController", then it means someone
closed the browser or the browser was crashed when we were last in Add Security wizard
-            route = 'main.admin.adminSecurity';
-          } else if (clusterStatusOnServer && (clusterStatusOnServer.wizardControllerName
=== App.router.get('kerberosWizardController.name'))) {
-            // if wizardControllerName == "adminKerberosController", then it means someone
closed the browser or the browser was crashed when we were last in Add Kerberos wizard
-            route = 'main.admin.adminKerberos.adminAddKerberos';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('addServiceController.name')) {
-            // if wizardControllerName == "addHostController", then it means someone closed
the browser or the browser was crashed when we were last in Add Hosts wizard
-            route = 'main.serviceAdd';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('reassignMasterController.name')) {
-            // if wizardControllerName == "reassignMasterController", then it means someone
closed the browser or the browser was crashed when we were last in Reassign Master wizard
-            route = 'main.reassign';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('highAvailabilityWizardController.name')) {
-            // if wizardControllerName == "highAvailabilityWizardController", then it means
someone closed the browser or the browser was crashed when we were last in NameNode High Availability
wizard
-            route = 'main.services.enableHighAvailability';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('rMHighAvailabilityWizardController.name')) {
-            // if wizardControllerName == "highAvailabilityWizardController", then it means
someone closed the browser or the browser was crashed when we were last in NameNode High Availability
wizard
-            route = 'main.services.enableRMHighAvailability';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('rollbackHighAvailabilityWizardController.name')) {
-            // if wizardControllerName == "highAvailabilityRollbackController", then it means
someone closed the browser or the browser was crashed when we were last in NameNode High Availability
Rollback wizard
-            route = 'main.services.rollbackHighAvailability';
-          } else if (clusterStatusOnServer && clusterStatusOnServer.wizardControllerName
=== App.router.get('mainAdminStackAndUpgradeController.name')) {
-            // if wizardControllerName == "mainAdminStackAndUpgradeController", then it means
someone closed the browser or the browser was crashed when we were last in Rolling Upgrade
wizard
-            route = 'main.admin.stackAndUpgrade';
+          var clusterStatusOnServer = App.clusterStatus.get('value');
+          if (clusterStatusOnServer) {
+            var wizardControllerRoutes = require('data/controller_route');
+            var wizardControllerRoute =  wizardControllerRoutes.findProperty('wizardControllerName',
clusterStatusOnServer.wizardControllerName);
+            if (wizardControllerRoute) {
+              route =  wizardControllerRoute.route;
+            }
           }
           callback(route);
         });


Mime
View raw message