error box
diff --git a/planetstack/core/xoslib/static/js/test.js b/planetstack/core/xoslib/static/js/test.js
index 7a1106c..10626d7 100644
--- a/planetstack/core/xoslib/static/js/test.js
+++ b/planetstack/core/xoslib/static/js/test.js
@@ -32,6 +32,18 @@
},
});
+TestApp.hideError = function(result) {
+ $("#errorBox").hide();
+};
+
+TestApp.showError = function(result) {
+ $("#errorBox").show();
+ $("#errorBox").html(_.template($("#test-error-template").html())(result));
+ $('#close-error-box').unbind().bind('click', function() {
+ $('#errorBox').hide();
+ });
+};
+
TestApp.on("start", function() {
var objs = ['deployment', 'image', 'networkTemplate', 'network', 'node', 'service', 'site', 'slice', 'sliver'];
@@ -59,10 +71,16 @@
this.dirty = true;
},
+ saveError: function(model, result, xhr) {
+ TestApp.showError(result);
+ },
+
submitClicked: function(e) {
+ TestApp.hideError();
e.preventDefault();
var data = Backbone.Syphon.serialize(this);
- this.model.save(data);
+ var thisView = this;
+ this.model.save(data, {error: function(model, result, xhr) { thisView.saveError(model, result, xhr); }});
this.dirty = false;
},
});
@@ -76,6 +94,7 @@
events: {"click": "changeItem"},
changeItem: function(e) {
+ TestApp.hideError();
e.preventDefault();
e.stopPropagation();
@@ -104,11 +123,12 @@
xos[collection_name].startPolling();
}
- $('#close-detail-view').bind('click', function() {
+ $('#close-detail-view').unbind().bind('click', function() {
$('#detailBox').hide();
});
- $('#detailBox').hide();
+// $('#detailBox').hide();
+// $('#errorBox').hide();
});
$(document).ready(function(){