Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 612e925..95959f4 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -206,6 +206,21 @@
def is_ephemeral(cls):
return cls in ephemeral_models
+ def getValidators(self):
+ """ primarily for REST API, return a dictionary of field names mapped
+ to lists of the type of validations that need to be applied to
+ those fields.
+ """
+ validators = {}
+ for field in self._meta.fields:
+ l = []
+ if field.blank==False:
+ l.append("notBlank")
+ validators[field.name] = l
+ return validators
+
+
+
diff --git a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
index b41ac9f..8011884 100644
--- a/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
+++ b/planetstack/core/xoslib/dashboards/xosAdminDashboard.html
@@ -27,6 +27,9 @@
Are you sure about this?
</div>
+<div id="xos-error-dialog" title="Error Message">
+</div>
+
<div id="contentPanel">
<div id="contentTitle">
</div>
diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
index dc11670..8fa27a6 100644
--- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
+++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js
@@ -67,11 +67,23 @@
}
},
+ popupErrorDialog: function(responseText) {
+ $("#xos-error-dialog").html(templateFromId("#xos-error-response")($.parseJSON(responseText)));
+ $("#xos-error-dialog").dialog({
+ modal: true,
+ buttons: {
+ Ok: function() { $(this).dialog("close"); }
+ }
+ });
+ },
+
showError: function(result) {
result["statusclass"] = "failure";
if (this.logTableId) {
this.appendLogWindow(result);
+ this.popupErrorDialog(result.responseText);
} else {
+ // this is really old stuff
$(this.errorBoxId).show();
$(this.errorBoxId).html(_.template($(this.errorTemplate).html())(result));
var that=this;
diff --git a/planetstack/core/xoslib/templates/xosAdmin.html b/planetstack/core/xoslib/templates/xosAdmin.html
index bc6ac02..daccf88 100644
--- a/planetstack/core/xoslib/templates/xosAdmin.html
+++ b/planetstack/core/xoslib/templates/xosAdmin.html
@@ -1,5 +1,21 @@
<!-- Error and Success templates -->
+<script type="text/template" id="xos-error-response">
+ <h5>Error</h5>
+ <table>
+ <tr><td>error:</td><td><%= error %></td></tr>
+ <tr><td>check:</td><td><%= specific_error %></td></tr>
+ </table>
+ <h5>Details:</h5>
+ <table>
+ <tbody>
+ <% _.each(reasons, function(element, index) { %>
+ <tr><td><%= index %></td><td><%= element %></td></tr>
+ <% }); %>
+ </tbody>
+ </table>
+</script>
+
<script type="text/template" id="xos-error-template">
<button id="close-error-box">Close Error Message</button>
<h3>An error has occurred.</h3>