%PDF- %PDF-
| Direktori : /data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/model/ |
| Current File : //data/old/home/stash/atlassian/stash/3.7.1/atlassian-stash/static/model/repository-hook-min.js |
define("model/repository-hook",["aui","backbone-brace","lodash","stash/api/util/navbuilder","util/ajax"],function(B,D,C,H,G){function E(K,M,J,L,I){return C.extend({},I,{fallbackTitle:B.I18n.getText("stash.web.repository.settings.hooks.notfound.fallback.title"),fallbackUrl:H.currentRepo().hooks().build(),canClose:false,shouldReload:false})}var A=D.Model.extend({idAttribute:"key",namedAttributes:{key:"string",name:"string",type:"string",description:"string",version:"string",configFormKey:"string"}});var F=D.Model.extend({namedAttributes:{details:A,enabled:"boolean",configured:"boolean"},initialize:function(){this.id=this.getDetails().getKey()},loadSettings:function(){return G.rest({url:H.rest().currentRepo().hook(this).settings().build()})},saveSettings:function(I){return G.rest({url:H.rest().currentRepo().hook(this).settings().build(),type:"PUT",data:I,statusCode:{"400":false}})},enable:function(I){var K={url:H.rest().currentRepo().hook(this).enabled().build(),type:"PUT",statusCode:{"404":E,"400":false}};if(I){K.data=I}var J=G.rest(K);J.done(C.bind(this.setEnabled,this,true));return J},disable:function(){var I=G.rest({url:H.rest().currentRepo().hook(this).enabled().build(),type:"DELETE",statusCode:{"404":E}});I.done(C.bind(this.setEnabled,this,false));return I}});F.Collection=D.Collection.extend({model:F});return F});