"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
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 @@
     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 @@
       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 @@
     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 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 @@
 .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">