Browse Source

AMBARI-3106. NameNode HA wizard: show Rollback button when task fails, and show confirm rollback popup

Alex Antonenko 11 years ago
parent
commit
75b0c44003

+ 17 - 0
ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js

@@ -105,6 +105,23 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({
     task.set('status', 'PENDING');
     task.set('status', 'PENDING');
   },
   },
 
 
+  rollback: function () {
+    var task = this.get('tasks').findProperty('status', 'FAILED');
+    App.ModalPopup.show({
+      header: Em.I18n.t('admin.highAvailability.confirmRollbackHeader'),
+      primary: Em.I18n.t('common.confirm'),
+      onPrimary: function () {
+        //App.router.send();
+        this.hide();
+      },
+      secondary : Em.I18n.t('common.cancel'),
+      onSecondary: function(){
+        this.hide();
+      },
+      body: Em.I18n.t('admin.highAvailability.confirmRollbackBody')
+    });
+  },
+
   onTaskStatusChange: function () {
   onTaskStatusChange: function () {
     if (!this.get('tasks').someProperty('status', 'IN_PROGRESS') && !this.get('tasks').someProperty('status', 'QUEUED') && !this.get('tasks').someProperty('status', 'FAILED')) {
     if (!this.get('tasks').someProperty('status', 'IN_PROGRESS') && !this.get('tasks').someProperty('status', 'QUEUED') && !this.get('tasks').someProperty('status', 'FAILED')) {
       var nextTask = this.get('tasks').findProperty('status', 'PENDING');
       var nextTask = this.get('tasks').findProperty('status', 'PENDING');

+ 45 - 0
ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js

@@ -0,0 +1,45 @@
+/**
+ * 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');
+require('controllers/highAvailability/progress_controller');
+
+App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageController({
+
+  name: "highAvailabilityRollbackController",
+
+  commands: [
+    'stopAllServices',
+    'restoreHBaseConfigs',
+    'stopFailoverControllers',
+    'deleteFailoverControllers',
+    'stopStandbyNameNode',
+    'stopNamenode',
+    'restoreHDFSConfigs',
+    'enableSecondaryNameNode',
+    'stopJournalNodes',
+    'deleteJournalNodes',
+    'deleteAdditionalNameNode',
+    'startAllServices',
+  ],
+
+  getStartingPoint: function() {
+
+  }
+
+});

+ 3 - 0
ambari-web/app/messages.js

@@ -56,6 +56,7 @@ Em.I18n.translations = {
   'common.addComponent':'Add Component',
   'common.addComponent':'Add Component',
   'common.remove':'Remove',
   'common.remove':'Remove',
   'common.retry':'Retry',
   'common.retry':'Retry',
+  'common.rollBack':'Rollback',
   'common.show':'Show',
   'common.show':'Show',
   'common.hide':'Hide',
   'common.hide':'Hide',
   'common.cancel':'Cancel',
   'common.cancel':'Cancel',
@@ -643,6 +644,8 @@ Em.I18n.translations = {
   'admin.highAvailability.button.enable':'Enable NameNode HA',
   'admin.highAvailability.button.enable':'Enable NameNode HA',
   'admin.highAvailability.disabled':'NameNode HA is disabled',
   'admin.highAvailability.disabled':'NameNode HA is disabled',
   'admin.highAvailability.enabled':'NameNode HA is enabled',
   'admin.highAvailability.enabled':'NameNode HA is enabled',
+  'admin.highAvailability.confirmRollbackHeader':'Confirm Rollback',
+  'admin.highAvailability.confirmRollbackBody':'This will rollback all operations that were done in HA wizard',
   'admin.highAvailability.error.hostsNum':'You must have at least 3 hosts in your cluster to enable NameNode HA.',
   'admin.highAvailability.error.hostsNum':'You must have at least 3 hosts in your cluster to enable NameNode HA.',
   'admin.highAvailability.error.namenodeStarted':'NameNode must be running before you enable NameNode HA.',
   'admin.highAvailability.error.namenodeStarted':'NameNode must be running before you enable NameNode HA.',
   'admin.highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable NameNode HA.',
   'admin.highAvailability.error.zooKeeperNum':'You must have at least 3 ZooKeeper Servers in your cluster to enable NameNode HA.',

+ 4 - 0
ambari-web/app/templates/main/admin/highAvailability/progress.hbs

@@ -40,6 +40,10 @@
           <i class="icon-repeat icon-white"></i>
           <i class="icon-repeat icon-white"></i>
           {{t common.retry}}
           {{t common.retry}}
         </a>
         </a>
+        <a {{action rollback target="controller"}} class="btn btn-primary retry">
+          <i class="icon-repeat icon-white"></i>
+          {{t common.rollBack}}
+        </a>
       {{/if}}
       {{/if}}
       </div>
       </div>
     </div>
     </div>