You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2014/08/26 12:27:12 UTC
[6/7] git commit: jsgui: New policies are displayed immediately
jsgui: New policies are displayed immediately
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/eddcdc38
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/eddcdc38
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/eddcdc38
Branch: refs/heads/master
Commit: eddcdc38aacc176888a1964a541e74e0b6bcd8dc
Parents: 290a342
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Tue Aug 26 11:23:05 2014 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Aug 26 11:23:05 2014 +0100
----------------------------------------------------------------------
usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js | 7 ++++++-
usage/jsgui/src/main/webapp/assets/js/view/policy-new.js | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/eddcdc38/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js b/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
index 7e254ea..74ba885 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/entity-policies.js
@@ -212,8 +212,13 @@ define([
},
showNewPolicyModal: function () {
+ var self = this;
Brooklyn.view.showModalWith(new NewPolicyView({
- entity: this.model
+ entity: this.model,
+ onSave: function (policy) {
+ console.log("New policy", policy);
+ self._policies.add(policy);
+ }
}));
},
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/eddcdc38/usage/jsgui/src/main/webapp/assets/js/view/policy-new.js
----------------------------------------------------------------------
diff --git a/usage/jsgui/src/main/webapp/assets/js/view/policy-new.js b/usage/jsgui/src/main/webapp/assets/js/view/policy-new.js
index 16ba2c9..465433e 100644
--- a/usage/jsgui/src/main/webapp/assets/js/view/policy-new.js
+++ b/usage/jsgui/src/main/webapp/assets/js/view/policy-new.js
@@ -58,7 +58,7 @@ define([
}
var url = this.options.entity.get("links").policies + "/?type=" + type;
var self = this;
- return $.ajax({
+ var ajax = $.ajax({
url: url,
type: "post",
data: JSON.stringify(config),
@@ -67,6 +67,10 @@ define([
var message = JSON.parse(response.responseText).message;
self.showError(message);
});
+ if (_.isFunction(this.options.onSave)) {
+ ajax.done(this.options.onSave);
+ }
+ return ajax;
},
showError: function (message) {