From d2c84debc403c6b0338a1e31ef94089967d43de6 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 25 Sep 2011 17:20:40 +0200 Subject: [PATCH] fix bug in Sonia.repository.get method --- .../js/repository/sonia.repository.js | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index d7313ea9b6..281c6f3f9f 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -102,28 +102,34 @@ Sonia.repository.get = function(id, callback){ } } + var repository = null; + var grid = Ext.getCmp('repositoryGrid'); if ( grid ){ var store = grid.getStore(); if (store){ var rec = store.getById(id); if (rec){ - execCallback(rec.data); + repository = rec.data; } } } - Ext.Ajax.request({ - url: restUrl + 'repositories/' + id + '.json', - method: 'GET', - scope: this, - success: function(response){ - execCallback(Ext.decode(response.responseText)); - }, - failure: function(result){ - main.handleFailure( - result.status - ); - } - }); + if (repository){ + execCallback(repository); + } else { + Ext.Ajax.request({ + url: restUrl + 'repositories/' + id + '.json', + method: 'GET', + scope: this, + success: function(response){ + execCallback(Ext.decode(response.responseText)); + }, + failure: function(result){ + main.handleFailure( + result.status + ); + } + }); + } } \ No newline at end of file