Repository: ambari Updated Branches: refs/heads/branch-alerts-dev 760bedfe3 -> 17b8e7990
AMBARI-7290. Usability: show 'Restart Required' bar on Summary tab.(xiwang) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1dcb9dc6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1dcb9dc6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1dcb9dc6 Branch: refs/heads/branch-alerts-dev Commit: 1dcb9dc62e59f5320940dcc3188398d15b706d33 Parents: 3355733 Author: Xi Wang <xiw...@apache.org> Authored: Fri Sep 12 17:28:47 2014 -0700 Committer: Xi Wang <xiw...@apache.org> Committed: Fri Sep 12 17:28:54 2014 -0700 ---------------------------------------------------------------------- .../controllers/main/service/info/configs.js | 9 +-- ambari-web/app/styles/application.less | 14 +++++ .../app/templates/main/service/info/configs.hbs | 2 +- .../app/templates/main/service/info/summary.hbs | 26 +++++++- .../app/views/main/service/info/summary.js | 62 ++++++++++++++++++++ 5 files changed, 107 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1dcb9dc6/ambari-web/app/controllers/main/service/info/configs.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js index 2280d01..cea4630 100644 --- a/ambari-web/app/controllers/main/service/info/configs.js +++ b/ambari-web/app/controllers/main/service/info/configs.js @@ -2328,9 +2328,10 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * trigger showItemsShouldBeRestarted popup with hosts that requires resetart * @method showHostsShouldBeRestarted */ - showHostsShouldBeRestarted: function () { + showHostsShouldBeRestarted: function (restartRequiredHostsAndComponents) { var hosts = []; - for (var hostName in this.get('content.restartRequiredHostsAndComponents')) { + var rhc = this.get('content.restartRequiredHostsAndComponents') || restartRequiredHostsAndComponents; + for (var hostName in rhc) { hosts.push(hostName); } var hostsText = hosts.length == 1 ? Em.I18n.t('common.host') : Em.I18n.t('common.hosts'); @@ -2342,8 +2343,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM * trigger showItemsShouldBeRestarted popup with components that requires resetart * @method showComponentsShouldBeRestarted */ - showComponentsShouldBeRestarted: function () { - var rhc = this.get('content.restartRequiredHostsAndComponents'); + showComponentsShouldBeRestarted: function (restartRequiredHostsAndComponents) { + var rhc = this.get('content.restartRequiredHostsAndComponents') || restartRequiredHostsAndComponents; var hostsComponets = []; var componentsObject = {}; for (var hostName in rhc) { http://git-wip-us.apache.org/repos/asf/ambari/blob/1dcb9dc6/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index e4b455e..7a4138c 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -1066,6 +1066,19 @@ h1 { padding: 8px 0; } +#summary-restart-bar { + margin-top: 20px; + .alert{ + .icon-refresh{ + margin-left:10px; + color: #fdb82f; + } + } + .dropdown-menu > li > a:hover { + text-shadow: none; + } +} + #serviceConfig { margin-top: 20px; .alert{ @@ -5597,6 +5610,7 @@ ul.inline li { width:757px!important } + .assign-masters { .host-assignments { margin-left: 0; http://git-wip-us.apache.org/repos/asf/ambari/blob/1dcb9dc6/ambari-web/app/templates/main/service/info/configs.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/configs.hbs b/ambari-web/app/templates/main/service/info/configs.hbs index 5335bca..b4ec65c 100644 --- a/ambari-web/app/templates/main/service/info/configs.hbs +++ b/ambari-web/app/templates/main/service/info/configs.hbs @@ -23,7 +23,7 @@ {{#if App.isAdmin}} <div> <div class="alert alert-warning clearfix"> - <i class="icon-refresh"></i> {{{view.needToRestartMessage}}} {{t services.service.config.restartService.needToRestart}} <a href="#" {{action showComponentsShouldBeRestarted target="controller"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}} <a href="#" {{action showHostsShouldBeRestarted target="controller"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a> + <i class="icon-refresh"></i> {{t services.service.config.restartService.needToRestart}} <a href="#" {{action showComponentsShouldBeRestarted target="controller"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}} <a href="#" {{action showHostsShouldBeRestarted target="controller"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a> <span class="restart-components pull-right"> </span> <div class="btn-group pull-right"> <button type="button" class="btn btn-default dropdown-toggle btn-warning" data-toggle="dropdown"> http://git-wip-us.apache.org/repos/asf/ambari/blob/1dcb9dc6/ambari-web/app/templates/main/service/info/summary.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs index 88225b8..080a3f7 100644 --- a/ambari-web/app/templates/main/service/info/summary.hbs +++ b/ambari-web/app/templates/main/service/info/summary.hbs @@ -16,9 +16,33 @@ * limitations under the License. }} +{{#if App.supports.hostOverrides}} + {{#if view.service.isRestartRequired}} + {{#if App.isAdmin}} + <div id="summary-restart-bar"> + <div class="alert alert-warning clearfix"> + <i class="icon-refresh"></i> {{{view.needToRestartMessage}}} {{t services.service.config.restartService.needToRestart}} <a href="#" {{action showComponentsShouldBeRestarted target="view"}}>{{view.componentsCount}} {{pluralize view.componentsCount singular="t:common.component" plural="t:common.components"}}</a> {{t on}} <a href="#" {{action showHostsShouldBeRestarted target="view"}}>{{view.hostsCount}} {{pluralize view.hostsCount singular="t:common.host" plural="t:common.hosts"}}</a> + <span class="restart-components pull-right"> </span> + <div class="btn-group pull-right"> + <button type="button" class="btn btn-default dropdown-toggle btn-warning" data-toggle="dropdown"> + {{t hosts.host.details.needToRestart.button}} + <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <li><a href="#" {{action restartAllStaleConfigComponents target="view"}}>{{t restart.service.all}}</a></li> + {{#if view.rollingRestartSlaveComponentName}} + <li><a href="#" {{action rollingRestartStaleConfigSlaveComponents view.rollingRestartSlaveComponentName target="view"}}>{{view.rollingRestartActionName}}</a></li> + {{/if}} + </ul> + </div> + </div> + </div> + {{/if}} + {{/if}} +{{/if}} + <div class="row-fluid service-block"> <div class="span6"> - <div class="box"> <div class="box-header"> <h4>{{controller.content.label}} {{t services.service.info.menu.summary}}</h4> http://git-wip-us.apache.org/repos/asf/ambari/blob/1dcb9dc6/ambari-web/app/views/main/service/info/summary.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js index ae4a814..8d5ed4e 100644 --- a/ambari-web/app/views/main/service/info/summary.js +++ b/ambari-web/app/views/main/service/info/summary.js @@ -16,6 +16,7 @@ */ var App = require('app'); +var batchUtils = require('utils/batch_scheduled_requests'); require('views/main/service/service'); App.AlertItemView = Em.View.extend({ @@ -252,6 +253,67 @@ App.MainServiceInfoSummaryView = Em.View.extend({ oldServiceName:'', + /* + * 'Restart Required bar' start + */ + componentsCount: null, + hostsCount: null, + + restartRequiredHostsAndComponents:function () { + return this.get('controller.content.restartRequiredHostsAndComponents'); + }.property('controller.content.restartRequiredHostsAndComponents'), + + updateComponentInformation: function() { + var hc = this.get('restartRequiredHostsAndComponents'); + var hostsCount = 0; + var componentsCount = 0; + for (var host in hc) { + hostsCount++; + componentsCount += hc[host].length; + } + this.set('componentsCount', componentsCount); + this.set('hostsCount', hostsCount); + }.observes('restartRequiredHostsAndComponents'), + + rollingRestartSlaveComponentName : function() { + return batchUtils.getRollingRestartComponentName(this.get('serviceName')); + }.property('serviceName'), + rollingRestartActionName : function() { + var label = null; + var componentName = this.get('rollingRestartSlaveComponentName'); + if (componentName) { + label = Em.I18n.t('rollingrestart.dialog.title').format(App.format.role(componentName)); + } + return label; + }.property('rollingRestartSlaveComponentName'), + showComponentsShouldBeRestarted: function () { + var rhc = this.get('restartRequiredHostsAndComponents'); + App.router.get('mainServiceInfoConfigsController').showComponentsShouldBeRestarted(rhc); + }, + showHostsShouldBeRestarted: function () { + var rhc = this.get('restartRequiredHostsAndComponents'); + App.router.get('mainServiceInfoConfigsController').showHostsShouldBeRestarted(rhc); + }, + restartAllStaleConfigComponents: function () { + var self = this; + var serviceDisplayName = this.get('service.displayName'); + var bodyMessage = Em.Object.create({ + confirmMsg: Em.I18n.t('services.service.restartAll.confirmMsg').format(serviceDisplayName), + confirmButton: Em.I18n.t('services.service.restartAll.confirmButton'), + additionalWarningMsg: this.get('service.passiveState') === 'OFF' ? Em.I18n.t('services.service.restartAll.warningMsg.turnOnMM').format(serviceDisplayName) : null + }); + return App.showConfirmationFeedBackPopup(function (query) { + var selectedService = self.get('service.id'); + batchUtils.restartAllServiceHostComponents(selectedService, true, query); + }, bodyMessage); + }, + rollingRestartStaleConfigSlaveComponents: function (componentName) { + batchUtils.launchHostComponentRollingRestart(componentName.context, this.get('service.displayName'), this.get('service.passiveState') === "ON", true); + }, + /* + * 'Restart Required bar' ended + */ + /** * Contains graphs for this particular service */