ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsai...@apache.org
Subject [ambari] branch trunk updated: "Global Configurations" defined in workflow XML are being lost during Import workflow (or) during "Reset workflow" (#2856)
Date Wed, 13 Mar 2019 05:20:51 GMT
This is an automated email from the ASF dual-hosted git repository.

vsairam pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e366b43  "Global Configurations" defined in workflow XML are being lost during Import
workflow (or) during "Reset workflow" (#2856)
e366b43 is described below

commit e366b43f499812df6005bb51f295bfd6a5f642fa
Author: Venkata Sairam Lanka <venkatasairam.lanka@gmail.com>
AuthorDate: Wed Mar 13 10:50:44 2019 +0530

    "Global Configurations" defined in workflow XML are being lost during Import workflow
(or) during "Reset workflow" (#2856)
    
    * wfm spark name node appending
    
    * Global Configurations defined in workflow XML are being lost during Import workflow
(or) during Reset workflow
---
 .../main/resources/ui/app/components/spark-action.js   | 18 ++++++++++++++++++
 .../main/resources/ui/app/domain/workflow-importer.js  |  9 +++++++++
 .../src/main/resources/ui/app/styles/app.less          |  3 +++
 .../ui/app/templates/components/spark-action.hbs       |  7 +++++++
 4 files changed, 37 insertions(+)

diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
index 1a778c4..513b77c 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/spark-action.js
@@ -54,6 +54,7 @@ export default Ember.Component.extend(Validations,{
     this.set('isJar', this.get('actionModel.jar') && this.get('actionModel.jar').endsWith('.jar'));
     this.sendAction('register','sparkAction', this);
   }.on('init'),
+  appendNameNode: false,
   initialize : function(){
     this.on('fileSelected',function(fileName){
       this.set(this.get('filePathModel'), fileName);
@@ -105,6 +106,20 @@ export default Ember.Component.extend(Validations,{
       this.$('#collapseOne').collapse('show');
     }
   }.on('didUpdate'),
+  validateJarPathAndAppend() {
+      let nameNode = this.get('actionModel.nameNode'), jar = this.get('actionModel.jar');
+      if(!jar) {
+        return;
+      }
+      this.toggleProperty('appendNameNode');
+      if(!jar.startsWith('${nameNode}') && this.get('appendNameNode')) {
+        this.set('actionModel.jar', `${nameNode}${jar}`);
+      } else if(jar.startsWith('${nameNode}') && this.get('appendNameNode')) {
+        this.set('actionModel.jar', `${jar}`);
+      } else {
+        this.set('actionModel.jar', jar.replace('${nameNode}', ''));
+      }
+  },
   actions : {
     openFileBrowser(model, context){
       if(undefined === context){
@@ -116,6 +131,9 @@ export default Ember.Component.extend(Validations,{
     register (name, context){
       this.sendAction('register',name , context);
     },
+    appendNamenode() {
+      this.validateJarPathAndAppend();
+    },
     onMasterChange (elt){
       var value = this.$(elt).val();
       if(value !== 'other'){
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 2afc304..dfc6875 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
@@ -63,6 +63,15 @@ var WorkflowImporter= Ember.Object.extend({
     var nodeMap=this.setupNodeMap(workflowAppJson,workflow,Ember.$(xmlDoc));
     this.setupTransitions(workflowAppJson,nodeMap);
     workflow.set("startNode",nodeMap.get("start").node);
+    let globalProperties = workflowJson["workflow-app"].global.configuration.property;
+    if(workflowJson["workflow-app"].global) {
+      if(Ember.isArray(globalProperties)) {
+        workflow.set("globalSetting", workflowJson["workflow-app"].global);
+      } else  {
+        workflow.set("globalSetting", {configuration : { property:[globalProperties] }} );
+      }
+    }
+
     this.populateKillNodes(workflow,nodeMap);
     return {workflow: workflow, errors: errors};
   },
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
index 9a35aca..95480d9 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/styles/app.less
@@ -1824,4 +1824,7 @@ input:invalid {
 .note-info {
   position: relative;
   top: 10px;
+}
+.spark-namenode {
+  top: 15px;
 }
\ No newline at end of file
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/spark-action.hbs
b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/spark-action.hbs
index c8f14d3..bebe3d3 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/spark-action.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/spark-action.hbs
@@ -49,6 +49,13 @@
     </div>
     {{/if}}
     <div class="form-group">
+      <label for="inputEmail" class="control-label col-xs-2">Append master<span
class="requiredField">&nbsp;*</span></label>
+      <div class="col-xs-2 spark-namenode">
+          <input type="checkbox" name="master" checked={{appendNameNode}} value="other"
onchange={{action "appendNamenode" value="target"}}>
+      </div>
+    </div>
+
+    <div class="form-group">
       <label for="inputEmail" class="control-label col-xs-2">Runs On<span class="requiredField">&nbsp;*</span></label>
       {{#each mastersList as |master|}}
       <div class="col-xs-2">


Mime
View raw message