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/b5ee4c57 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b5ee4c57 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b5ee4c57 Branch: refs/heads/branch-dev-patch-upgrade Commit: b5ee4c57a0d462e10a753b4613c5c8b118865b19 Parents: db36bd9 Author: Gaurav Nagar <[email protected]> Authored: Thu Feb 2 18:12:00 2017 +0530 Committer: Gaurav Nagar <[email protected]> Committed: Thu Feb 2 18:14:10 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/b5ee4c57/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/b5ee4c57/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/b5ee4c57/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/b5ee4c57/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">×</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/b5ee4c57/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">×</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/b5ee4c57/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 });
