do not show branch or tag toolbar if the commands are not supported

This commit is contained in:
Sebastian Sdorra
2012-08-03 08:06:19 +02:00
parent d919338cc2
commit 579e163949
3 changed files with 21 additions and 3 deletions

View File

@@ -101,7 +101,11 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
if ( ! this.inline ){
config.title = String.format(this.changesetViewerTitleText, this.repository.name)
config.tbar = this.createTopToolbar();
var type = Sonia.repository.getTypeByName( this.repository.type );
if ( type && type.supportedCommands && type.supportedCommands.indexOf('BRANCHES') >= 0){
config.tbar = this.createTopToolbar();
}
config.bbar = {
xtype: 'paging',
store: this.changesetStore,

View File

@@ -30,7 +30,7 @@
*/
var repositoryTypeStore = new Ext.data.JsonStore({
id: 1,
fields: [ 'displayName', 'name' ]
fields: [ 'displayName', 'name', 'supportedCommands' ]
});
function loadRepositoryTypes(state){
@@ -86,6 +86,16 @@ Sonia.repository.createUrlFromObject = function(repository){
return Sonia.repository.createUrl(repository.type, repository.name);
}
Sonia.repository.getTypeByName = function(name){
var type = null;
repositoryTypeStore.queryBy(function(rec){
if ( rec.get('name') == name ){
type = rec.data;
}
});
return type;
}
/**
* default panel
*/

View File

@@ -121,7 +121,6 @@ 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),
@@ -140,6 +139,11 @@ Sonia.repository.RepositoryBrowser = Ext.extend(Ext.grid.GridPanel, {
}
};
var type = Sonia.repository.getTypeByName( this.repository.type );
if ( type && type.supportedCommands && type.supportedCommands.indexOf('BRANCHES') >= 0){
config.tbar = this.createTopToolbar();
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.RepositoryBrowser.superclass.initComponent.apply(this, arguments);
},