You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/02/18 11:37:03 UTC

[11/27] brooklyn-ui git commit: minor bug fixes

minor bug fixes


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/438132fc
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/438132fc
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/438132fc

Branch: refs/heads/master
Commit: 438132fcf49e7c97fafc6c334cfcdbe00a40cea7
Parents: 4cd4fea
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Feb 11 18:03:26 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Feb 11 18:03:26 2016 +0000

----------------------------------------------------------------------
 .../assets/js/view/application-add-wizard.js    | 41 ++++++++++----------
 src/main/webapp/assets/js/view/editor.js        |  3 --
 2 files changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/438132fc/src/main/webapp/assets/js/view/application-add-wizard.js
----------------------------------------------------------------------
diff --git a/src/main/webapp/assets/js/view/application-add-wizard.js b/src/main/webapp/assets/js/view/application-add-wizard.js
index 1436eea..f57023a 100644
--- a/src/main/webapp/assets/js/view/application-add-wizard.js
+++ b/src/main/webapp/assets/js/view/application-add-wizard.js
@@ -97,6 +97,20 @@ define([
             return value;
         }
     }
+
+    function redirectToEditorTabToDeployId(catalogId){
+        redirectTo("/v1/editor/app/"+ (typeof catalogId === 'string' ? catalogId : '')); 
+    }
+    function redirectToEditorTabToDeployYaml(yaml){
+        redirectTo("/v1/editor/app/_/"+encodeURIComponent(yaml));
+    }
+    function redirectTo(url){
+        var $modal = $('.add-app #modal-container .modal');
+        $modal.modal('hide');
+        $modal.fadeTo(500,1);
+        Backbone.history.navigate(url, {trigger: true});
+    }
+        
     
     var ModalWizard = Backbone.View.extend({
         tagName:'div',
@@ -206,7 +220,8 @@ define([
             var nextEnabled = true;
             if (this.currentStep==0 && currentStepObj && currentStepObj.view) {
                 // disable if nothing is selected in template (app lozenge list) view
-                if (! currentStepObj.view.selectedTemplate)
+                // or if it is a template with a location
+                if (!currentStepObj.view.selectedTemplate || isTemplateWithLocation)
                     nextEnabled = false;
             }
                 
@@ -291,9 +306,9 @@ define([
             if (this.currentStep==0) {
                 // from first step, composer should load yaml from the catalog item
                 if (this.currentView.selectedTemplate && this.currentView.selectedTemplate.id) {
-                    this.redirectToEditorTabToDeployId(this.currentView.selectedTemplate.id);
+                    redirectToEditorTabToDeployId(this.currentView.selectedTemplate.id);
                 } else {
-                    this.redirectToEditorTabToDeployId();
+                    redirectToEditorTabToDeployId();
                 }
             } else {
                 // on second step we generate yaml
@@ -301,7 +316,7 @@ define([
                 this.model.spec.pruneLocations();
                 var yaml = JsYaml.safeDump(oldSpecToCamp(this.model.spec.toJSON()));
 
-                this.redirectToEditorTabToDeployYaml(yaml);
+                redirectToEditorTabToDeployYaml(yaml);
             }
         },
         finishStep:function () {
@@ -311,19 +326,6 @@ define([
                 // call to validate should showFailure
             }
         },
-        
-        redirectToEditorTabToDeployId: function(catalogId){
-            this.redirectTo("/v1/editor/app/"+ (typeof catalogId === 'string' ? catalogId : '')); 
-        },
-        redirectToEditorTabToDeployYaml: function(yaml){
-            this.redirectTo("/v1/editor/app/_/"+encodeURIComponent(yaml));
-        },
-        redirectTo: function(url){
-            var $modal = $('.add-app #modal-container .modal');
-            $modal.modal('hide');
-            $modal.fadeTo(500,1);
-            Backbone.history.navigate(url, {trigger: true});
-        },
     })
     
     // Note: this does not restore values on a back click; setting type and entity type+name is easy,
@@ -368,7 +370,6 @@ define([
                         self.addTemplateLozenges();
                     } else {
                         $('#catalog-applications-empty').show();
-                        self.showYamlTab();
                     }
                 }
             });
@@ -405,8 +406,8 @@ define([
             $modal.modal('hide');
             window.location.href="#v1/catalog/new";
         },
-        redirectToEditorTab: function() {
-            this.redirectToEditorTabToDeployId();
+        redirectToEditorTab: function () {
+            redirectToEditorTabToDeployId();
         },
         applyFilter: function(e) {
             var filter = $(e.currentTarget).val().toLowerCase()

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/438132fc/src/main/webapp/assets/js/view/editor.js
----------------------------------------------------------------------
diff --git a/src/main/webapp/assets/js/view/editor.js b/src/main/webapp/assets/js/view/editor.js
index f9ce5b6..d867080 100644
--- a/src/main/webapp/assets/js/view/editor.js
+++ b/src/main/webapp/assets/js/view/editor.js
@@ -179,7 +179,6 @@ define([
                 });
                 var that = this;
                 this.editor.on("changes", function(editor, changes) {
-                    console.log("editor changed", editor, changes);
                     that.refreshOnMinorChange();
                 });
             }
@@ -209,7 +208,6 @@ define([
             var yaml = this.editor.getValue();
             try{
                 var parsed = this.parse(true);
-                console.log('parse', parsed);
                 if (parsed.problem) throw parsed.problem;
                 if (this.mode!=MODE_CATALOG && parsed.result['brooklyn.catalog'] &&
                       !parsed.result['services']) {
@@ -233,7 +231,6 @@ define([
                     "    iconUrl: http://www.apache.org/foundation/press/kit/poweredBy/Apache_PoweredBy.png\n"+
                     "    itemType: template\n"+
                     "    item:\n"+
-                    "    - \n"+
                 // indent 6 spaces:
                 this.editor.getValue().replace(/^(.*$)/gm,'      $1');
                 this.mode = MODE_CATALOG;