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 16:52:50 UTC
git commit: AMBARI-4473 Maintenance Mode: Host Detail page (Host
Actions button). (ababiichuk)
Updated Branches:
refs/heads/trunk 16773c272 -> a1995263f
AMBARI-4473 Maintenance Mode: Host Detail page (Host 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/a1995263
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a1995263
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a1995263
Branch: refs/heads/trunk
Commit: a1995263fd2f68e3869c81f5f24cd731583611e7
Parents: 16773c2
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Thu Jan 30 17:49:39 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Thu Jan 30 17:52:40 2014 +0200
----------------------------------------------------------------------
.../controllers/global/cluster_controller.js | 4 ++--
ambari-web/app/controllers/main/host/details.js | 25 ++++++++++++++++++++
ambari-web/app/models/host.js | 3 +++
ambari-web/app/models/host_component.js | 2 +-
ambari-web/app/views/main/host/details.js | 10 ++++++--
ambari-web/app/views/main/host/summary.js | 2 +-
6 files changed, 40 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index f8c4fea..cdfb664 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -202,10 +202,10 @@ App.ClusterController = Em.Controller.extend({
return false;
}
var testUrl = App.get('isHadoop2Stack') ? '/data/hosts/HDP2/hc_host_status.json' : '/data/dashboard/services.json';
- var statusUrl = '/hosts?fields=Hosts/host_status,host_components/HostRoles/state,host_components/HostRoles/passive_state&minimal_response=true';
+ var statusUrl = '/hosts?fields=Hosts/host_status,Hosts/passive_state,host_components/HostRoles/state,host_components/HostRoles/passive_state&minimal_response=true';
if (isInitialLoad) {
testUrl = '/data/hosts/HDP2/hosts_init.json';
- statusUrl = '/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,' +
+ statusUrl = '/hosts?fields=Hosts/host_name,Hosts/passive_state,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,' +
'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components/HostRoles/state,host_components/HostRoles/passive_state,' +
'Hosts/disk_info,metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,' +
'metrics/memory/mem_total,metrics/memory/mem_free,alerts/summary&minimal_response=true';
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index f749e44..6358e65 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -939,11 +939,36 @@ App.MainHostDetailsController = Em.Controller.extend({
case "restartAllComponents":
this.doRestartAllComponents();
break;
+ case "onOffPassiveModeForHost":
+ this.onOffPassiveModeForHost(option.context);
+ break;
default:
break;
}
},
+ onOffPassiveModeForHost: function(context) {
+ var state = context.active ? 'PASSIVE' : 'ACTIVE';
+ var self = this;
+ App.showConfirmationPopup(function() {
+ self.hostPassiveModeRequest(state, context.label)
+ },
+ Em.I18n.t('hosts.passiveMode.popup').format(context.active ? 'On' : 'Off',this.get('content.hostName'))
+ );
+ },
+
+ hostPassiveModeRequest: function(state,message) {
+ App.ajax.send({
+ name: 'bulk_request.hosts.passive_state',
+ sender: this,
+ data: {
+ hostNames: this.get('content.hostName'),
+ passive_state: state,
+ requestInfo: message
+ }
+ });
+ },
+
doStartAllComponents: function() {
var self = this;
var components = this.get('content.hostComponents');
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/models/host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index 7319cc2..297607f 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -209,6 +209,9 @@ App.Host = DS.Model.extend({
* @returns {String}
*/
healthClass: function(){
+ if (this.get('passiveState')!= 'ACTIVE') {
+ return 'icon-medkit';
+ }
var statusMap = {
'UNKNOWN': 'health-status-DEAD-YELLOW',
'HEALTHY': 'health-status-LIVE',
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 591b1c4..3d8384a 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -197,7 +197,7 @@ App.HostComponentStatus = {
case this.unknown:
return 'unknown';
}
- return 'Unknown';
+ return 'unknown';
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/views/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 006297a..13e666e 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -26,13 +26,19 @@ App.MainHostDetailsView = Em.View.extend({
return App.router.get('mainHostDetailsController.content');
}.property('App.router.mainHostDetailsController.content'),
+ isActive: function() {
+ return this.get('controller.content.passiveState') === "ACTIVE";
+ }.property('controller.content.passiveState'),
+
maintenance: function(){
+ var onOff = this.get('isActive') ? "On" : "Off";
return [
{action: 'startAllComponents', cssClass: 'icon-play enabled', 'label': this.t('hosts.host.details.startAllComponents')},
{action: 'stopAllComponents', cssClass: 'icon-stop enabled', 'label': this.t('hosts.host.details.stopAllComponents')},
{action: 'restartAllComponents', cssClass: 'icon-forward enabled', 'label': this.t('hosts.host.details.restartAllComponents')},
- {action: 'deleteHost', cssClass: 'icon-remove enabled', 'label': this.t('hosts.host.details.deleteHost')}];
- }.property('controller.content'),
+ {action: 'deleteHost', cssClass: 'icon-remove enabled', 'label': this.t('hosts.host.details.deleteHost')},
+ {action: 'onOffPassiveModeForHost', cssClass: 'icon-medkit enabled', active:this.get('isActive'), 'label': this.t('passiveState.turn' + onOff)}];
+ }.property('controller.content','isActive'),
didInsertElement: function() {
App.tooltip($("[rel='HealthTooltip']"));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/a1995263/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 6703800..e3befcc 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -332,7 +332,7 @@ App.MainHostSummaryView = Em.View.extend({
}
//Class when maintenance
- if (this.get('content.passiveState') === "PASSIVE") {
+ if (this.get('content.passiveState') != "ACTIVE") {
return 'icon-medkit';
}