popup error message
[plstackapi.git] / planetstack / core / xoslib / static / js / xoslib / xosHelper.js
index 98dfb88..8fa27a6 100644 (file)
@@ -67,11 +67,23 @@ XOSApplication = Marionette.Application.extend({
          }
     },
 
+    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;
@@ -116,6 +128,8 @@ XOSApplication = Marionette.Application.extend({
             $(this.statusMsgId).html( templateFromId("#xos-status-template")(result) );
         }
 
+        limitTableRows(this.logTableId, 5);
+
         return logMessageId;
     },
 
@@ -203,27 +217,27 @@ XOSDetailView = Marionette.ItemView.extend({
             },\r
 \r
             saveError: function(model, result, xhr, infoMsgId) {\r
-                result["what"] = "save " + model.__proto__.modelName;\r
+                result["what"] = "save " + model.modelName + " " + model.attributes.humanReadableName;\r
                 result["infoMsgId"] = infoMsgId;\r
                 this.app.showError(result);\r
             },\r
 \r
             saveSuccess: function(model, result, xhr, infoMsgId) {\r
                 result = {status: xhr.xhr.status, statusText: xhr.xhr.statusText};\r
-                result["what"] = "save " + model.__proto__.modelName;\r
+                result["what"] = "save " + model.modelName + " " + model.attributes.humanReadableName;\r
                 result["infoMsgId"] = infoMsgId;\r
                 this.app.showSuccess(result);\r
             },
 
             destroyError: function(model, result, xhr, infoMsgId) {
-                result["what"] = "destroy " + model.__proto__.modelName;\r
+                result["what"] = "destroy " + model.modelName + " " + model.attributes.humanReadableName;\r
                 result["infoMsgId"] = infoMsgId;\r
                 this.app.showError(result);\r
             },\r
 \r
             destroySuccess: function(model, result, xhr, infoMsgId) {\r
                 result = {status: xhr.xhr.status, statusText: xhr.xhr.statusText};\r
-                result["what"] = "destroy " + model.__proto__.modelName;\r
+                result["what"] = "destroy " + model.modelName + " " + model.attributes.humanReadableName;\r
                 result["infoMsgId"] = infoMsgId;\r
                 this.app.showSuccess(result);\r
             },
@@ -250,7 +264,7 @@ XOSDetailView = Marionette.ItemView.extend({
 
             save: function() {
                 this.app.hideError();
-                var infoMsgId = this.app.showInformational( {what: "save " + this.model.__proto__.modelName, status: "", statusText: "in progress..."} );\r
+                var infoMsgId = this.app.showInformational( {what: "save " + model.modelName + " " + model.attributes.humanReadableName, status: "", statusText: "in progress..."} );\r
                 var data = Backbone.Syphon.serialize(this);\r
                 var that = this;\r
                 var isNew = !this.model.id;\r
@@ -266,7 +280,7 @@ XOSDetailView = Marionette.ItemView.extend({
 
             destroyModel: function() {
                  this.app.hideError();
-                 var infoMsgId = this.app.showInformational( {what: "destroy " + this.model.__proto__.modelName, status: "", statusText: "in progress..."} );
+                 var infoMsgId = this.app.showInformational( {what: "destroy " + model.modelName + " " + model.attributes.humanReadableName, status: "", statusText: "in progress..."} );
                  var that = this;
                  this.model.destroy({error: function(model, result, xhr) { that.destroyError(model,result,xhr,infoMsgId);},
                                      success: function(model, result, xhr) { that.destroySuccess(model,result,xhr,infoMsgId);}});