Permalink
Browse files

[NEXUS-5360] Fix warning message not displayed on search panel (e.g. …

…'too many results')
  • Loading branch information...
1 parent 1f4bcbf commit 7dd152c6230ce38a4f24d94f1d1570335c65c48c @nabcos nabcos committed with cstamas Nov 19, 2012
@@ -250,13 +250,15 @@ Ext.extend(Sonatype.repoServer.SearchPanel, Ext.Panel, {
setWarningLabel : function(s) {
this.clearWarningLabel();
this.warningLabel = this.searchToolbar.addText('<span class="x-toolbar-warning">' + s + '</span>');
+ this.searchToolbar.doLayout();
},
// clear the warning in the toolbar
clearWarningLabel : function() {
if (this.warningLabel)
{
this.warningLabel.destroy();
this.warningLabel = null;
+ this.searchToolbar.doLayout();
}
},
// start the search
@@ -49,32 +49,6 @@ Sonatype.SearchStore = function(config) {
name : 'latestSnapshotRepositoryId'
}])),
listeners : {
- 'beforeload' : {
- fn : function(store, options) {
- store.proxy.getConnection().on('requestcomplete', function(conn, response, options) {
- if (response.responseText)
- {
- var statusResp = Ext.decode(response.responseText);
- if (statusResp)
- {
- this.grid.totalRecords = statusResp.totalCount;
- if (statusResp.tooManyResults)
- {
- this.grid.setWarningLabel('Too many results, please refine the search condition.');
- }
- else
- {
- this.grid.clearWarningLabel();
- }
- }
- }
- }, this, {
- single : true
- });
- return true;
- },
- scope : this
- },
'load' : {
fn : function(store, records, options) {
this.grid.updateRowTotals(this.grid);
@@ -100,6 +74,26 @@ Sonatype.SearchStore = function(config) {
}
}
});
+
+ // FIXME it's stupid to do it this way, because getConnection usually returns Ext.Ajax and this ends up firing for all calls.
+ this.proxy.getConnection().on('requestcomplete', function(conn, response, options) {
+ if (response.responseText && options.url.indexOf(this.searchUrl) !== -1)
+ {
+ var statusResp = Ext.decode(response.responseText);
+ if (statusResp)
+ {
+ this.grid.totalRecords = statusResp.totalCount;
+ if (statusResp.tooManyResults)
+ {
+ this.grid.setWarningLabel('Too many results, please refine the search condition.');
+ }
+ else
+ {
+ this.grid.clearWarningLabel();
+ }
+ }
+ }
+ }, this);
};
Ext.extend(Sonatype.SearchStore, Ext.data.Store, {});

0 comments on commit 7dd152c

Please sign in to comment.