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/03 14:53:39 UTC

[35/50] [abbrv] ambari git commit: AMBARI-19852. Workflow name mandatory for save in Coordinator and Bundle (Venkata Sairam via pallavkul)

AMBARI-19852. Workflow name mandatory for save in Coordinator and Bundle (Venkata Sairam via pallavkul)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: ce822359b3199ac62cfb7b3fed00333ea780e734
Parents: 7c8931a
Author: pallavkul <pa...@gmail.com>
Authored: Thu Feb 2 23:07:05 2017 +0530
Committer: pallavkul <pa...@gmail.com>
Committed: Thu Feb 2 23:07:05 2017 +0530

----------------------------------------------------------------------
 .../resources/ui/app/components/bundle-config.js   |  5 ++++-
 .../resources/ui/app/components/coord-config.js    | 17 ++++++++++-------
 .../resources/ui/app/components/flow-designer.js   |  5 +++++
 3 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce822359/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 7b24d34..445b86e 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
@@ -390,9 +390,12 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
       this.set('showVersionSettings', value);
     },
     save(){
+      if (Ember.isBlank(this.$('[name=bundle_title]').val())) {
+        return;
+      }
       var isDraft = false, bundleXml;
       if(this.get('validations.isInvalid')) {
-       isDraft = true;
+        isDraft = true;
       }else{
         var bundleGenerator = BundleGenerator.create({bundle:this.get("bundle")});
         bundleXml = bundleGenerator.process();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce822359/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 57dbeb0..b045798 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
@@ -147,7 +147,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
     if(Ember.isBlank(this.get('coordinator.name'))){
       this.set('coordinator.name', Ember.copy(this.get('tabInfo.name')));
     }
-    this.schedulePersistWorkInProgress();    
+    this.schedulePersistWorkInProgress();
   },
   coordinatorFilePath : Ember.computed('tabInfo.filePath', function(){
     return this.get('tabInfo.filePath');
@@ -344,12 +344,12 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
       this.set('inputLogicEnabled', true);
     }
   },
-  validateChildComponents(){
+  validateChildComponents(showErrorMessage){
     var isChildComponentsValid = true;
     this.get('childComponents').forEach((context)=>{
       if(context.get('validations') && context.get('validations.isInvalid')){
         isChildComponentsValid =  false;
-        context.set('showErrorMessage', true);
+        context.set('showErrorMessage', showErrorMessage);
       }
     }.bind(this));
     return isChildComponentsValid;
@@ -457,7 +457,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
       this.send('submit');
     },
     submit(){
-      var isChildComponentsValid = this.validateChildComponents();
+      var isChildComponentsValid = this.validateChildComponents(true);
       if(this.get('validations.isInvalid') || !isChildComponentsValid) {
         this.set('showErrorMessage', true);
         return;
@@ -539,7 +539,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
       this.set('inputLogicExists', false);
     },
     preview(){
-      var isChildComponentsValid = this.validateChildComponents();
+      var isChildComponentsValid = this.validateChildComponents(true);
       if(this.get('validations.isInvalid') || !isChildComponentsValid) {
         this.set('showErrorMessage', true);
         return;
@@ -637,10 +637,13 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
       this.set('showVersionSettings', value);
     },
     save(){
+      if (Ember.isBlank(this.$('[name=coord_title]').val())) {
+        return;
+      }
       var isDraft = false, coordinatorXml;
-      var isChildComponentsValid = this.validateChildComponents();
+      var isChildComponentsValid = this.validateChildComponents(false);
       if(this.get('validations.isInvalid') || !isChildComponentsValid) {
-       isDraft = true;
+        isDraft = true;
       }else{
         var coordGenerator = CoordinatorGenerator.create({coordinator:this.get("coordinator")});
         coordinatorXml = coordGenerator.process();

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce822359/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index 4618ab6..90fba0d 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -695,9 +695,14 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
     }, 1000);
   },
   openSaveWorkflow() {
+    if(Ember.isBlank(this.$('[name=wf_title]').val())) {
+      this.set('errors',[{"message":"Workflow name is mandatory"}]);
+      return;
+    }
     var workflowGenerator = WorkflowGenerator.create({workflow:this.get("workflow"), workflowContext:this.get('workflowContext')});
     var workflowXml = workflowGenerator.process();
     var workflowJson = this.getWorkflowAsJson();
+    this.set('errors', []);
     var isDraft = this.get('workflowContext').hasErrors()? true: false;
     this.set("configForSave", {json : workflowJson, xml : workflowXml,isDraft : isDraft});
     this.set("showingSaveWorkflow",true);