Repository: ambari Updated Branches: refs/heads/trunk c4d131fbc -> 8c68301d0
AMBARI-9070 Single node cluster has 'Move ...' and "Enable HA" service actions for HDFS and YARN enabled. (ababiichuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8c68301d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8c68301d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8c68301d Branch: refs/heads/trunk Commit: 8c68301d0d9c0aeb2a397f9d919d25e21da82ab1 Parents: a9ca6fa Author: aBabiichuk <[email protected]> Authored: Fri Jan 9 19:23:21 2015 +0200 Committer: aBabiichuk <[email protected]> Committed: Fri Jan 9 19:23:35 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/app.js | 9 +++++++++ ambari-web/app/views/main/service/item.js | 8 +++++--- ambari-web/test/views/main/service/item_test.js | 11 +++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8c68301d/ambari-web/app/app.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js index 3466f28..339224b 100644 --- a/ambari-web/app/app.js +++ b/ambari-web/app/app.js @@ -137,6 +137,15 @@ module.exports = Em.Application.create({ return Em.get((this.get('currentStackVersion') || this.get('defaultStackVersion')).match(/(.+)-\d.+/), '1'); }.property('currentStackVersion', 'defaultStackVersion'), + /** + * true if cluster has only 1 host + * for now is used to disable move/HA actions + * @type {boolean} + */ + isSingleNode: function() { + return this.get('allHostNames.length') === 1; + }.property('allHostNames.length'), + allHostNames: [], currentStackVersionNumber: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/8c68301d/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 daae98f..857f1a1 100644 --- a/ambari-web/app/views/main/service/item.js +++ b/ambari-web/app/views/main/service/item.js @@ -89,20 +89,22 @@ App.MainServiceItemView = Em.View.extend({ action: App.get('isHaEnabled') ? 'disableHighAvailability' : 'enableHighAvailability', label: App.get('isHaEnabled') ? Em.I18n.t('admin.highAvailability.button.disable') : Em.I18n.t('admin.highAvailability.button.enable'), cssClass: App.get('isHaEnabled') ? 'icon-arrow-down' : 'icon-arrow-up', - isHidden: (App.get('isHaEnabled') || (/^1.3/.test(App.get('currentStackVersionNumber')))) + isHidden: (App.get('isHaEnabled') || (/^1.3/.test(App.get('currentStackVersionNumber')))), + disabled: App.get('isSingleNode') }, TOGGLE_RM_HA: { action: 'enableRMHighAvailability', label: Em.I18n.t('admin.rm_highAvailability.button.enable'), cssClass: 'icon-arrow-up', - isHidden: App.get('isRMHaEnabled') + isHidden: App.get('isRMHaEnabled'), + disabled: App.get('isSingleNode') }, MOVE_COMPONENT: { action: 'reassignMaster', context: '', label: Em.I18n.t('services.service.actions.reassign.master'), cssClass: 'icon-share-alt', - disabled: false + disabled: App.get('isSingleNode') }, STARTDEMOLDAP: { action: 'startLdapKnox', http://git-wip-us.apache.org/repos/asf/ambari/blob/8c68301d/ambari-web/test/views/main/service/item_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js index c4e847c..bb08228 100644 --- a/ambari-web/test/views/main/service/item_test.js +++ b/ambari-web/test/views/main/service/item_test.js @@ -77,6 +77,7 @@ describe('App.MainServiceItemView', function () { { serviceName: "HDFS", displayName: "HDFS", + isSingleNode: true, serviceTypes: ["HA_MODE"], hostComponents: [ Em.Object.create({ @@ -103,9 +104,9 @@ describe('App.MainServiceItemView', function () { result: [ {"action": "restartAllHostComponents", "context": "HDFS", "label": "Restart All", "cssClass": "icon-repeat", "disabled": false}, {"action": "rollingRestart", "label": "Restart DataNodes", "cssClass": "icon-time", "disabled": false, "context": "DATANODE"}, - {"action": "reassignMaster", "context": "NAMENODE", "label": "Move NameNode", "cssClass": "icon-share-alt", "disabled": false}, - {"action": "reassignMaster", "context": "SECONDARY_NAMENODE", "label": "Move SNameNode", "cssClass": "icon-share-alt", "disabled": false}, - {"action": "enableHighAvailability", "label": "Enable NameNode HA", "cssClass": "icon-arrow-up", "isHidden": false}, + {"action": "reassignMaster", "context": "NAMENODE", "label": "Move NameNode", "cssClass": "icon-share-alt", "disabled": true}, + {"action": "reassignMaster", "context": "SECONDARY_NAMENODE", "label": "Move SNameNode", "cssClass": "icon-share-alt", "disabled": true}, + {"action": "enableHighAvailability", "label": "Enable NameNode HA", "cssClass": "icon-arrow-up", "isHidden": false, "disabled": true,}, {"action": "runSmokeTest", "label": "Run Service Check", "cssClass": "icon-thumbs-up-alt"}, {"action": "turnOnOffPassive", "context": "Turn On Maintenance Mode for HDFS", "label": "Turn On Maintenance Mode", "cssClass": "icon-medkit", "disabled": false}, {"action": "rebalanceHdfsNodes", "customCommand": "REBALANCEHDFS", "context": "Rebalance HDFS", "label": "Rebalance HDFS", "cssClass": "icon-refresh", "disabled": false}, @@ -172,7 +173,7 @@ describe('App.MainServiceItemView', function () { {"action": "rollingRestart", "label": "Restart NodeManagers", "cssClass": "icon-time", "disabled": false, "context": "NODEMANAGER"}, {"action": "reassignMaster", "context": "APP_TIMELINE_SERVER", "label": "Move App Timeline Server", "cssClass": "icon-share-alt", "disabled": false}, {"action": "reassignMaster", "context": "RESOURCEMANAGER", "label": "Move ResourceManager", "cssClass": "icon-share-alt", "disabled": false}, - {"action": "enableRMHighAvailability", "label": "Enable ResourceManager HA", "cssClass": "icon-arrow-up", "isHidden": false}, + {"action": "enableRMHighAvailability", "label": "Enable ResourceManager HA", "cssClass": "icon-arrow-up", "isHidden": false, disabled: false}, {"action": "runSmokeTest", "label": "Run Service Check", "cssClass": "icon-thumbs-up-alt"}, {"action": "turnOnOffPassive", "context": "Turn On Maintenance Mode for YARN", "label": "Turn On Maintenance Mode", "cssClass": "icon-medkit", "disabled": false}, {"action": "downloadClientConfigs", "label": "Download Client Configs", "cssClass": "icon-download-alt", "isHidden": true, "disabled": false, "hasSubmenu": false, "submenuOptions": []} @@ -330,6 +331,8 @@ describe('App.MainServiceItemView', function () { sinon.stub(App, 'get', function (k) { switch (k) { + case 'isSingleNode': + return (view.get('controller.content.serviceName') == 'HDFS'); case 'supports.autoRollbackHA': case 'isRMHaEnabled': case 'isHaEnabled':
