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:02 UTC
[10/27] brooklyn-ui git commit: call buttons "Open in Composer" and
"Deploy" rather than "Preview" / "Finish"
call buttons "Open in Composer" and "Deploy" rather than "Preview" / "Finish"
and the "Open in Composer" button is highlighted if you pick a template
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/9d3d9bb3
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/9d3d9bb3
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/9d3d9bb3
Branch: refs/heads/master
Commit: 9d3d9bb3f8346f62028fdad1df43ec60d94e73d8
Parents: 2d75ed5
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Feb 11 01:50:58 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Feb 11 17:44:11 2016 +0000
----------------------------------------------------------------------
.../assets/js/view/application-add-wizard.js | 91 +++++++++++---------
.../assets/tpl/app-add-wizard/modal-wizard.html | 4 +-
2 files changed, 50 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/9d3d9bb3/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 ffdee6d..62d4db2 100644
--- a/src/main/webapp/assets/js/view/application-add-wizard.js
+++ b/src/main/webapp/assets/js/view/application-add-wizard.js
@@ -166,12 +166,39 @@ define([
setVisibility(this.$("#prev_step"), (this.currentStep > 0))
+ this.isTemplate = false;
+ {
+ var yaml = (this.currentView && this.currentView.selectedTemplate && this.currentView.selectedTemplate.yaml);
+ if (yaml) {
+ try {
+ yaml = JsYaml.safeLoad(yaml);
+ hasLocation = yaml.location || yaml.locations;
+ if (!hasLocation) {
+ // look for locations defined in locations
+ svcs = yaml.services;
+ if (svcs) {
+ for (svcI in svcs) {
+ if (svcs[svcI].location || svcs[svcI].locations) {
+ hasLocation = true;
+ break;
+ }
+ }
+ }
+ }
+ this.isTemplate = (hasLocation ? true : false);
+ } catch (e) {
+ log("Warning: could not parse yaml template of selected item")
+ log(yaml);
+ }
+ }
+ }
+
// next shown for first step, but not for yaml
- var nextVisible = (this.currentStep < 1) && (this.model.mode != "yaml")
+ var nextVisible = (this.currentStep < 1) && (this.model.mode != "yaml") && (!this.isTemplate);
setVisibility(this.$("#next_step"), nextVisible)
- // previous shown for step 2 (but again, not yaml)
- var previewVisible = (this.currentStep == 1) && (this.model.mode != "yaml")
+ // preview (aka "Open in Composer") shown for step 2 or for template (but again, not yaml)
+ var previewVisible = (((this.currentStep < 1) && this.isTemplate) || (this.currentStep == 1)) && (this.model.mode != "yaml")
setVisibility(this.$("#preview_step"), previewVisible)
// now set next/preview enablement
@@ -266,38 +293,9 @@ define([
nextStep:function () {
if (this.currentStep == 0) {
if (this.currentView.validate()) {
- this.isTemplate = false;
- var yaml = (this.currentView && this.currentView.selectedTemplate && this.currentView.selectedTemplate.yaml);
- if (yaml) {
- try {
- yaml = JsYaml.safeLoad(yaml);
- hasLocation = yaml.location || yaml.locations;
- if (!hasLocation) {
- // look for locations defined in locations
- svcs = yaml.services;
- if (svcs) {
- for (svcI in svcs) {
- if (svcs[svcI].location || svcs[svcI].locations) {
- hasLocation = true;
- break;
- }
- }
- }
- }
- this.isTemplate = (hasLocation ? true : false);
- } catch (e) {
- log("Warning: could not parse yaml template")
- log(yaml);
- }
- }
- if (this.isTemplate) {
- // it's a yaml catalog *template* (because it includes a location); go to composer
- this.redirectToEditorTabToDeployId(this.currentView.selectedTemplate.id);
- } else {
- // it's a java catalog template or yaml template without a location, go to wizard
- this.currentStep += 1;
- this.renderCurrentStep();
- }
+ // next not visible if it's a template, so go to create (configure) step
+ this.currentStep += 1;
+ this.renderCurrentStep();
} else {
// the call to validate will have done the showFailure
}
@@ -307,16 +305,21 @@ define([
},
previewStep:function () {
if (this.currentView.validate()) {
- var yaml;
- if (this.model.mode == "yaml") {
- yaml = this.model.yaml;
+ if (this.isTemplate) {
+ // it's a yaml catalog *template* (because it includes a location); go to composer
+ this.redirectToEditorTabToDeployId(this.currentView.selectedTemplate.id);
} else {
- // Drop any "None" locations.
- this.model.spec.pruneLocations();
- yaml = JsYaml.safeDump(oldSpecToCamp(this.model.spec.toJSON()));
+ var yaml;
+ if (this.model.mode == "yaml") {
+ yaml = this.model.yaml;
+ } else {
+ // Drop any "None" locations.
+ this.model.spec.pruneLocations();
+ yaml = JsYaml.safeDump(oldSpecToCamp(this.model.spec.toJSON()));
+ }
+
+ this.redirectToEditorTabToDeployYaml(yaml);
}
-
- this.redirectToEditorTabToDeployYaml(yaml);
} else {
// call to validate should showFailure
}
@@ -417,6 +420,7 @@ define([
this.delegateEvents();
return this;
},
+ // TODO tabs no longer relevant
onTabChange: function(e) {
var tabText = $(e.target).text();
if (tabText=="Catalog") {
@@ -426,6 +430,7 @@ define([
}
if (tabText=="YAML") {
+ // TODO this mode no longer used
this.model.mode = "yaml";
} else if (tabText=="Template") {
this.model.mode = "template";
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/9d3d9bb3/src/main/webapp/assets/tpl/app-add-wizard/modal-wizard.html
----------------------------------------------------------------------
diff --git a/src/main/webapp/assets/tpl/app-add-wizard/modal-wizard.html b/src/main/webapp/assets/tpl/app-add-wizard/modal-wizard.html
index 183a4ab..427e100 100644
--- a/src/main/webapp/assets/tpl/app-add-wizard/modal-wizard.html
+++ b/src/main/webapp/assets/tpl/app-add-wizard/modal-wizard.html
@@ -30,6 +30,6 @@ under the License.
<div class="modal-footer">
<button id="prev_step" type="button button-previous" class="btn btn-mini btn-info">Back</button>
<button id="next_step" type="button button-next" class="btn btn-mini btn-info">Next</button>
- <button id="preview_step" type="button button-preview" class="btn btn-mini btn-info">Preview</button>
- <button id="finish_step" type="button button-finish" class="btn btn-mini btn-info">Finish</button>
+ <button id="preview_step" type="button button-preview" class="btn btn-mini btn-info">Open in Composer</button>
+ <button id="finish_step" type="button button-finish" class="btn btn-mini btn-info">Deploy</button>
</div>