Files
galaxy/static/scripts/mvc/ui/error-modal.js
T
carlfeberhard b1d930494a UI: extract error-modal from history
Extract the error handler and display used in history-view to it's own
module (mvc/ui/error-modal) and use it to remove alerts elsewhere.

This may be a start at standardizing error handling in some of the mvc
code.
2016-04-07 11:46:17 -04:00

2 lines
1.9 KiB
JavaScript

define(["utils/localization"],function(a){"use strict";function b(b,c,d){return Galaxy.modal.show({title:c,body:b,closing_events:!0,buttons:{Ok:function(){Galaxy.modal.hide()}}}),Galaxy.modal.$el.addClass("error-modal"),d&&(Galaxy.modal.$(".error-details").add(Galaxy.modal.$('button:contains("Details")')).remove(),$("<div/>").addClass("error-details").hide().appendTo(Galaxy.modal.$(".modal-content")).append([$("<p/>").text(j),$("<pre/>").text(JSON.stringify(d,null," "))]),$('<button id="button-1" class="pull-left">'+a("Details")+"</button>").appendTo(Galaxy.modal.$(".buttons")).click(function(){Galaxy.modal.$(".error-details").toggle()})),Galaxy.modal}function c(c,d,e){if(c){if(c=a(c),d=a(d)||a("Error:"),window.Galaxy&&Galaxy.modal)return b(c,d,e);alert(d+"\n\n"+c),console.log("error details:",JSON.stringify(e))}}function d(){return c(a("You appear to be offline. Please check your connection and try again."),a("Offline?"))}function e(){return c(a("Galaxy is currently unreachable. Please try again in a few minutes.")+" "+h,a("Cannot connect to Galaxy"))}function f(b,d,e,f,j){f=f||i,f+=" "+h,j=j||a("An error occurred");var k=g(b,d,e);return c(f,j,k)}function g(a,b,c){return{raven:_.result(window.Raven,"lastEventId"),userAgent:navigator.userAgent,onLine:navigator.onLine,version:_.result(Galaxy.config,"version_major"),xhr:_.omit(b,_.functions(b)),options:_.omit(c,"xhr"),url:_.result(Galaxy.lastAjax,"url"),data:_.result(Galaxy.lastAjax,"data"),model:_.result(a,"toJSON",a+""),user:_.omit(_.result(Galaxy.user,"toJSON"),"email")}}var h=a("Please contact a Galaxy administrator if the problem persists."),i=a("An error occurred while updating information with the server."),j=a("The following information can assist the developers in finding the source of the error:");return{errorModal:c,offlineErrorModal:d,badGatewayErrorModal:e,ajaxErrorModal:f}});
//# sourceMappingURL=../../../maps/mvc/ui/error-modal.js.map