%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/985914/root/data/old/home/stash/atlassian-stash/static/util/
Upload File :
Create Path :
Current File : //proc/985914/root/data/old/home/stash/atlassian-stash/static/util/error-min.js

define("util/error",["aui","jquery","underscore","util/function","util/navbuilder","model/page-state","exports"],function(H,D,Q,G,N,J,R){var O=false,I=0;D(document).ready(function(){O=true;var S=window.onbeforeunload;window.onbeforeunload=function(){O=false;return S?S.apply(this,arguments):undefined}}).on("keydown",function(S){if(S.keyCode===H.keyCode.ESCAPE){I=new Date().getTime()}});R.showNonFieldErrors=function(U){var S=D("#content > header > .notifications").empty();if(typeof (U)==="string"){P(S,U)}else{if(U&&U.length){var T=Q.filter(U,G.not(G.pluck("context")));if(T.length){Q.each(T,function(W){var V=(W&&W.message)?W.message:W;P(S,V)})}}else{P(S,AJS.I18n.getText("stash.web.unknownerror"))}}};var P=function(T,S){D(widget.aui.message.error({content:H.escapeHtml(S)})).appendTo(T)};R.isErrorEntityWithinRepository=function(S){return S&&/branch|tag|repository object|changeset|revision|comment/i.test(S.message)};R.level={INFO:"INFO",WARNING:"WARNING",ERROR:"ERROR",SUCCESS:"SUCCESS"};function L(V,U,T,S,W){this._out={title:V,message:U,details:T,context:S,level:W||R.level.ERROR,fallbackUrl:undefined,fallbackTitle:undefined,shouldLogin:false,shouldReload:false,canRetry:false,shouldRetry:false,retryAfterDate:undefined}}L.prototype.title=function(S){this._out.title=S;return this};L.prototype.message=function(S){this._out.message=S;return this};L.prototype.details=function(S){this._out.details=S;return this};L.prototype.context=function(S){this._out.context=S;return this};L.prototype.level=function(S){this._out.level=S||R.level.ERROR;return this};L.prototype.shouldLogin=function(){this._out.shouldLogin=true;return this};L.prototype.shouldReload=function(){this._out.shouldReload=true;return this};L.prototype.shouldRetry=function(){this._out.shouldRetry=true;return this.canRetry()};L.prototype.canRetry=function(){this._out.canRetry=true;return this};L.prototype.fallbackUrl=function(S,T){this._out.fallbackUrl=S;this._out.fallbackTitle=T;return this};L.prototype.retryAfterDate=function(S){this._out.retryAfterDate=isNaN(S)?undefined:S;if(this._out.retryAfterDate){this.shouldRetry()}return this};L.prototype.doAccessDenied=function(S){this.title(this._out.title||M["401"]);if(S){this.message(this._out.message||AJS.I18n.getText("stash.web.error.no.permission"));this.fallbackUrl(N.allProjects().build(),AJS.I18n.getText("stash.web.ajax.back.to.projects"))}else{this.message(this._out.message||AJS.I18n.getText("stash.web.error.anonymous.disallowed"));this.shouldLogin()}return this};L.prototype.doServerDown=function(){this.title(this._out.title||M["0"]);this.message(this._out.message||E["0"]);this.canRetry();return this};L.prototype.doRequestThrottled=function(S){this.title(this._out.title||M["503"]);this.message(this._out.message||E["503"]);this.canRetry();this.retryAfterDate(!isNaN(Number(S))?new Date(new Date().getTime()+(1000*Number(S))):new Date(Date.parse(S)));return this};L.prototype.doNotFound=function(T,S){this.title(this._out.title||M["404"]);this.message(this._out.message||E["404"]);this.fallbackUrl(T||this._out.fallbackUrl||N.allProjects().build(),S||this._out.fallbackTitle||AJS.I18n.getText("stash.web.ajax.back.to.projects"));return this};L.prototype.build=function(){if(!this._out.title){this.title(AJS.I18n.getText("stash.web.dialog.ajax.error.title"))}return this._out};var M={"401":AJS.I18n.getText("stash.web.dialog.ajax.error.not.permitted.title"),"404":AJS.I18n.getText("stash.web.couldnt.find.title"),"502":AJS.I18n.getText("stash.web.server.unreachable.title"),"0":AJS.I18n.getText("stash.web.server.unreachable.title"),"503":AJS.I18n.getText("stash.web.server.busy.title")};var E={"404":AJS.I18n.getText("stash.web.couldnt.find"),"502":AJS.I18n.getText("stash.web.error.server.unresponsive"),"0":AJS.I18n.getText("stash.web.error.server.unresponsive"),"503":AJS.I18n.getText("stash.web.error.too.much.load")};function B(S){return S>=200&&S<400}function A(T,S){return S===204&&D.browser.msie&&!T.getAllResponseHeaders()}function F(V,S,U,T){if((S===401||B(S))&&!C(U,T)){var W;if(S===401){W=new L().doAccessDenied(U!=null)}else{if(U||!A(V,S)){W=new L()[U?"shouldReload":"shouldLogin"]()}else{return null}}if(!T){if(S===401){return W.message(AJS.I18n.getText("stash.web.error.logged.in.and.denied",'"'+U.name+'"')).build()}else{return W.title(AJS.I18n.getText("stash.web.error.logged.in.title")).message(AJS.I18n.getText("stash.web.error.logged.in",'"'+U.name+'"')).build()}}else{if(!U){return W.title(AJS.I18n.getText("stash.web.error.logged.out.title")).message(AJS.I18n.getText("stash.web.error.logged.out")).build()}else{if(S===401){return W.message(AJS.I18n.getText("stash.web.error.logged.in.as.other.and.denied",'"'+T.name+'"','"'+U.name+'"')).build()}else{return W.title(AJS.I18n.getText("stash.web.error.user.changed.title")).message(AJS.I18n.getText("stash.web.error.logged.in.as.other",'"'+T.name+'"','"'+U.name+'"')).build()}}}}return null}function K(T){var S=T.getResponseHeader("X-AUSERID");var U=T.getResponseHeader("X-AUSERNAME");return U!=null?{id:S!=null?parseInt(S,10):null,name:decodeURIComponent(U)}:null}function C(T,S){if(T==null||S==null){return(T||null)===(S||null)}else{if(T.id!=null&&S.id!=null){return T.id===S.id}else{return T.name===S.name}}}R.getDominantAJAXError=function(X,W,Y){var S=Number(X.status);var T=Y!==undefined?Y:J.getCurrentUser()?J.getCurrentUser().toJSON():null;var V=W!==undefined?W:K(X);var U=F(X,S,V,T);if(U){return U}if(S===0||S>=400&&S<600){switch(S){case 401:return new L().doAccessDenied(!!T).build();case 404:return new L().doNotFound().build();case 0:if(O&&X.statusText!=="abort"&&((new Date().getTime())-I>100)){return new L().doServerDown().build()}break;case 502:return new L().doServerDown().build();case 503:return new L().doRequestThrottled(X.getResponseHeader("Retry-After")).build();default:return new L(null,AJS.I18n.getText("stash.web.we.screwed.up")).shouldReload().build()}}return null};R.getDominantRESTError=function(Z,Y){var S,X,U;U=J.getCurrentUser()?J.getCurrentUser().toJSON():null;if(Y){S=Number(Y.status);X=K(Y);var W=F(Y,S,X,U);if(W){return W}}if(Z&&Z.errors&&Z.errors.length){var V=Z.errors[0],T=new L(V.title||M[S],V.message,V.details,V.context,V.level||R.level.ERROR);switch(S){case 401:T.doAccessDenied(U!=null);break;case 404:T.doNotFound();break;case 409:T.shouldReload();break;case 503:T.doRequestThrottled(Y.getResponseHeader("Retry-After"));break}return T.build()}if(Y){return R.getDominantAJAXError(Y,X,U)}return null};R.setFormErrors=function(U,V){var S=D(U);R.clearFormErrors(S);var T=Q.chain(V).filter(function(W){if(!W.message){return false}if(W.context){var X=S.find('[name="'+W.context+'"]').closest(".field-group");if(X.length){D(document.createElement("div")).addClass("error").text(W.message).appendTo(X);return false}}return true}).pluck("message").map(H.escapeHtml).value().join("<br>");if(T){S.prepend(aui.message.error({content:T}))}};R.clearFormErrors=function(S){D(S).find(".error").remove()}});

Zerion Mini Shell 1.0