You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/02/15 01:30:36 UTC
git commit: AMBARI-4638. 'custom_command' is shown in Background
Operations popup instead of action name. (xiwang via yusaku)
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 <yu...@hortonworks.com>
Authored: Fri Feb 14 16:29:50 2014 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
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 @@
<div class="operation-name-icon-wrap">
<i {{bindAttr class="taskInfo.status taskInfo.icon"}}></i>
<a href="#">
- {{taskInfo.role}} {{taskInfo.command}}
+ {{taskInfo.commandDetail}}
</a>
</div>
<div class="time-summary start-time-text">{{taskInfo.startTime}}</div>
@@ -179,7 +179,7 @@
<a class="task-detail-back" href="javascript:void(null)" {{action backToTaskList}} ><i class="icon-arrow-left"></i> {{t common.tasks}}</a>
<div>
<i {{bindAttr class="view.openedTask.status :task-detail-status-ico view.openedTask.icon"}} class="task-detail-status-ico"></i>
- <span class="task-detail-log-rolename" >{{view.openedTask.role}} {{view.openedTask.command}}</span>
+ <span class="task-detail-log-rolename" >{{view.openedTask.commandDetail}}</span>
</div>
<div class="task-detail-ico-wrap">
<a title="Click to Copy" {{action "textTrigger" taskInfo target="view"}} class="task-detail-copy"><i class="icon-copy"></i> {{t common.copy}}</a>
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),