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/24 14:19:36 UTC

[29/50] ambari git commit: AMBARI-20107. Action node shows unsupported properties even though there are none in workflow manager.(Padma Priya N via gauravn7)

AMBARI-20107. Action node shows unsupported properties even though there are none in workflow manager.(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/ba470c18
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ba470c18
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ba470c18

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: ba470c186875be371152e2a3ce37fb3c9a383f5a
Parents: f936bcf
Author: Gaurav Nagar <gr...@gmail.com>
Authored: Thu Feb 23 10:58:02 2017 +0530
Committer: Gaurav Nagar <gr...@gmail.com>
Committed: Thu Feb 23 10:58:02 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/workflow-action-editor.js | 40 ++++++++++++++++----
 .../components/workflow-action-editor.hbs       |  5 ++-
 2 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ba470c18/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 d09de7d..e19646d 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
@@ -62,8 +62,18 @@ export default Ember.Component.extend( Ember.Evented,{
   saveClicked : false,
   unsupportedPropertiesXml : Ember.computed('actionModel.unsupportedProperties', {
     get(key){
+      let unsupportedPropertiesXml;
+      if(!this.get('actionModel.unsupportedProperties')){
+        return unsupportedPropertiesXml;
+      }
       let x2js = new X2JS();
-      return vkbeautify.xml(x2js.json2xml_str(this.get('actionModel.unsupportedProperties')));
+      let unsupportedProperties = Ember.copy(this.get('actionModel.unsupportedProperties'));
+      delete unsupportedProperties['@id'];
+      delete unsupportedProperties.__jsogObjectId;
+      if(!Ember.isEmpty(Object.keys(unsupportedProperties))){
+        unsupportedPropertiesXml = vkbeautify.xml(x2js.json2xml_str(this.get('actionModel.unsupportedProperties')));
+      }
+      return unsupportedPropertiesXml;
     },
     set(key, value) {
       let x2js = new X2JS();
@@ -75,12 +85,15 @@ export default Ember.Component.extend( Ember.Evented,{
       return value;
     }
   }),
+  containsUnsupportedProperties : Ember.computed('unsupportedPropertiesXml', function(){
+    return this.get('unsupportedPropertiesXml') && this.get('unsupportedPropertiesXml').length > 0;
+  }),
   actionXml : Ember.computed('actionModel', {
     get(key) {
       let x2js = new X2JS();
       var startTag = `<${this.get('actionType')}`;
       Object.keys(this.get('actionModel')).forEach(key => {
-        if(key.startsWith('_')){
+        if(key.startsWith('_') && key !== '__jsogObjectId'){
           startTag = `${startTag} ${key.substr(1)}="${this.get('actionModel')[key]}"`;
         }
       });
@@ -150,11 +163,6 @@ export default Ember.Component.extend( Ember.Evented,{
       delete this.get('actionModel').slaInfo;
       delete this.get('actionModel').slaEnabled;
     }
-    if(this.get('actionModel.unsupportedProperties') && !Ember.isEmpty(Object.keys(this.get('actionModel.unsupportedProperties')))){
-      this.set('containsUnsupportedProperties', true);
-    }else{
-      this.set('containsUnsupportedProperties', false);
-    }
   }.on('init'),
   initialize : function(){
     this.$('#action_properties_dialog').modal({
@@ -203,6 +211,19 @@ export default Ember.Component.extend( Ember.Evented,{
       }
     });
   },
+  validateDecisionNode(){
+    let containsOtherNodes = false;
+    this.get('actionModel').forEach((model)=>{
+      if(model.node.type !== 'kill'){
+        containsOtherNodes = true;
+      }
+    });
+    if(!containsOtherNodes){
+      this.get('errors').pushObject({message:'Atleast one of the decision branches should transition to a node other than a kill node.'});
+    }else{
+      this.get('errors').clear();
+    }
+  },
   actions : {
     closeEditor (){
       this.sendAction('close');
@@ -237,6 +258,11 @@ export default Ember.Component.extend( Ember.Evented,{
     },
     registerChild (name, context){
       this.get('childComponents').set(name, context);
+    },
+    showUnsupportedProperties(){
+      this.$('#action_properties_dialog .modal-body').animate({
+        scrollTop: this.$("#unsupported-props").offset().top
+      }, 'fast');
     }
   }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/ba470c18/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 fae2d3d..788916b 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
@@ -32,11 +32,12 @@
         <div>
             <form class="form-horizontal" id="action_properties">
               {{#if (eq nodeType 'decision')}}
-                {{#decision-config actionModel=actionModel killNodes=killNodes register="registerChild"}}{{/decision-config}}
+                {{designer-errors errors=errors}}
+                {{#decision-config currentNode=currentNode actionModel=actionModel killNodes=killNodes register="registerChild"}}{{/decision-config}}
               {{/if}}
               {{#if (eq nodeType 'action')}}
                 {{#if containsUnsupportedProperties}}
-                  <span class="unsupported-elt-warning"> <p><a href='#unsupported-props'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>Action contains elements that are not currently supported by the designer.</a></p></span>
+                  <span class="unsupported-elt-warning"> <p><a href {{action "showUnsupportedProperties"}}><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>Action contains elements that are not currently supported by the designer.</a></p></span>
                 {{/if}}
                 {{#if (eq actionType 'java')}}
                   {{#java-action actionModel=actionModel transition=transition killNodes=killNodes openFileBrowser="openFileBrowser" register="registerChild" addKillNode="addKillNode" currentNode=currentNode credentials=credentials}}{{/java-action}}