You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/01/30 18:15:08 UTC
git commit: AMBARI-4474 Maintenance Mode: Service Left Nav / Service
Actions Button. (ababiichuk)
Updated Branches:
refs/heads/trunk a1995263f -> 72535217c
AMBARI-4474 Maintenance Mode: Service Left Nav / Service Actions Button. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/72535217
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/72535217
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/72535217
Branch: refs/heads/trunk
Commit: 72535217cc044b1a6fe55d67098f00f3737b4a53
Parents: a199526
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Thu Jan 30 19:12:14 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Thu Jan 30 19:12:14 2014 +0200
----------------------------------------------------------------------
.../app/controllers/global/update_controller.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 23 ++++++++++++++++++++
ambari-web/app/mappers/service_mapper.js | 3 ++-
.../app/mappers/service_metrics_mapper.js | 3 ++-
ambari-web/app/models/service.js | 2 +-
ambari-web/app/styles/application.less | 4 ++++
ambari-web/app/utils/ajax.js | 19 ++++++++++++++++
ambari-web/app/views/main/dashboard/service.js | 5 ++++-
ambari-web/app/views/main/service/item.js | 2 ++
9 files changed, 58 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index 95d0aaa..45db27c 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -183,7 +183,7 @@ App.UpdateController = Em.Controller.extend({
},
updateServices: function (callback) {
var testUrl = '/data/services/HDP2/services.json';
- var componentConfigUrl = this.getUrl(testUrl, '/services?fields=alerts/summary,ServiceInfo/state&minimal_response=true');
+ var componentConfigUrl = this.getUrl(testUrl, '/services?fields=alerts/summary,ServiceInfo/state,ServiceInfo/passive_state&minimal_response=true');
App.HttpClient.get(componentConfigUrl, App.serviceMapper, {
complete: callback
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index b1c7b27..95085f4 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -193,10 +193,33 @@ App.MainServiceItemController = Em.Controller.extend({
});
},
+ turnOnOffPassive: function(label) {
+ var self = this;
+ var state = this.get('content.passiveState') == 'ACTIVE' ? 'PASSIVE' : 'ACTIVE';
+ var onOff = state === 'PASSIVE' ? "On" : "Off";
+ App.showConfirmationPopup(function() {
+ self.turnOnOffPassiveRequest(state, label)
+ },
+ Em.I18n.t('hosts.passiveMode.popup').format(onOff,self.get('content.displayName'))
+ );
+ },
+
rollingRestart: function(hostComponentName) {
batchUtils.launchHostComponentRollingRestart(hostComponentName, false);
},
+ turnOnOffPassiveRequest: function(state,message) {
+ App.ajax.send({
+ 'name': 'service.item.passive',
+ 'sender': this,
+ 'data': {
+ 'requestInfo': message,
+ 'serviceName': this.get('content.serviceName').toUpperCase(),
+ 'passive_state': state
+ }
+ });
+ },
+
runSmokeTestPrimary: function() {
App.ajax.send({
'name': 'service.item.smoke',
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index c6a3512..4cf04d6 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -26,7 +26,8 @@ App.serviceMapper = App.QuickDataMapper.create({
var serviceData = {
ServiceInfo: {
service_name: service.ServiceInfo.service_name,
- state: service.ServiceInfo.state
+ state: service.ServiceInfo.state,
+ passive_state: service.ServiceInfo.passive_state
},
host_components: [],
components: []
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/mappers/service_metrics_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_metrics_mapper.js b/ambari-web/app/mappers/service_metrics_mapper.js
index 9c70194..6b55084 100644
--- a/ambari-web/app/mappers/service_metrics_mapper.js
+++ b/ambari-web/app/mappers/service_metrics_mapper.js
@@ -27,6 +27,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
id: 'ServiceInfo.service_name',
service_name: 'ServiceInfo.service_name',
work_status: 'ServiceInfo.state',
+ passive_state: 'ServiceInfo.passive_state',
critical_alerts_count: 'ServiceInfo.critical_alerts_count',
$rand: Math.random(),
$alerts: [ 1, 2, 3 ],
@@ -241,7 +242,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
App.store.loadMany(this.get('model'), result);
} else {
result.forEach(function (serviceJson) {
- var fields = ['work_status', 'rand', 'alerts', 'quick_links', 'host_components', 'tool_tip_content', 'critical_alerts_count'];
+ var fields = ['passive_state','work_status', 'rand', 'alerts', 'quick_links', 'host_components', 'tool_tip_content', 'critical_alerts_count'];
var service = this.get('model').find(serviceJson.id);
var modifiedData = this.getDiscrepancies(serviceJson, previousResponse.findProperty('id', serviceJson.id), fields);
if (modifiedData.isLoadNeeded) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 6244da9..0808934 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -23,7 +23,7 @@ require('utils/config');
App.Service = DS.Model.extend({
serviceName: DS.attr('string'),
-
+ passiveState: DS.attr('string'),
workStatus: DS.attr('string'),
rand: DS.attr('string'),
toolTipContent: DS.attr('string'),
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 1419840..2f4c999 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2098,6 +2098,10 @@ width:100%;
.operations-count {
background: #953B39;
}
+ .icon-medkit {
+ padding-left:6px;
+ color: black!important;
+ }
}
.quick-links-wrapper {
margin-top: -53px;
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index a83a42b..1f016c2 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -98,6 +98,25 @@ var urls = {
};
}
},
+ 'service.item.passive': {
+ 'real': '/clusters/{clusterName}/services/{serviceName}',
+ 'mock': '',
+ 'format': function (data) {
+ return {
+ type: 'PUT',
+ data: JSON.stringify({
+ RequestInfo: {
+ "context": data.requestInfo
+ },
+ Body: {
+ ServiceInfo: {
+ passive_state: data.passive_state
+ }
+ }
+ })
+ };
+ }
+ },
'service.stale_host_components.start_stop': {
'real': '/clusters/{clusterName}/host_components?' +
'HostRoles/stale_configs=true&HostRoles/component_name.in({componentNames})',
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/views/main/dashboard/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard/service.js b/ambari-web/app/views/main/dashboard/service.js
index cf0048e..b20285a 100644
--- a/ambari-web/app/views/main/dashboard/service.js
+++ b/ambari-web/app/views/main/dashboard/service.js
@@ -59,6 +59,9 @@ App.MainDashboardServiceHealthView = Em.View.extend({
},
healthStatus: function () {
+ if (this.get('service.passiveState') != 'ACTIVE') {
+ return 'icon-medkit';
+ }
var status = this.get('service.healthStatus');
switch (status) {
case 'green':
@@ -83,7 +86,7 @@ App.MainDashboardServiceHealthView = Em.View.extend({
}
return 'health-status-' + status;
- }.property('service.healthStatus'),
+ }.property('service.healthStatus','service.passiveState'),
didInsertElement: function () {
this.updateToolTip();
http://git-wip-us.apache.org/repos/asf/ambari/blob/72535217/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 683b5c1..e617e98 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -55,6 +55,8 @@ App.MainServiceItemView = Em.View.extend({
default:
options.push({action: 'runSmokeTest', cssClass: 'icon-thumbs-up-alt', 'label': Em.I18n.t('services.service.actions.run.smoke'), disabled:disabled});
}
+ var passiveLabel = service.get('passiveState') === "ACTIVE" ? Em.I18n.t('passiveState.turnOn') : Em.I18n.t('passiveState.turnOff');
+ options.push({action:'turnOnOffPassive', cssClass: 'icon-medkit', context:passiveLabel, 'label':passiveLabel , disabled: false});
return options;
}.property('controller.content', 'controller.isStopDisabled'),
isMaintenanceActive: function() {