From 2973b80a6b6540034cf9343d82d41e3a0a669676 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 5 Sep 2010 16:41:28 +0200 Subject: [PATCH] added debug mode --- scm-webapp/src/main/webapp/resources/js/global.js | 2 ++ .../src/main/webapp/resources/js/sonia.group.js | 15 ++++++++++++--- .../src/main/webapp/resources/js/sonia.rest.js | 7 +++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/global.js b/scm-webapp/src/main/webapp/resources/js/global.js index abd9747afb..32d55afc96 100644 --- a/scm-webapp/src/main/webapp/resources/js/global.js +++ b/scm-webapp/src/main/webapp/resources/js/global.js @@ -3,6 +3,8 @@ * and open the template in the editor. */ +var debug = true; + var repositoryTypes = [ ['Mercurial', 'hg'], ['Subversion','svn'], ['Git','git'] ]; var repositoryTypeStore = new Ext.data.ArrayStore({ 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 ba8b0be339..1392ab03ea 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.group.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.group.js @@ -9,7 +9,6 @@ var addGroupWindow = null; /** Sonia.GroupGrid **/ function addGroup(){ - console.debug( 'add group' ); addGroupWindow = new Sonia.group.DetailWindow(); addGroupWindow.show(); } @@ -17,7 +16,10 @@ function addGroup(){ function removeGroup(){ if (groupSelModel.hasSelection()){ var group = groupSelModel.getSelected().data.name; - console.debug( 'remove group ' + group ); + + if ( debug ){ + console.debug( 'remove group ' + group ); + } Ext.MessageBox.show({ title: 'Remove Group', @@ -78,7 +80,9 @@ var groupToolbar = new Ext.Toolbar({ specialkey: function(field, e){ if (e.getKey() == e.ENTER) { var value = this.getValue(); - console.log( 'Filter: ' + value ); + if ( debug ){ + console.log( 'Filter: ' + value ); + } // TODO filter by member groupStore.filter('name', new RegExp('.*' + value + '.*')); } @@ -276,6 +280,11 @@ Sonia.group.AddForm = new Ext.extend(Ext.FormPanel, { url = restUrl + 'groups.json'; } + if ( debug ){ + var action = this.update ? 'edit' : 'add'; + console.debug( action + ' group ' + name ); + } + Ext.Ajax.request({ url: url, jsonData: group, diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js index 1a548f93f6..84dc797a39 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js @@ -9,12 +9,15 @@ Sonia.rest.JsonStore = Ext.extend( Ext.data.JsonStore, { constructor: function(config) { var baseConfig = { - autoLoad: true, + autoLoad: false, listeners: { // fix jersey empty array problem exception: { fn: function(proxy, type, action, options, response, arg){ - if ( action == "read" && response.responseText == "null" ){ + if ( action == 'read' && response.responseText == 'null' ){ + if ( debug ){ + console.debug( 'empty array, clear whole store' ); + } this.removeAll(); } },