Author: srimanth
Date: Wed May 1 21:55:48 2013
New Revision: 1478207
URL: http://svn.apache.org/r1478207
Log:
AMBARI-2056. Show proper error message while user tries to save configurations
of partially stopped service. (srimanth)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/models/service.js
incubator/ambari/trunk/ambari-web/app/styles/application.less
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1478207&r1=1478206&r2=1478207&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed May 1 21:55:48 2013
@@ -825,6 +825,9 @@ Trunk (unreleased changes):
BUG FIXES
+ AMBARI-2056. Show proper error message while user tries to save
configurations
+ of partially stopped service. (srimanth)
+
AMBARI-2064. Legend for zoomed-in graphs do not render properly in IE9.
(yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1478207&r1=1478206&r2=1478207&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
Wed May 1 21:55:48 2013
@@ -580,6 +580,52 @@ App.MainServiceInfoConfigsController = E
},
/**
+ * Determines which host components are running on each host.
+ * @return Returned in the following format:
+ * {
+ * runningHosts: {
+ * 'hostname1': 'NameNode, DataNode, JobTracker',
+ * 'hostname2': 'DataNode',
+ * },
+ * runningComponentCount: 5
+ * }
+ */
+ getRunningHostComponents: function (services) {
+ var runningHosts = [];
+ var runningComponentCount = 0;
+ var hostToIndexMap = {};
+ services.forEach(function (service) {
+ var runningHostComponents = service.get('runningHostComponents');
+ if (runningHostComponents != null) {
+ runningHostComponents.forEach(function (hc) {
+ var hostName = hc.get('host.publicHostName');
+ var componentName = hc.get('displayName');
+ runningComponentCount++;
+ if (!(hostName in hostToIndexMap)) {
+ runningHosts.push({
+ name: hostName,
+ components: ""
+ });
+ hostToIndexMap[hostName] = runningHosts.length - 1;
+ }
+ var hostObj = runningHosts[hostToIndexMap[hostName]];
+ if (hostObj.components.length > 0)
+ hostObj.components += ", " + componentName;
+ else
+ hostObj.components += componentName;
+ });
+ runningHosts.sort(function (a, b) {
+ return a.name.localeCompare(b.name);
+ });
+ }
+ });
+ return {
+ runningHosts: runningHosts,
+ runningComponentCount: runningComponentCount
+ };
+ },
+
+ /**
* open popup with appropriate message
*/
restartServicePopup: function (event) {
@@ -590,6 +636,8 @@ App.MainServiceInfoConfigsController = E
var message;
var value;
var flag = false;
+ var runningHosts = null;
+ var runningComponentCount = 0;
if (App.supports.hostOverrides ||
(this.get('content.serviceName') !== 'HDFS' &&
this.get('content.isStopped') === true) ||
((this.get('content.serviceName') === 'HDFS') &&
this.get('content.isStopped') === true &&
(!App.Service.find().someProperty('id', 'MAPREDUCE') ||
App.Service.find('MAPREDUCE').get('isStopped')))) {
@@ -605,13 +653,18 @@ App.MainServiceInfoConfigsController = E
value = result.value;
}
} else {
+ var rhc;
if (this.get('content.serviceName') !== 'HDFS' ||
(this.get('content.serviceName') === 'HDFS' &&
!App.Service.find().someProperty('id', 'MAPREDUCE'))) {
+ rhc = this.getRunningHostComponents([this.get('content')]);
header = Em.I18n.t('services.service.config.stopService');
message = Em.I18n.t('services.service.config.msgServiceStop');
} else {
+ rhc = this.getRunningHostComponents([this.get('content'),
App.Service.find('MAPREDUCE')]);
header = Em.I18n.t('services.service.config.stopService');
message = Em.I18n.t('services.service.config.msgHDFSMapRServiceStop');
}
+ runningHosts = rhc.runningHosts;
+ runningComponentCount = rhc.runningComponentCount;
}
var self = this;
@@ -628,6 +681,8 @@ App.MainServiceInfoConfigsController = E
bodyClass: Ember.View.extend({
flag: flag,
message: message,
+ runningHosts: runningHosts,
+ runningComponentCount: runningComponentCount,
siteProperties: value,
getDisplayMessage: function () {
var displayMsg = [];
@@ -662,20 +717,32 @@ App.MainServiceInfoConfigsController = E
return displayMsg;
}.property('siteProperties'),
+ getRunningHostsMessage: function () {
+ return
Em.I18n.t('services.service.config.stopService.runningHostComponents').format(this.get('runningComponentCount'),
this.get('runningHosts.length'));
+ }.property('runningComponentCount', 'runningHosts.length'),
template: Ember.Handlebars.compile([
'<h5>{{view.message}}</h5>',
'{{#unless view.flag}}',
- '<br/>',
- '<div class="pre-scrollable" style="max-height: 250px;">',
- '<ul>',
- '{{#each val in view.getDisplayMessage}}',
- '<li>',
- '{{val}}',
- '</li>',
- '{{/each}}',
- '</ul>',
- '</div>',
- '{{/unless}}'
+ ' <br/>',
+ ' <div class="pre-scrollable" style="max-height: 250px;">',
+ ' <ul>',
+ ' {{#each val in view.getDisplayMessage}}',
+ ' <li>',
+ ' {{val}}',
+ ' </li>',
+ ' {{/each}}',
+ ' </ul>',
+ ' </div>',
+ '{{/unless}}',
+ '{{#if view.runningHosts}}',
+ ' <i class="icon-warning-sign"></i>
{{view.getRunningHostsMessage}}',
+ ' <table class="table-striped running-host-components-table">',
+ ' <tr><th>{{t common.host}}</th><th>{{t
common.components}}</th></tr>',
+ ' {{#each host in view.runningHosts}}',
+ ' <tr><td>{{host.name}}</td><td>{{host.components}}</td></tr>',
+ ' {{/each}}',
+ ' </table>',
+ '{{/if}}'
].join('\n'))
})
});
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1478207&r1=1478206&r2=1478207&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Wed May 1 21:55:48 2013
@@ -746,6 +746,7 @@ Em.I18n.translations = {
'services.service.config.failSaveConfigHostExceptions':'Failure in applying
service configuration host exceptions',
'services.service.config.addPropertyWindow.errorMessage':'This is required',
'services.service.config.addPropertyWindow.error.derivedKey':'Cannot add a
known derived property',
+ 'services.service.config.stopService.runningHostComponents':'{0} components
on {1} hosts are still running',
'services.add.header':'Add Service Wizard',
'services.reassign.header':'Reassign Master Wizard',
Modified: incubator/ambari/trunk/ambari-web/app/models/service.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service.js?rev=1478207&r1=1478206&r2=1478207&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service.js Wed May 1 21:55:48
2013
@@ -29,6 +29,7 @@ App.Service = DS.Model.extend({
quickLinks: DS.hasMany('App.QuickLinks'),
hostComponents: DS.hasMany('App.HostComponent'),
serviceConfigsTemplate: require('data/service_configs'),
+ runningHostComponents: null,
isStartDisabled: function () {
return !(this.get('healthStatus') == 'red');
}.property('healthStatus'),
@@ -87,11 +88,14 @@ App.Service = DS.Model.extend({
updateIsStopped: function () {
var components = this.get('hostComponents');
var flag = true;
+ var runningHCs = Ember.A([]);
components.forEach(function (_component) {
if (_component.get('workStatus') !== App.HostComponentStatus.stopped &&
_component.get('workStatus') !== App.HostComponentStatus.install_failed) {
flag = false;
+ runningHCs.addObject(_component);
}
}, this);
+ this.set('runningHostComponents', runningHCs);
this.set('isStopped', flag);
},
Modified: incubator/ambari/trunk/ambari-web/app/styles/application.less
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/styles/application.less?rev=1478207&r1=1478206&r2=1478207&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/trunk/ambari-web/app/styles/application.less Wed May 1
21:55:48 2013
@@ -645,6 +645,14 @@ h1 {
}
}
+.running-host-components-table{
+ width: 100%;
+ text-align: left;
+ tbody{
+ vertical-align: top;
+ }
+}
+
a:focus {
outline: none;
}