diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js index cc5da9f2c4..6eeb28300c 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.repositorybrowser.js @@ -121,6 +121,7 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { this.appendRepositoryProperties(bar); var config = { + tbar: this.createTopToolbar(), bbar: bar, autoExpandColumn: 'description', title: String.format(this.repositoryBrowserTitleText, this.repository.name), @@ -143,6 +144,62 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments); }, + createTopToolbar: function(){ + var tagStore = new Sonia.rest.JsonStore({ + proxy: new Ext.data.HttpProxy({ + url: restUrl + 'repositories/' + this.repository.id + '/tags.json', + method: 'GET', + disableCaching: false + }), + root: 'tag', + idProperty: 'name', + fields: [ 'name', 'revision' ], + sortInfo: { + field: 'name' + } + }); + + var tbar = { + xtype: 'toolbar', + items: [ + this.repository.name, + '->', + 'Tags:', ' ',{ + xtype: 'combo', + valueField: 'revision', + displayField: 'name', + typeAhead: false, + editable: false, + triggerAction: 'all', + store: tagStore, + listeners: { + select: { + fn: this.selectTag, + scope: this + } + } + }] + } + + return tbar; + }, + + selectTag: function(combo, rec){ + var tag = rec.get('name'); + if (debug){ + console.debug('select tag ' + tag); + } + this.revision = rec.get('revision'); + this.getStore().load({ + params: { + revision: this.revision, + path: this.path + } + }); + + this.updateHistory(); + }, + loadStore: function(store, records, extra){ var path = extra.params.path; if ( path != null && path.length > 0 ){ @@ -262,10 +319,16 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, { console.debug( 'change directory: ' + path ); } + var params = { + path: path + } + + if (this.revision){ + params.revision = this.revision; + } + this.getStore().load({ - params: { - path: path - } + params: params }); this.path = path;