%PDF- %PDF-
Mini Shell

Mini Shell

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

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

Zerion Mini Shell 1.0