diff --git a/scm-webapp/src/main/webapp/index.html b/scm-webapp/src/main/webapp/index.html index 77242c190a..d653bfc0a7 100644 --- a/scm-webapp/src/main/webapp/index.html +++ b/scm-webapp/src/main/webapp/index.html @@ -13,6 +13,7 @@ + diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.group.js b/scm-webapp/src/main/webapp/resources/js/sonia.group.js index fec62c4ecf..ba8b0be339 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.group.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.group.js @@ -98,7 +98,7 @@ var groupSelModel = new Ext.grid.RowSelectionModel({ singleSelect: true }); -var groupStore = new Ext.data.JsonStore({ +var groupStore = new Sonia.rest.JsonStore({ url: restUrl + 'groups.json', root: 'groups', fields: [ diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js new file mode 100644 index 0000000000..1a548f93f6 --- /dev/null +++ b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +Ext.ns("Sonia.rest"); + +Sonia.rest.JsonStore = Ext.extend( Ext.data.JsonStore, { + + constructor: function(config) { + var baseConfig = { + autoLoad: true, + listeners: { + // fix jersey empty array problem + exception: { + fn: function(proxy, type, action, options, response, arg){ + if ( action == "read" && response.responseText == "null" ){ + this.removeAll(); + } + }, + scope: this + } + } + }; + Sonia.rest.JsonStore.superclass.constructor.call(this, Ext.apply(config, baseConfig)); + } + +});