You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/02/17 22:06:27 UTC

[28/50] [abbrv] ambari git commit: AMBARI-20041. Custom job.properties are not retained in the workflow designer.(Venkata Sairam via gauravn7)

AMBARI-20041. Custom job.properties are not retained in the workflow designer.(Venkata Sairam via gauravn7)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ea82a59de4b170a10178eb1cc6385a8010e774fc
Parents: fb322e2
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Thu Feb 16 18:33:24 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Thu Feb 16 18:33:54 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/designer-workspace.js          | 15 ++++++++++++---
 .../main/resources/ui/app/components/job-config.js   | 11 +++++++++--
 .../main/resources/ui/app/components/job-details.js  |  4 +++-
 .../src/main/resources/ui/app/routes/design.js       |  6 +++---
 .../ui/app/templates/components/flow-designer.hbs    |  2 +-
 5 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea82a59d/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
index f93e1b8..74de3b7 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/designer-workspace.js
@@ -53,13 +53,13 @@ export default Ember.Component.extend({
         this.get('tabs').forEach((tab)=>{
           this.get('tabCounter').set(tab.type, (this.get('tabCounter').get(tab.type)) + 1);
         }, this);
-        Ember.getOwner(this).lookup('route:design').on('openNewTab', function(path, type){
+        Ember.getOwner(this).lookup('route:design').on('openNewTab', function(path, type, isImportedFromDesigner, configuration){
           if(type === 'COORDINATOR'){
             this.createNewTab('coord', path);
           }else if(type === 'BUNDLE'){
             this.createNewTab('bundle', path);
           }else{
-            this.createNewTab('wf', path);
+            this.createNewTab('wf', path, isImportedFromDesigner, configuration);
           }
         }.bind(this));
 
@@ -103,9 +103,17 @@ export default Ember.Component.extend({
       }.bind(this));
     }, 1000);
   },
-  createNewTab : function(type, path){
+  setWFConfigProperties(tab ,isImportedFromDesigner, configuration){
+    if(isImportedFromDesigner) {
+      tab.isImportedFromDesigner = true;
+      tab.configuration = configuration;
+    }
+    return tab;
+  },
+  createNewTab : function(type, path, isImportedFromDesigner, configuration){
     var existingTab = this.get('tabs').findBy("filePath", path);
     if(existingTab && path){
+      existingTab = this.setWFConfigProperties(existingTab, isImportedFromDesigner, configuration);
       this.$('.nav-tabs a[href="#' + existingTab.id + '"]').tab("show");
       return;
     }
@@ -117,6 +125,7 @@ export default Ember.Component.extend({
     if(path){
       tab.path = path;
     }
+    tab = this.setWFConfigProperties(tab, isImportedFromDesigner, configuration);
     this.$('.nav-tabs li').removeClass('active');
     this.$('.tab-content .tab-pane').removeClass('active');
     this.get('tabs').pushObject(tab);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea82a59d/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
index f364e30..00dedbb 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-config.js
@@ -112,7 +112,7 @@ export default Ember.Component.extend(Validations, {
 
   extractJobProperties(){
     var jobProperties = [];
-    var jobParams = this.get("jobConfigs").params;
+    var jobParams = this.get("jobConfigs").params, self = this;
     this.get("jobProps").forEach(function(value) {
       if (value!== Constants.defaultNameNodeValue && value!==Constants.rmDefaultValue){
         var propName = value.trim().substring(2, value.length-1);
@@ -125,9 +125,16 @@ export default Ember.Component.extend(Validations, {
             isRequired = true;
           }
         }
+        let val = null, tabData = self.get("tabInfo");
+        if(tabData && tabData.isImportedFromDesigner && tabData.configuration && tabData.configuration.settings && tabData.configuration.settings.configuration && tabData.configuration.settings.configuration.property) {
+          let propVal = tabData.configuration.settings.configuration.property.findBy('name', propName);
+          if(propVal) {
+            val = propVal.value
+          }
+        }
         var prop= Ember.Object.create({
           name: propName,
-          value: null,
+          value: val,
           isRequired : isRequired
         });
         jobProperties.push(prop);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea82a59d/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
index fe60793..f659317 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/job-details.js
@@ -480,7 +480,9 @@ export default Ember.Component.extend({
         this.sendAction('showCoord', coordId);
       },
       editWorkflow(path){
-        this.sendAction('editWorkflow', path);
+        var x2js = new X2JS();
+        var configurationObj  = x2js.xml_str2json(this.get('model.conf'));
+        this.sendAction('editWorkflow', path, null, true, {"settings":configurationObj});
       }
     }
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea82a59d/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js
index 25a3266..b5f0fad 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/routes/design.js
@@ -71,8 +71,8 @@ export default Ember.Route.extend(Ember.Evented, {
       this.set('failedSchemaVersions', true);
       transition.retry();
     },
-    editWorkflow(path, type){
-      this.trigger('openNewTab', path, type);
+    editWorkflow(path, type, isImportedFromDesigner, configuration){
+      this.trigger('openNewTab', path, type, isImportedFromDesigner, configuration);
     },
     showDashboard(){
       this.controller.set('dashboardShown', true);
@@ -90,4 +90,4 @@ export default Ember.Route.extend(Ember.Evented, {
       this.transitionTo('design');
     }
   }
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea82a59d/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 ff92f7d..0356e9c 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
@@ -284,7 +284,7 @@
   {{save-wf type='wf' close="closeSaveWorkflow" jobFilePath=workflowFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=configForSave}}
 {{/if}}
 {{#if showingWorkflowConfigProps}}
-  {{job-config type='wf' closeJobConfigs="closeWorkflowSubmitConfigs" jobFilePath=workflowFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=workflowSubmitConfigs isDryrun=dryrun}}
+  {{job-config type='wf' closeJobConfigs="closeWorkflowSubmitConfigs" jobFilePath=workflowFilePath tabInfo=tabInfo openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=workflowSubmitConfigs isDryrun=dryrun}}
 {{/if}}
 {{#if showGlobalConfig}}
   {{#global-config closeGlobalConfig="closeWorkflowGlobalProps" saveGlobalConfig="saveGlobalConfig" actionModel=globalConfig}}{{/global-config}}