AMBARI-21669 Provide ability on the UI to parse include/exclude files host task 
name. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5e9d170
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5e9d170
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5e9d170

Branch: refs/heads/branch-feature-AMBARI-21450
Commit: f5e9d170ed5e9f05bccee3e37c90aa17063b707d
Parents: 3c256b1
Author: Andrii Tkach <atk...@apache.org>
Authored: Mon Aug 7 16:24:50 2017 +0300
Committer: Andrii Tkach <atk...@apache.org>
Committed: Mon Aug 7 16:24:50 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/helper.js       | 11 ++++++++---
 ambari-web/test/utils/helper_test.js |  5 +++++
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f5e9d170/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index 4143d33..3e4cf44 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -636,19 +636,24 @@ App.format = {
     var detailArr = command_detail.split(' ');
     var self = this;
     var result = '';
+    var isIncludeExcludeFiles = false;
     detailArr.forEach( function(item) {
       // if the item has the pattern SERVICE/COMPONENT, drop the SERVICE part
-      if (item.contains('/')) {
+      if (item.contains('/') && !isIncludeExcludeFiles) {
         item = item.split('/')[1];
       }
-      if (item == 'DECOMMISSION,') {
+      if (item === 'DECOMMISSION,') {
         // ignore text 'DECOMMISSION,'( command came from 
'excluded/included'), here get the component name from request_inputs
-        item = (jQuery.parseJSON(request_inputs)) ? 
jQuery.parseJSON(request_inputs).slave_type : '';
+        var parsedInputs = jQuery.parseJSON(request_inputs);
+        item = (parsedInputs) ? (parsedInputs.slave_type || '') : '';
+        isIncludeExcludeFiles = (parsedInputs) ? 
parsedInputs.is_add_or_delete_slave_request === 'true' : false;
       }
       if (self.components[item]) {
         result = result + ' ' + self.components[item];
       } else if (self.command[item]) {
         result = result + ' ' + self.command[item];
+      } else if (isIncludeExcludeFiles) {
+        result = result + ' ' + item;
       } else {
         result = result + ' ' + self.role(item, false);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f5e9d170/ambari-web/test/utils/helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/helper_test.js 
b/ambari-web/test/utils/helper_test.js
index c5ec897..e5cd479 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -275,6 +275,11 @@ describe('utils/helper', function() {
         it('should return install repo message', function() {
           
expect(App.format.commandDetail(installRepo)).to.be.equal(Em.I18n.t('common.installRepo.task'));
         });
+        it('should return raw text when is_add_or_delete_slave_request=true', 
function() {
+          var inputs = '{"is_add_or_delete_slave_request":"true"}';
+          expect(App.format.commandDetail('DECOMMISSION, Update 
Include/Exclude Files', inputs))
+            .to.be.equal('  Update Include/Exclude Files');
+        });
       });
       describe('#taskStatus()', function(){
         var testable = [

Reply via email to