|
@@ -20,30 +20,14 @@ var App = require('app');
|
|
var uiEffects = require('utils/ui_effects');
|
|
var uiEffects = require('utils/ui_effects');
|
|
|
|
|
|
App.HostComponentView = Em.View.extend({
|
|
App.HostComponentView = Em.View.extend({
|
|
|
|
+
|
|
templateName: require('templates/main/host/details/host_component'),
|
|
templateName: require('templates/main/host/details/host_component'),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @type {App.HostComponent}
|
|
* @type {App.HostComponent}
|
|
*/
|
|
*/
|
|
content: null,
|
|
content: null,
|
|
- didInsertElement: function () {
|
|
|
|
- App.tooltip($('[rel=componentHealthTooltip]'));
|
|
|
|
- App.tooltip($('[rel=passiveTooltip]'));
|
|
|
|
- if (this.get('isInProgress')) {
|
|
|
|
- this.doBlinking();
|
|
|
|
- }
|
|
|
|
- if (this.get('isDataNode')){
|
|
|
|
- this.loadDataNodeDecommissionStatus();
|
|
|
|
- }
|
|
|
|
- if (this.get('isNodeManager')){
|
|
|
|
- this.loadNodeManagerDecommissionStatus();
|
|
|
|
- }
|
|
|
|
- if (this.get('isTaskTracker')){
|
|
|
|
- this.loadTaskTrackerDecommissionStatus();
|
|
|
|
- }
|
|
|
|
- if (this.get('isRegionServer')){
|
|
|
|
- this.loadRegionServerDecommissionStatus();
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @type {App.HostComponent}
|
|
* @type {App.HostComponent}
|
|
*/
|
|
*/
|
|
@@ -128,6 +112,10 @@ App.HostComponentView = Em.View.extend({
|
|
return '';
|
|
return '';
|
|
}.property('content.passiveState','parentView.content.passiveState'),
|
|
}.property('content.passiveState','parentView.content.passiveState'),
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * CSS-class for host component status
|
|
|
|
+ * @type {String}
|
|
|
|
+ */
|
|
statusClass: function () {
|
|
statusClass: function () {
|
|
//If the component is DataNode
|
|
//If the component is DataNode
|
|
if (this.get('isDataNode')) {
|
|
if (this.get('isDataNode')) {
|
|
@@ -178,67 +166,57 @@ App.HostComponentView = Em.View.extend({
|
|
}.property('content.passiveState','workStatus', 'isDataNodeRecommissionAvailable', 'isNodeManagerRecommissionAvailable', 'isTaskTrackerRecommissionAvailable', 'isRegionServerRecommissionAvailable'),
|
|
}.property('content.passiveState','workStatus', 'isDataNodeRecommissionAvailable', 'isNodeManagerRecommissionAvailable', 'isTaskTrackerRecommissionAvailable', 'isRegionServerRecommissionAvailable'),
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * CSS-class for disabling drop-down menu with list of host component actions
|
|
|
|
+ * Disabled if host's <code>healthClass</code> is health-status-DEAD-YELLOW (lost heartbeat)
|
|
* @type {String}
|
|
* @type {String}
|
|
*/
|
|
*/
|
|
disabled: function () {
|
|
disabled: function () {
|
|
return (this.get('parentView.content.healthClass') === "health-status-DEAD-YELLOW") ? 'disabled' : '';
|
|
return (this.get('parentView.content.healthClass') === "health-status-DEAD-YELLOW") ? 'disabled' : '';
|
|
}.property('parentView.content.healthClass'),
|
|
}.property('parentView.content.healthClass'),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* For Upgrade failed state
|
|
* For Upgrade failed state
|
|
|
|
+ * @type {bool}
|
|
*/
|
|
*/
|
|
isUpgradeFailed: function () {
|
|
isUpgradeFailed: function () {
|
|
return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "upgrade_failed";
|
|
return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "upgrade_failed";
|
|
}.property("workStatus"),
|
|
}.property("workStatus"),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* For Install failed state
|
|
* For Install failed state
|
|
|
|
+ * @type {bool}
|
|
*/
|
|
*/
|
|
isInstallFailed: function () {
|
|
isInstallFailed: function () {
|
|
return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "install_failed";
|
|
return App.HostComponentStatus.getKeyName(this.get('workStatus')) === "install_failed";
|
|
}.property("workStatus"),
|
|
}.property("workStatus"),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Do blinking for 1 minute
|
|
|
|
- */
|
|
|
|
- doBlinking: function () {
|
|
|
|
- var workStatus = this.get('workStatus');
|
|
|
|
- var self = this;
|
|
|
|
- var pulsate = [ App.HostComponentStatus.starting, App.HostComponentStatus.stopping, App.HostComponentStatus.installing].contains(workStatus);
|
|
|
|
- if (!pulsate && (this.get('isDataNode') || this.get('isRegionServer') || this.get('isNodeManager') || this.get('isTaskTracker'))) {
|
|
|
|
- var component = this.get('content');
|
|
|
|
- if (component && workStatus != "INSTALLED") {
|
|
|
|
- pulsate = this.get('isDecommissioning');
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (pulsate && !self.get('isBlinking')) {
|
|
|
|
- self.set('isBlinking', true);
|
|
|
|
- uiEffects.pulsate(self.$('.components-health'), 1000, function () {
|
|
|
|
- self.set('isBlinking', false);
|
|
|
|
- self.doBlinking();
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- /**
|
|
|
|
- * Start blinking when host component is starting/stopping/decommissioning
|
|
|
|
|
|
+ * For Started and Starting states
|
|
|
|
+ * @type {bool}
|
|
*/
|
|
*/
|
|
- startBlinking: function () {
|
|
|
|
- this.$('.components-health').stop(true, true);
|
|
|
|
- this.$('.components-health').css({opacity: 1.0});
|
|
|
|
- this.doBlinking();
|
|
|
|
- }.observes('workStatus','isDataNodeRecommissionAvailable', 'isDecommissioning', 'isRegionServerRecommissionAvailable',
|
|
|
|
- 'isNodeManagerRecommissionAvailable', 'isTaskTrackerRecommissionAvailable'),
|
|
|
|
-
|
|
|
|
isStart: function () {
|
|
isStart: function () {
|
|
return (this.get('workStatus') == App.HostComponentStatus.started || this.get('workStatus') == App.HostComponentStatus.starting);
|
|
return (this.get('workStatus') == App.HostComponentStatus.started || this.get('workStatus') == App.HostComponentStatus.starting);
|
|
}.property('workStatus'),
|
|
}.property('workStatus'),
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * For Installed state
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
isStop: function () {
|
|
isStop: function () {
|
|
return (this.get('workStatus') == App.HostComponentStatus.stopped);
|
|
return (this.get('workStatus') == App.HostComponentStatus.stopped);
|
|
}.property('workStatus'),
|
|
}.property('workStatus'),
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * For Installing state
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
isInstalling: function () {
|
|
isInstalling: function () {
|
|
return (this.get('workStatus') == App.HostComponentStatus.installing);
|
|
return (this.get('workStatus') == App.HostComponentStatus.installing);
|
|
}.property('workStatus'),
|
|
}.property('workStatus'),
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* No action available while component is starting/stopping/unknown
|
|
* No action available while component is starting/stopping/unknown
|
|
|
|
+ * @type {String}
|
|
*/
|
|
*/
|
|
noActionAvailable: function () {
|
|
noActionAvailable: function () {
|
|
var workStatus = this.get('workStatus');
|
|
var workStatus = this.get('workStatus');
|
|
@@ -249,38 +227,148 @@ App.HostComponentView = Em.View.extend({
|
|
}
|
|
}
|
|
}.property('workStatus'),
|
|
}.property('workStatus'),
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * For Stopping or Starting states, also for decommissioning
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
isInProgress: function () {
|
|
isInProgress: function () {
|
|
return (this.get('workStatus') === App.HostComponentStatus.stopping ||
|
|
return (this.get('workStatus') === App.HostComponentStatus.stopping ||
|
|
this.get('workStatus') === App.HostComponentStatus.starting) ||
|
|
this.get('workStatus') === App.HostComponentStatus.starting) ||
|
|
this.get('isDecommissioning');
|
|
this.get('isDecommissioning');
|
|
}.property('workStatus', 'isDecommissioning'),
|
|
}.property('workStatus', 'isDecommissioning'),
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * For ACTIVE <code>passiveState</code> of host component
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isActive: function () {
|
|
|
|
+ return (this.get('content.passiveState') == "ACTIVE");
|
|
|
|
+ }.property('content.passiveState'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * For PASSIVE <code>passiveState</code> of host or service
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isImplied: function() {
|
|
|
|
+ return (this.get('parentView.content.passiveState') === 'PASSIVE' || this.get('content.service.passiveState') === 'PASSIVE');
|
|
|
|
+ }.property('parentView.content.passiveState', 'content.service.passiveState'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isDecommissioning: function () {
|
|
|
|
+ return ( (this.get('isDataNode') && this.get("isDataNodeDecommissioning")) || (this.get('isRegionServer') && this.get("isRegionServerDecommissioning"))
|
|
|
|
+ || (this.get('isNodeManager') && this.get("isNodeManagerDecommissioning")) || (this.get('isTaskTracker') && this.get('isTaskTrackerDecommissioning')));
|
|
|
|
+ }.property("workStatus", "isDataNodeDecommissioning", "isRegionServerDecommissioning", "isNodeManagerDecommissioning", "isTaskTrackerDecommissioning"),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Shows whether we need to show Delete button
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isDeletableComponent: function () {
|
|
|
|
+ return App.get('components.deletable').contains(this.get('content.componentName'));
|
|
|
|
+ }.property('content'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Host component with some <code>workStatus</code> can't be deleted (so, disable such action in the dropdown list)
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isDeleteComponentDisabled: function () {
|
|
|
|
+ return ![App.HostComponentStatus.stopped, App.HostComponentStatus.unknown, App.HostComponentStatus.install_failed, App.HostComponentStatus.upgrade_failed].contains(this.get('workStatus'));
|
|
|
|
+ }.property('workStatus'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check if component may be reassinged to another host
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isReassignable: function () {
|
|
|
|
+ return App.supports.reassignMaster && App.get('components.reassignable').contains(this.get('content.componentName')) && App.Host.find().content.length > 1;
|
|
|
|
+ }.property('content.componentName'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check if component is restartable
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isRestartableComponent: function() {
|
|
|
|
+ return App.get('components.restartable').contains(this.get('content.componentName'));
|
|
|
|
+ }.property('content'),
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Host component with some <code>workStatus</code> can't be restarted (so, disable such action in the dropdown list)
|
|
|
|
+ * @type {bool}
|
|
|
|
+ */
|
|
|
|
+ isRestartComponentDisabled: function() {
|
|
|
|
+ return ![App.HostComponentStatus.started].contains(this.get('workStatus'));
|
|
|
|
+ }.property('workStatus'),
|
|
|
|
+
|
|
|
|
+ didInsertElement: function () {
|
|
|
|
+ App.tooltip($('[rel=componentHealthTooltip]'));
|
|
|
|
+ App.tooltip($('[rel=passiveTooltip]'));
|
|
|
|
+ if (this.get('isInProgress')) {
|
|
|
|
+ this.doBlinking();
|
|
|
|
+ }
|
|
|
|
+ if (this.get('isDataNode')){
|
|
|
|
+ this.loadDataNodeDecommissionStatus();
|
|
|
|
+ }
|
|
|
|
+ if (this.get('isNodeManager')){
|
|
|
|
+ this.loadNodeManagerDecommissionStatus();
|
|
|
|
+ }
|
|
|
|
+ if (this.get('isTaskTracker')){
|
|
|
|
+ this.loadTaskTrackerDecommissionStatus();
|
|
|
|
+ }
|
|
|
|
+ if (this.get('isRegionServer')){
|
|
|
|
+ this.loadRegionServerDecommissionStatus();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Do blinking for 1 minute
|
|
|
|
+ */
|
|
|
|
+ doBlinking: function () {
|
|
|
|
+ var workStatus = this.get('workStatus');
|
|
|
|
+ var self = this;
|
|
|
|
+ var pulsate = [ App.HostComponentStatus.starting, App.HostComponentStatus.stopping, App.HostComponentStatus.installing].contains(workStatus);
|
|
|
|
+ if (!pulsate && (this.get('isDataNode') || this.get('isRegionServer') || this.get('isNodeManager') || this.get('isTaskTracker'))) {
|
|
|
|
+ var component = this.get('content');
|
|
|
|
+ if (component && workStatus != "INSTALLED") {
|
|
|
|
+ pulsate = this.get('isDecommissioning');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (pulsate && !self.get('isBlinking')) {
|
|
|
|
+ self.set('isBlinking', true);
|
|
|
|
+ uiEffects.pulsate(self.$('.components-health'), 1000, function () {
|
|
|
|
+ self.set('isBlinking', false);
|
|
|
|
+ self.doBlinking();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * Start blinking when host component is starting/stopping/decommissioning
|
|
|
|
+ */
|
|
|
|
+ startBlinking: function () {
|
|
|
|
+ this.$('.components-health').stop(true, true);
|
|
|
|
+ this.$('.components-health').css({opacity: 1.0});
|
|
|
|
+ this.doBlinking();
|
|
|
|
+ }.observes('workStatus','isDataNodeRecommissionAvailable', 'isDecommissioning', 'isRegionServerRecommissionAvailable',
|
|
|
|
+ 'isNodeManagerRecommissionAvailable', 'isTaskTrackerRecommissionAvailable'),
|
|
|
|
+
|
|
isDataNode: function () {
|
|
isDataNode: function () {
|
|
return this.get('content.componentName') === 'DATANODE';
|
|
return this.get('content.componentName') === 'DATANODE';
|
|
}.property('content'),
|
|
}.property('content'),
|
|
|
|
+
|
|
isNodeManager: function () {
|
|
isNodeManager: function () {
|
|
return this.get('content.componentName') === 'NODEMANAGER';
|
|
return this.get('content.componentName') === 'NODEMANAGER';
|
|
}.property('content'),
|
|
}.property('content'),
|
|
|
|
+
|
|
isTaskTracker: function () {
|
|
isTaskTracker: function () {
|
|
return this.get('content.componentName') === 'TASKTRACKER';
|
|
return this.get('content.componentName') === 'TASKTRACKER';
|
|
}.property('content'),
|
|
}.property('content'),
|
|
|
|
+
|
|
isRegionServer: function () {
|
|
isRegionServer: function () {
|
|
return this.get('content.componentName') === 'HBASE_REGIONSERVER';
|
|
return this.get('content.componentName') === 'HBASE_REGIONSERVER';
|
|
}.property('content'),
|
|
}.property('content'),
|
|
|
|
|
|
- isActive: function () {
|
|
|
|
- return (this.get('content.passiveState') == "ACTIVE");
|
|
|
|
- }.property('content.passiveState'),
|
|
|
|
-
|
|
|
|
- isImplied: function() {
|
|
|
|
- return (this.get('parentView.content.passiveState') === 'PASSIVE' || this.get('content.service.passiveState') === 'PASSIVE');
|
|
|
|
- }.property('content.passiveState'),
|
|
|
|
-
|
|
|
|
- isDecommissioning: function () {
|
|
|
|
- return ( (this.get('isDataNode') && this.get("isDataNodeDecommissioning")) || (this.get('isRegionServer') && this.get("isRegionServerDecommissioning"))
|
|
|
|
- || (this.get('isNodeManager') && this.get("isNodeManagerDecommissioning")) || (this.get('isTaskTracker') && this.get('isTaskTrackerDecommissioning')));
|
|
|
|
- }.property("workStatus", "isDataNodeDecommissioning", "isRegionServerDecommissioning", "isNodeManagerDecommissioning", "isTaskTrackerDecommissioning"),
|
|
|
|
-
|
|
|
|
isDataNodeDecommissioning: null,
|
|
isDataNodeDecommissioning: null,
|
|
isDataNodeDecommissionAvailable: null,
|
|
isDataNodeDecommissionAvailable: null,
|
|
isDataNodeRecommissionAvailable: null,
|
|
isDataNodeRecommissionAvailable: null,
|
|
@@ -620,31 +708,6 @@ App.HostComponentView = Em.View.extend({
|
|
deferred.resolve(desired_admin_state);
|
|
deferred.resolve(desired_admin_state);
|
|
});
|
|
});
|
|
return deferred.promise();
|
|
return deferred.promise();
|
|
- }.observes('App.router.mainHostDetailsController.content'),
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Shows whether we need to show Delete button
|
|
|
|
- */
|
|
|
|
- isDeletableComponent: function () {
|
|
|
|
- return App.get('components.deletable').contains(this.get('content.componentName'));
|
|
|
|
- }.property('content'),
|
|
|
|
-
|
|
|
|
- isDeleteComponentDisabled: function () {
|
|
|
|
- return !(this.get('workStatus') == App.HostComponentStatus.stopped || this.get('workStatus') == App.HostComponentStatus.unknown ||
|
|
|
|
- this.get('workStatus') == App.HostComponentStatus.install_failed || this.get('workStatus') == App.HostComponentStatus.upgrade_failed);
|
|
|
|
- }.property('workStatus'),
|
|
|
|
-
|
|
|
|
- isReassignable: function () {
|
|
|
|
- return App.supports.reassignMaster && App.get('components.reassignable').contains(this.get('content.componentName')) && App.Host.find().content.length > 1;
|
|
|
|
- }.property('content.componentName'),
|
|
|
|
-
|
|
|
|
- isRestartableComponent: function() {
|
|
|
|
- return App.get('components.restartable').contains(this.get('content.componentName'));
|
|
|
|
- }.property('content'),
|
|
|
|
-
|
|
|
|
- isRestartComponentDisabled: function() {
|
|
|
|
- var allowableStates = [App.HostComponentStatus.started];
|
|
|
|
- return !allowableStates.contains(this.get('workStatus'));
|
|
|
|
- }.property('workStatus')
|
|
|
|
|
|
+ }.observes('App.router.mainHostDetailsController.content')
|
|
|
|
|
|
});
|
|
});
|