You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by gn...@apache.org on 2017/02/02 12:42:36 UTC

ambari git commit: AMBARI-19842. Custom Action should be created without prompting for the action type.((Padma Priya N via gauravn7))

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 8075f5eb3 -> 4418789fc


AMBARI-19842. Custom Action should be created without prompting for the action type.((Padma Priya N via gauravn7))


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

Branch: refs/heads/branch-2.5
Commit: 4418789fc3f5c9725709667cc0c8be54f11d07c6
Parents: 8075f5e
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Thu Feb 2 18:12:00 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Thu Feb 2 18:12:00 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/flow-designer.js          | 11 --------
 .../ui/app/components/workflow-action-editor.js | 14 +++++++++-
 .../ui/app/domain/workflow-importer.js          |  3 +++
 .../app/templates/components/flow-designer.hbs  | 27 +-------------------
 .../components/workflow-action-editor.hbs       |  4 +++
 .../main/resources/ui/app/utils/constants.js    |  2 +-
 6 files changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index ad5f3f8..4618ab6 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -855,17 +855,6 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
       this.$("#kill-node-dialog").modal("hide");
       this.set('showCreateKillNode', false);
     },
-    addNode(type){
-      if(type === 'custom'){
-        this.$('#customTypeModal').modal('show');
-      }else{
-        this.send('addAction', type);
-      }
-    },
-    createCustomAction(type){
-      this.send('addAction', type);
-      this.set('customActionType', '');
-    },
     addAction(type){
       this.createSnapshot();
       var currentTransition=this.get("currentTransition");

http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
index 43eeb5b..d09de7d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/workflow-action-editor.js
@@ -92,7 +92,19 @@ export default Ember.Component.extend( Ember.Evented,{
       this.set('errors', Ember.A([]));
       let temp = x2js.xml_str2json(vkbeautify.xmlmin(value));
       if(temp){
-        this.set('actionModel', temp[this.get('actionType')]);
+        let tempKeys = Object.keys(temp);
+        let actionType = tempKeys && tempKeys.get('firstObject')? tempKeys.get('firstObject') : this.get('actionType');
+        if(CommonUtils.isSupportedAction(actionType)){
+          this.get('errors').pushObject({message: `Looks like you are creating "${actionType}" action. Please use the ${actionType} action editor.`});
+        }else{
+          this.set('currentNode.actionType', actionType);
+          this.set('actionType', actionType);
+        }
+        if(Ember.isBlank(temp[actionType])){
+          this.set('actionModel', {});
+        }else{
+          this.set('actionModel', temp[actionType]);
+        }
       }else{
         this.get('errors').pushObject({message:'Action Xml is syntatically incorrect'});
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-importer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-importer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-importer.js
index ff75e7e..ae566f2 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-importer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-importer.js
@@ -77,6 +77,9 @@ var WorkflowImporter= Ember.Object.extend({
     });
 
     importedWfActionVersions._keys.forEach(function(wfActionType){
+      if(!CommonUtils.isSupportedAction(wfActionType)){
+        return;
+      }
       var maxImportedActionVersion = Math.max(...importedWfActionVersions.get(wfActionType));
       var supportedVersions = this.get('schemaVersions').getSupportedVersions(wfActionType);
       importedWfActionVersions.get(wfActionType).forEach((version)=>{

http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
index df0a9ba..b9ecb11 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/flow-designer.hbs
@@ -268,7 +268,7 @@
         {{/if}}
       </div>
       <div id="workflow-actions" class="hidden">
-        {{workflow-actions element=popOverElement addNode="addNode" pasteNode="pasteNode" showImportActionNodeFileBrowser="showImportActionNodeFileBrowser" importActionNodeLocalFS="importActionNodeLocalFS" showAssetNodeList="showAssetNodeList" clipboard=clipboard}}
+        {{workflow-actions element=popOverElement addNode="addAction" pasteNode="pasteNode" showImportActionNodeFileBrowser="showImportActionNodeFileBrowser" importActionNodeLocalFS="importActionNodeLocalFS" showAssetNodeList="showAssetNodeList" clipboard=clipboard}}
       </div>
     </div>
   </div>
@@ -379,28 +379,3 @@
 {{#if showKillNodeManager}}
   {{#killnode-manager killNodes=workflow.killNodes killNode=killNode createKillnodeError=createKillnodeError createKillNode="createKillNode" deleteNode="deleteNode" addKillNodeMode=addKillNodeMode editMode=editMode closeKillNodeManager="closeKillNodeManager"}}{{/killnode-manager}}
 {{/if}}
-
-<div id="customTypeModal" class="modal fade" role="dialog">
-  <div class="modal-dialog">
-    <div class="modal-content">
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal">&times;</button>
-        <h4 class="modal-title">Custom Action</h4>
-      </div>
-      <div class="modal-body">
-        <form class="form-horizontal">
-          <div class="form-group">
-            <label for="inputEmail" class="control-label col-xs-2">Type</label>
-            <div class="col-xs-7">
-              {{input type="text" class="form-control" name="job-tracker" value=customActionType placeholder="Custom Action Type"}}
-            </div>
-          </div>
-        </form>
-      </div>
-      <div class="modal-footer">
-        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-        <button type="button" class="btn btn-primary" data-dismiss="modal" {{action 'createCustomAction' customActionType}}>OK</button>
-      </div>
-    </div>
-  </div>
-</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-action-editor.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-action-editor.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-action-editor.hbs
index 0c569ec..0810f64 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-action-editor.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/workflow-action-editor.hbs
@@ -68,6 +68,10 @@
                     <div class="panel panel-default">
                       <div class="panel-heading">Action XML</div>
                       <div class="panel-body handlerPanel">
+                        <div class="alert alert-info alert-dismissible" role="alert">
+                          <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                           Action extension should be configured in Oozie for the custom action to work.
+                        </div>
                         {{designer-errors errors=errors}}
                         {{textarea class="custom-action-xml" value=actionXml}}
                       </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/4418789f/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
index 1dd1c31..e410262 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/utils/constants.js
@@ -89,5 +89,5 @@ export default Ember.Object.create({
   elConstants : [
     '${YEAR}', '${MONTH}', '${DAY}', '${HOUR}', '${MINUTE}'
   ],
-  customActionEnabled : false
+  customActionEnabled : true
 });