Updated Branches: refs/heads/trunk 747bd1e31 -> 38bcb75a6
AMBARI-3125 NameNode HA wizard: Create Rollback popup (mockup). (atkach) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/38bcb75a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/38bcb75a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/38bcb75a Branch: refs/heads/trunk Commit: 38bcb75a6af89c9f7ad073042c2137277658c5cc Parents: 747bd1e Author: atkach <[email protected]> Authored: Fri Sep 6 14:18:15 2013 +0300 Committer: atkach <[email protected]> Committed: Fri Sep 6 14:18:15 2013 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers.js | 1 + .../highAvailability/progress_controller.js | 2 +- .../highAvailability/rollback_controller.js | 123 ++++++++++++++++++- ambari-web/app/messages.js | 14 +++ ambari-web/app/routes/main.js | 56 ++++++++- .../main/admin/highAvailability/rollback.hbs | 21 ++++ ambari-web/app/views.js | 1 + .../admin/highAvailability/rollback_view.js | 29 +++++ 8 files changed, 242 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/controllers.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js index 60a3ac6..2ee716f 100644 --- a/ambari-web/app/controllers.js +++ b/ambari-web/app/controllers.js @@ -29,6 +29,7 @@ require('controllers/main/admin'); require('controllers/main/admin/highAvailability_controller'); require('controllers/main/admin/highAvailability/wizard_controller'); require('controllers/main/admin/highAvailability/progress_controller'); +require('controllers/main/admin/highAvailability/rollback_controller'); require('controllers/main/admin/highAvailability/step1_controller'); require('controllers/main/admin/highAvailability/step2_controller'); require('controllers/main/admin/highAvailability/step3_controller'); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js index e8365d0..b2c022b 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/progress_controller.js @@ -111,7 +111,7 @@ App.HighAvailabilityProgressPageController = Em.Controller.extend({ header: Em.I18n.t('admin.highAvailability.confirmRollbackHeader'), primary: Em.I18n.t('common.confirm'), onPrimary: function () { - //App.router.send(); + App.router.transitionTo('root.main.admin.adminHighAvailability.rollback'); this.hide(); }, secondary : Em.I18n.t('common.cancel'), http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js index 41db427..65de169 100644 --- a/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js +++ b/ambari-web/app/controllers/main/admin/highAvailability/rollback_controller.js @@ -17,9 +17,9 @@ */ var App = require('app'); -require('controllers/highAvailability/progress_controller'); +require('controllers/main/admin/highAvailability/progress_controller'); -App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageController({ +App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageController.extend({ name: "highAvailabilityRollbackController", @@ -35,11 +35,128 @@ App.HighAvailabilityRollbackController = App.HighAvailabilityProgressPageControl 'stopJournalNodes', 'deleteJournalNodes', 'deleteAdditionalNameNode', - 'startAllServices', + 'startAllServices' ], getStartingPoint: function() { + }, + + clearStep: function () { + this.set('isSubmitDisabled', true); + this.set('tasks', []); + this.set('logs', []); + this.set('currentRequestIds', []); + var commands = this.get('commands'); + for (var i = 0; i < commands.length; i++) { + this.get('tasks').pushObject(Ember.Object.create({ + title: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'), + status: 'PENDING', + id: i, + command: commands[i], + showRetry: false, + name: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'), + displayName: Em.I18n.t('admin.highAvailability.rollback.task' + i + '.title'), + progress: 0, + isRunning: false, + hosts: [] + })); + } + }, + + onTaskStatusChange: function () { + 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'); + if (nextTask) { + this.set('status', 'IN_PROGRESS'); + this.setTaskStatus(nextTask.get('id'), 'QUEUED'); + this.set('currentTaskId', nextTask.get('id')); + this.runTask(nextTask.get('id')); + } else { + this.set('status', 'COMPLETED'); + this.set('isSubmitDisabled', false); + } + } else if (this.get('tasks').someProperty('status', 'FAILED') || this.get('tasks').someProperty('status', 'TIMEDOUT') || this.get('tasks').someProperty('status', 'ABORTED')) { + this.set('status', 'FAILED'); + this.get('tasks').findProperty('status', 'FAILED').set('showRetry', true); + } + + var statuses = this.get('tasks').mapProperty('status'); + var requestIds = this.get('currentRequestIds'); + this.saveTasksStatuses(statuses); + this.saveRequestIds(requestIds); + App.clusterStatus.setClusterStatus({ + clusterName: this.get('content.cluster.name'), + clusterState: 'HIGH_AVAILABILITY_ROLLBACK', + wizardControllerName: this.get('content.controllerName'), + localdb: App.db.data + }); + }, + + saveTasksStatuses: function(statuses){ + App.db.setHighAvailabilityWizardTasksStatuses(statuses); + //this.set('content.tasksStatuses', statuses); + }, + + loadTasksStatuses: function(){ + var statuses = App.db.getHighAvailabilityWizardTasksStatuses(); + //this.set('content.tasksStatuses', statuses); + }, + + saveRequestIds: function(requestIds){ + App.db.setHighAvailabilityWizardRequestIds(requestIds); + //this.set('content.requestIds', requestIds); + }, + + loadRequestIds: function(){ + var requestIds = App.db.getHighAvailabilityWizardRequestIds(); + //this.set('content.requestIds', requestIds); + }, + + done: function () { + if (!this.get('isSubmitDisabled')) { + this.removeObserver('[email protected]', this, 'onTaskStatusChange'); + this.get('popup').hide(); + App.router.transitionTo('main.admin.adminHighAvailability'); + } + }, + + stopAllServices: function(){ + + }, + restoreHBaseConfigs: function(){ + + }, + + stopFailoverControllers: function(){ + + }, + deleteFailoverControllers: function(){ + + }, + stopStandbyNameNode: function(){ + + }, + stopNamenode: function(){ + + }, + restoreHDFSConfigs: function(){ + + }, + enableSecondaryNameNode: function(){ + + }, + stopJournalNodes: function(){ + + }, + deleteJournalNodes: function(){ + + }, + deleteAdditionalNameNode: function(){ + + }, + startAllServices: function(){ + } }); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 06ae79e..95496f5 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -699,6 +699,20 @@ Em.I18n.translations = { 'admin.highAvailability.wizard.step6.jsNoInit':'JournalNodes not initialized yet', 'admin.highAvailability.wizard.step8.metaNoInit':'Metadata not initialized yet', + 'admin.highAvailability.rollback.header':'Disable NameNode HA Wizard', + 'admin.highAvailability.rollback.task0.title':'Stop all services', + 'admin.highAvailability.rollback.task1.title':'Restore HBASE configurations', + 'admin.highAvailability.rollback.task2.title':'Stop Failover controllers', + 'admin.highAvailability.rollback.task3.title':'Delete Failover controllers', + 'admin.highAvailability.rollback.task4.title':'Stop stand by NameNode', + 'admin.highAvailability.rollback.task5.title':'Stop NameNode', + 'admin.highAvailability.rollback.task6.title':'Restore HDFS configurations', + 'admin.highAvailability.rollback.task7.title':'Enable Secondary NameNode', + 'admin.highAvailability.rollback.task8.title':'Stop JournalNodes', + 'admin.highAvailability.rollback.task9.title':'Delete JournalNodes', + 'admin.highAvailability.rollback.task10.title':'Delete additional NameNode', + 'admin.highAvailability.rollback.task11.title':'Start all services', + 'admin.highAvailability.rollback.notice.inProgress': 'Please wait while NameNode HA is being disabled.', 'admin.highAvailability.wizard.step8.body': '<ol>' + http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/routes/main.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js index 50835a5..f69dbb9 100644 --- a/ambari-web/app/routes/main.js +++ b/ambari-web/app/routes/main.js @@ -652,7 +652,61 @@ module.exports = Em.Route.extend({ connectOutlets: function (router) { router.set('mainAdminController.category', "highAvailability"); router.get('mainAdminController').connectOutlet('mainAdminHighAvailability'); - } + }, + + rollback: Ember.Route.extend({ + route: '/rollback', + enter: function (router) { + //after refresh check if the wizard is open then restore it + Ember.run.next(function () { + App.router.get('updateController').set('isWorking', false); + + + var highAvailabilityWizardController = router.get('highAvailabilityWizardController'); + highAvailabilityWizardController.finish(); + highAvailabilityWizardController.get('popup').hide(); + + var popup = App.ModalPopup.show({ + classNames: ['full-width-modal'], + header: Em.I18n.t('admin.highAvailability.rollback.header'), + bodyClass: App.HighAvailabilityRollbackView.extend({ + controllerBinding: 'App.router.highAvailabilityRollbackController' + }), + primary: Em.I18n.t('form.cancel'), + secondary: null, + showFooter: false, + + onClose: function () { + var self = this; + var controller = router.get('highAvailabilityRollbackController'); +// if (!controller.get('isSubmitDisabled')) { + self.proceedOnClose(); +// } + }, + proceedOnClose: function () { + App.router.get('updateController').set('isWorking', true); + /*App.clusterStatus.setClusterStatus({ + clusterName: router.get('content.cluster.name'), + clusterState: 'HIGH_AVAILABILITY_DISABLED', + wizardControllerName: router.get('highAvailabilityRollbackController.name'), + localdb: App.db.data + });*/ + this.hide(); + router.transitionTo('main.admin.adminHighAvailability'); + }, + didInsertElement: function () { + this.fitHeight(); + } + }); + router.set('highAvailabilityRollbackController.popup', popup); + }); + + }, + + unroutePath: function () { + return false; + } + }) }), enableHighAvailability: require('routes/high_availability_routes'), http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/templates/main/admin/highAvailability/rollback.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/highAvailability/rollback.hbs b/ambari-web/app/templates/main/admin/highAvailability/rollback.hbs new file mode 100644 index 0000000..12e1a85 --- /dev/null +++ b/ambari-web/app/templates/main/admin/highAvailability/rollback.hbs @@ -0,0 +1,21 @@ +{{! +* 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. +}} +<div class="wizard"> + {{template "templates/main/admin/highAvailability/progress"}} +</div> + http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/views.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js index 30a9076..3e0c68a 100644 --- a/ambari-web/app/views.js +++ b/ambari-web/app/views.js @@ -56,6 +56,7 @@ require('views/main/admin'); require('views/main/admin/highAvailability_view'); require('views/main/admin/highAvailability/wizard_view'); require('views/main/admin/highAvailability/progress_view'); +require('views/main/admin/highAvailability/rollback_view'); require('views/main/admin/highAvailability/step1_view'); require('views/main/admin/highAvailability/step2_view'); require('views/main/admin/highAvailability/step3_view'); http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/38bcb75a/ambari-web/app/views/main/admin/highAvailability/rollback_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin/highAvailability/rollback_view.js b/ambari-web/app/views/main/admin/highAvailability/rollback_view.js new file mode 100644 index 0000000..869a782 --- /dev/null +++ b/ambari-web/app/views/main/admin/highAvailability/rollback_view.js @@ -0,0 +1,29 @@ +/** + * 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'); + +App.HighAvailabilityRollbackView = App.HighAvailabilityProgressPageView.extend({ + templateName: require('templates/main/admin/highAvailability/rollback'), + + notice: Em.I18n.t('admin.highAvailability.rollback.notice.inProgress'), + submitButtonText: Em.I18n.t('common.done') + + +});
