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

[22/28] ambari git commit: AMBARI-20090. On submit of bundle, if any coordinator path contains variables, user should be notified about custom variables.(Padma Priya N via gauravn7)

AMBARI-20090. On submit of bundle, if any coordinator path contains variables, user should be notified about custom variables.(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/818a6409
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/818a6409
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/818a6409

Branch: refs/heads/branch-feature-AMBARI-20053
Commit: 818a64092b6d8fed6d233a2fd6fbda07c5f6800b
Parents: 4719b24
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Tue Feb 21 16:14:05 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Tue Feb 21 16:14:40 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/bundle-config.js          | 14 ++++----
 .../resources/ui/app/components/coord-config.js |  2 +-
 .../ui/app/domain/workflow-xml-generator.js     |  4 ---
 .../app/templates/components/bundle-config.hbs  |  2 +-
 .../ui/app/templates/components/job-config.hbs  | 37 +++++---------------
 5 files changed, 19 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/818a6409/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
index 9201d5c..3ccbc07 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
@@ -42,13 +42,13 @@ const Validations = buildValidations({
 
 export default Ember.Component.extend(Ember.Evented, Validations, {
   bundle : null,
-  errors: Ember.A([]),
   schemaVersions : SchemaVersions.create({}),
   propertyExtractor : Ember.inject.service('property-extractor'),
   fileBrowser : Ember.inject.service('file-browser'),
   workspaceManager : Ember.inject.service('workspace-manager'),
   initialize : function(){
     var self = this;
+    this.set('errors', Ember.A([]));
     this.get('workspaceManager').restoreWorkInProgress(this.get('tabInfo.id')).promise.then(function(draftBundle){
       self.loadBundle(draftBundle);
     }.bind(this)).catch(function(data){
@@ -98,7 +98,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       this.set('bundle.name', Ember.copy(this.get('tabInfo.name')));
     }
     this.schedulePersistWorkInProgress();
-  }, 
+  },
   schedulePersistWorkInProgress (){
     Ember.run.later(function(){
       this.persistWorkInProgress();
@@ -181,7 +181,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       deferred.resolve({data : data, type : type});
     }).fail(function(e){
       console.error(e);
-      deferred.reject();
+      deferred.reject(e);
     });
     return deferred;
   },
@@ -200,7 +200,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       deferred.resolve(data);
     }).fail(function(e){
       console.error(e);
-      deferred.reject();
+      deferred.reject(e);
     });
     return deferred;
   },
@@ -220,6 +220,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       var coordinatorJson = x2js.xml_str2json(coordinatorXml);
       var workflowPath = coordinatorJson['coordinator-app']['action']['workflow']['app-path'];
       if(this.get('propertyExtractor').containsParameters(workflowPath)){
+        this.set('containsParameteriedPaths', true);
         deferred.resolve(Array.from(coordProps.values()));
       }else{
         workflowPath = this.appendFileName(workflowPath, 'wf');
@@ -250,7 +251,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
     closeFileBrowser(){
       this.set("showingFileBrowser", false);
       this.get('fileBrowser').getContext().trigger('fileSelected', this.get('filePath'));
-      if(this.get('bundleFilePath')){
+      if(this.get('filePathModel') === 'bundleFilePath'){
         this.importBundle(Ember.copy(this.get('bundleFilePath')));
         this.set('bundleFilePath', null);
       }
@@ -327,6 +328,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       this.$('#loading').show();
       this.get('bundle.coordinators').forEach((coordinator) =>{
         if(this.get('propertyExtractor').containsParameters(coordinator.appPath)){
+          this.set('containsParameteriedPaths', true);
           return;
         }
         var deferred = this.getJobProperties(coordinator.appPath);
@@ -336,7 +338,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
         var combinedProps = [];
         var excludedProps = [];
         props.forEach((prop, index)=>{
-          var coordinator = this.get('bundle.coordinators').objectAt(0);
+          var coordinator = this.get('bundle.coordinators').objectAt(index);
           if(coordinator.configuration && coordinator.configuration.property){
             coordinator.configuration.property.forEach((config) => {
               var idx = prop.indexOf('${'+config.name+'}');

http://git-wip-us.apache.org/repos/asf/ambari/blob/818a6409/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
index c7da381..bbd619d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
@@ -517,7 +517,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
     closeFileBrowser(){
       this.set("showingFileBrowser", false);
       this.get('fileBrowser').getContext().trigger('fileSelected', this.get('filePath'));
-      if(this.get('coordinatorFilePath')){
+      if(this.get('filePathModel') === 'coordinatorFilePath'){
         this.importCoordinator(Ember.copy(this.get('coordinatorFilePath')));
         this.set('coordinatorFilePath', null);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/818a6409/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-xml-generator.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-xml-generator.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-xml-generator.js
index e30750f..eb8534b 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-xml-generator.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/workflow-xml-generator.js
@@ -44,10 +44,6 @@ var WorkflowGenerator= Ember.Object.extend({
     }
     this.get("workflowMapper").handleCredentialsGeneration(this.workflow.credentials,workflowObj["workflow-app"]);
     this.get("workflowMapper").hanldeParametersGeneration(this.workflow.parameters,workflowObj["workflow-app"]);
-    if (!this.ignoreErrors && (!workflowObj["workflow-app"].action || workflowObj["workflow-app"].action.length<1)){
-      this.workflowContext.addError({message : "Miniumum of one action node must exist"});
-      return;
-    }
     var reordered={"workflow-app":{}};
     var srcWorkflowApp=workflowObj["workflow-app"];
     var targetWorkflowApp=reordered["workflow-app"];

http://git-wip-us.apache.org/repos/asf/ambari/blob/818a6409/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
index 749a173..ca58431 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/bundle-config.hbs
@@ -124,7 +124,7 @@
   {{hdfs-browser closeFileBrowser="closeFileBrowser" selectFileCallback=selectFileCallback filePath=filePath}}
 {{/if}}
 {{#if showingJobConfig}}
-  {{job-config type='bundle' closeJobConfigs="closeBundleSubmitConfig" jobFilePath=bundleFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=bundleConfigs}}
+  {{job-config type='bundle' closeJobConfigs="closeBundleSubmitConfig" jobFilePath=bundleFilePath openFileBrowser="openFileBrowser" closeFileBrowser="closeFileBrowser" jobConfigs=bundleConfigs containsParameteriedPaths=containsParameteriedPaths}}
 {{/if}}
 {{#if showingResetConfirmation}}
   {{#confirmation-dialog title="Confirm Bundle Reset"

http://git-wip-us.apache.org/repos/asf/ambari/blob/818a6409/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-config.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-config.hbs b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-config.hbs
index 2ac56e8..0f7fe00 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-config.hbs
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/templates/components/job-config.hbs
@@ -28,33 +28,7 @@
       </div>
       <div class="modal-body">
         {{designer-errors errors=jobConfigs.errors}}
-        {{#if (and (eq type 'bundle') containsParameteriedPaths)}}
-        <div class="panel panel-default">
-          <div class="panel-body">
-            <div class="col-xs-24">
-              <span>The underlying workflow path is templatized.
-                 Please enter the workflow path to deduce the templatized properties in the workflow.
-               </span>
-            </div>
-            {{#each parameterizedPaths as |path index|}}
-            <div class="row form-group">
-              <div class="col-xs-3">
-                <label class="control-label" for="path">Workflow path</label><span class="requiredField">&nbsp;*</span>
-              </div>
-              <div class="col-xs-8">
-                <div class="input-group">
-                  {{input class="form-control" type="text" name=path.name value=path.value}}
-                  <span class="input-group-btn">
-                    <button type="button" class="btn btn-secondary" {{action "selectFile" path.name}}>Browse</button>
-                  </span>
-                </div>
-                {{field-error model=this field='filePath' showErrorMessage=showErrorMessage}}
-              </div>
-            </div>
-            {{/each}}
-          </div>
-        </div>
-        {{else if (and (eq type 'coord') containsParameteriedPaths)}}
+        {{#if (and (eq type 'coord') containsParameteriedPaths)}}
         <div class="col-xs-24">
           <div class="alert alert-warning" role="alert">
             Workflow path contains variables. Please provide the absolute path to auto detect templatized variables. Skip this step if you have configured all the templatized variables of the workflow in the coordinator.
@@ -75,6 +49,13 @@
           </div>
         </div>
         {{else}}
+        {{#if (and (eq type 'bundle') containsParameteriedPaths)}}
+          <div class="col-xs-24">
+            <div class="alert alert-warning" role="alert">
+              <span>Auto detecting variables is not possible as one or more underlying workflow/coordinator path contains variables.  You have to configure the variables in custom job properties/coordinator configuration.</span>
+            </div>
+          </div>
+        {{/if}}
         <div class="panel panel-default">
           <div class="panel-body">
             {{#if alertType}}
@@ -158,7 +139,7 @@
 
       </div>
       <div class="modal-footer">
-        {{#if containsParameteriedPaths}}
+        {{#if (and (eq type 'coord') containsParameteriedPaths)}}
           <button type="button" class="btn btn-default" {{action "skip"}}>Skip</button>
           <button type="button" class="btn btn-primary" {{action "next"}}>Next</button>
         {{else}}