Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DB68E1028A for ; Sat, 15 Feb 2014 00:30:37 +0000 (UTC) Received: (qmail 76341 invoked by uid 500); 15 Feb 2014 00:30:37 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 76319 invoked by uid 500); 15 Feb 2014 00:30:37 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 76312 invoked by uid 99); 15 Feb 2014 00:30:37 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Feb 2014 00:30:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D2C139277D3; Sat, 15 Feb 2014 00:30:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: yusaku@apache.org To: commits@ambari.apache.org Message-Id: <5cd69154b7b04831b4bb2c0ebc4a20c1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-4638. 'custom_command' is shown in Background Operations popup instead of action name. (xiwang via yusaku) Date: Sat, 15 Feb 2014 00:30:36 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/trunk 03a5ca8eb -> 9f4df9fd8 AMBARI-4638. 'custom_command' is shown in Background Operations popup instead of action name. (xiwang via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9f4df9fd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9f4df9fd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9f4df9fd Branch: refs/heads/trunk Commit: 9f4df9fd808369459556fa3049bf66d48b837bd6 Parents: 03a5ca8 Author: Yusaku Sako Authored: Fri Feb 14 16:29:50 2014 -0800 Committer: Yusaku Sako Committed: Fri Feb 14 16:30:30 2014 -0800 ---------------------------------------------------------------------- .../templates/common/host_progress_popup.hbs | 4 +- ambari-web/app/utils/ajax.js | 2 +- ambari-web/app/utils/helper.js | 44 ++++++++++++++++++++ ambari-web/app/utils/host_progress_popup.js | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9f4df9fd/ambari-web/app/templates/common/host_progress_popup.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/host_progress_popup.hbs b/ambari-web/app/templates/common/host_progress_popup.hbs index 1fcde93..bb57b82 100644 --- a/ambari-web/app/templates/common/host_progress_popup.hbs +++ b/ambari-web/app/templates/common/host_progress_popup.hbs @@ -158,7 +158,7 @@
{{taskInfo.startTime}}
@@ -179,7 +179,7 @@  {{t common.tasks}}
- {{view.openedTask.role}} {{view.openedTask.command}} + {{view.openedTask.commandDetail}}
{{t common.copy}} http://git-wip-us.apache.org/repos/asf/ambari/blob/9f4df9fd/ambari-web/app/utils/ajax.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js index 2d9a355..f520189 100644 --- a/ambari-web/app/utils/ajax.js +++ b/ambari-web/app/utils/ajax.js @@ -44,7 +44,7 @@ var urls = { 'testInProduction': true }, 'background_operations.get_by_request': { - 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true', + 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true', 'mock': '/data/background_operations/task_by_request{requestId}.json', 'testInProduction': true, 'format': function (data) { http://git-wip-us.apache.org/repos/asf/ambari/blob/9f4df9fd/ambari-web/app/utils/helper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js index 4399314..0cd61d4 100644 --- a/ambari-web/app/utils/helper.js +++ b/ambari-web/app/utils/helper.js @@ -205,11 +205,55 @@ App.format = { 'ZOOKEEPER_SERVICE_CHECK': 'ZooKeeper Service Check' }, + /** + * @type Object + */ + command: { + 'INSTALL': 'Install', + 'UNINSTALL': 'Uninstall', + 'START': 'Start', + 'STOP': 'Stop', + 'EXECUTE': 'Execute', + 'ABORT': 'Abort', + 'UPGRADE': 'Upgrade', + 'RESTART': 'Restart', + 'SERVICE_CHECK': 'Check', + 'DECOMMISSION,': 'Decommission,' + }, + + /** + * convert role to readable string + * @param role + */ role:function (role) { return this.components[role] ? this.components[role] : ''; }, /** + * convert command_detail to readable string, show the string for all tasks name + * @param command_detail + */ + commandDetail: function (command_detail) { + var detailArr = command_detail.split(' '); + var self = this; + var result = ''; + detailArr.forEach( function(item) { + // if the item has the pattern SERVICE/COMPONENT, drop the SERVICE part + if (item.contains('/')) { + item = item.split('/')[1]; + } + if (self.components[item]) { + result = result + ' ' + self.components[item]; + } else if (self.command[item]) { + result = result + ' ' + self.command[item]; + } else { + result = result + ' ' + item; + } + }); + return result; + }, + + /** * PENDING - Not queued yet for a host * QUEUED - Queued for a host * IN_PROGRESS - Host reported it is working http://git-wip-us.apache.org/repos/asf/ambari/blob/9f4df9fd/ambari-web/app/utils/host_progress_popup.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js index a41c07b..27d3ed7 100644 --- a/ambari-web/app/utils/host_progress_popup.js +++ b/ambari-web/app/utils/host_progress_popup.js @@ -269,6 +269,7 @@ App.HostPopup = Em.Object.create({ id: _task.Tasks.id, hostName: _task.Tasks.host_name, command: ( _task.Tasks.command.toLowerCase() != 'service_check') ? _task.Tasks.command.toLowerCase() : '', + commandDetail: App.format.commandDetail(_task.Tasks.command_detail), status: App.format.taskStatus(_task.Tasks.status), role: App.format.role(_task.Tasks.role), outputLog: Em.I18n.t('common.hostLog.popup.logDir.path') + Em.I18n.t('common.hostLog.popup.outputLog.value').format(_task.Tasks.id),