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/01 18:51:43 UTC
[10/50] [abbrv] brooklyn-ui git commit: catalog moved to core,
and improved catalog API used by JS GUI supports XML input/output
(using DTO / data xfer objects, and DO / domain objs hierarchies),
defaulting to ~/.brooklyn/catalog.xml (or scan
catalog moved to core, and improved catalog API used by JS GUI
supports XML input/output (using DTO / data xfer objects, and DO / domain objs hierarchies),
defaulting to ~/.brooklyn/catalog.xml (or scanning for types, if that's not there).
supports remote catalogs and local manual dynamic additions
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/381bff41
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/381bff41
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/381bff41
Branch: refs/heads/0.5.0
Commit: 381bff41d1a5d2e909ec22d092fab4e1834e3201
Parents: 7b3fa7d
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Nov 21 13:27:06 2012 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Nov 27 15:46:48 2012 -0800
----------------------------------------------------------------------
.../src/main/webapp/assets/css/prettybrook.css | 8 ++++++++
.../src/main/webapp/assets/js/model/location.js | 15 ---------------
usage/jsgui/src/main/webapp/assets/js/router.js | 14 ++++++--------
.../assets/js/view/application-add-wizard.js | 5 ++++-
.../src/main/webapp/assets/js/view/catalog.js | 17 +++++++++++------
.../src/main/webapp/assets/tpl/catalog/page.html | 7 ++++---
.../jsgui/BrooklynJavascriptGuiLauncherTest.java | 1 +
7 files changed, 34 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/css/prettybrook.css b/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
index 6a4a7b2..edcc7dd 100644
--- a/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
+++ b/usage/jsgui/src/main/webapp/assets/css/prettybrook.css
@@ -666,3 +666,11 @@ div.for-textarea > textarea {
text-decoration: underline;
cursor: hand; cursor: pointer;
}
+
+/** input type="file" should be display:none with hand-rolled nicer looking widgets used instead
+ (the native ones can't be much modified, and are notoriously ugly; but line-height 0 at least makes them line up) */
+input[type="file"] {
+ line-height: 0;
+ width: 300px;
+}
+
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/js/model/location.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/model/location.js b/usage/jsgui/src/main/webapp/assets/js/model/location.js
index 554fb16..b98c8dd 100644
--- a/usage/jsgui/src/main/webapp/assets/js/model/location.js
+++ b/usage/jsgui/src/main/webapp/assets/js/model/location.js
@@ -16,20 +16,9 @@ define(["underscore", "backbone"], function (_, Backbone) {
}
},
idFromSelfLink:function () {
- // TODO replace with get('id')
return this.get('id');
-// if (this.has('links')) {
-// var links = this.get('links')
-// if (links['self'] && links['self'] != '') {
-// var s = links['self']
-// var id = s.substring(s.lastIndexOf('/') + 1)
-// if (_.isEqual(s, this.urlRoot + '/' + id)) return id
-// }
-// }
-// return void 0
},
initialize:function () {
-// this.set({'id':this.idFromSelfLink()})
},
addConfig:function (key, value) {
if (key) {
@@ -62,10 +51,6 @@ define(["underscore", "backbone"], function (_, Backbone) {
var name = this.get('name')
if (name!=null && name.length>0) return name
return this.get('spec')
-// var suffix=this.getConfigByName("location");
-// if (suffix==null) suffix=this.getConfigByName("endpoint")
-// if (suffix!=null) suffix=":"+suffix; else suffix="";
-// return this.get("provider")+suffix
}
})
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/js/router.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/router.js b/usage/jsgui/src/main/webapp/assets/js/router.js
index a763d72..a557fa8 100644
--- a/usage/jsgui/src/main/webapp/assets/js/router.js
+++ b/usage/jsgui/src/main/webapp/assets/js/router.js
@@ -86,14 +86,12 @@ define([
},
catalogPage:function () {
var that = this
- this.locations.fetch({ success:function () {
- var catalogResource = new CatalogView({
- locations:that.locations,
- appRouter:that
- })
- catalogResource.fetchModels()
- that.showView("#application-content", catalogResource)
- }})
+ var catalogResource = new CatalogView({
+ locations:that.locations,
+ appRouter:that
+ })
+ that.showView("#application-content", catalogResource)
+ catalogResource.refresh()
},
apidocPage:function () {
var apidocResource = new ApidocView({})
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
index 2370878..f68ef29 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/application-add-wizard.js
@@ -96,6 +96,8 @@ define([
},
submitApplication:function (event) {
var that = this
+ var $modal = $('#modal-container .modal')
+ $modal.fadeTo(500,0.5);
$.ajax({
url:'/v1/applications',
type:'post',
@@ -103,11 +105,12 @@ define([
processData:false,
data:JSON.stringify(this.model.toJSON()),
success:function (data) {
- var $modal = $('#modal-container .modal')
$modal.modal('hide')
+ $modal.fadeTo(500,1);
if (that.options.callback) that.options.callback();
},
error:function (data) {
+ that.$el.fadeTo(100,1).delay(200).fadeTo(200,0.2).delay(200).fadeTo(200,1);
that.steps[that.currentStep].view.showFailure()
}
})
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/js/view/catalog.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/catalog.js b/usage/jsgui/src/main/webapp/assets/js/view/catalog.js
index 2903fea..e9f9ef0 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/catalog.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/catalog.js
@@ -7,7 +7,7 @@ define([
"view/catalog-details-location",
"view/catalog-add-location-modal",
- "formatJson", "bootstrap"
+ "formatJson", "bootstrap", "jquery-form"
], function (_, $, Backbone, Location,
CatalogPageHtml,
DetailsGenericHtml,
@@ -40,7 +40,6 @@ define([
this.genericTabs = ['applications','entities','policies']
_.bindAll(this, "renderLocationsAccordion");
},
- fetchModels: function() {},
render:function (eventName) {
this.$el.html(_.template(CatalogPageHtml, {}))
this.$(".accordion-body", this.$el).hide()
@@ -147,13 +146,19 @@ define([
var $entityForm = $('#new-entity-form'),
$entityModal = $('#new-entity-modal'),
self = this
+ $entityModal.fadeTo(500,0.5);
var options = {
+ url:'/v1/catalog/',
+ type:'post',
success:function (data) {
$entityModal.modal('hide')
- self.fetchModels()
+ $entityModal.fadeTo(500,1);
+ self.refresh()
},
- url:'/v1/catalog/',
- type:'post'
+ error: function(data) {
+ $entityModel.fadeTo(100,1).delay(200).fadeTo(200,0.2).delay(200).fadeTo(200,1);
+ // TODO render the error (want better feedback than this poor-man's flashing)
+ }
}
$entityForm.ajaxSubmit(options)
return false
@@ -174,4 +179,4 @@ define([
})
return CatalogResourceView
-})
\ No newline at end of file
+})
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/main/webapp/assets/tpl/catalog/page.html
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/tpl/catalog/page.html b/usage/jsgui/src/main/webapp/assets/tpl/catalog/page.html
index 31c8730..ec893d3 100644
--- a/usage/jsgui/src/main/webapp/assets/tpl/catalog/page.html
+++ b/usage/jsgui/src/main/webapp/assets/tpl/catalog/page.html
@@ -59,7 +59,7 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button>
- <h3>Add a new Entity or Policy</h3>
+ <h3>Upload Catalog Resource</h3>
</div>
<div class="modal-body">
@@ -68,13 +68,14 @@
<div class="row">
<div class="span5">
- <label for="groovy-code" class="control-label">Entity or Policy definition:</label>
-
+ <label for="groovy-code" class="control-label">Select the source code file for the template/entity/policy you wish to upload.</label>
+ <br/>
<div class="control-group">
<div class="controls">
<input id="groovy-code" name="groovyCode" type="file" class="input-large">
</div>
</div>
+ <br/>
</div>
</div>
</fieldset>
http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/381bff41/usage/jsgui/src/test/java/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/test/java/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java b/usage/jsgui/src/test/java/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
index 5b59110..fad015e 100644
--- a/usage/jsgui/src/test/java/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
+++ b/usage/jsgui/src/test/java/brooklyn/rest/jsgui/BrooklynJavascriptGuiLauncherTest.java
@@ -29,6 +29,7 @@ public class BrooklynJavascriptGuiLauncherTest {
@Test
public void testJavascriptWithRest() throws Exception {
server = BrooklynJavascriptGuiLauncher.startJavascriptAndRest();
+ BrooklynRestApiLauncherTest.enableJavaClassPathUrlsForScanning(server);
BrooklynRestApiLauncherTest.enableAnyoneLogin(server);
checkUrlContains("/index.html", "Brooklyn");
checkUrlContains("/v1/catalog/entities", "Tomcat");