added switch to toggle repository grouping view

This commit is contained in:
Sebastian Sdorra
2011-10-26 09:36:12 +02:00
parent 86d1926104
commit 9135653c34
5 changed files with 96 additions and 3 deletions

View File

@@ -59,6 +59,20 @@ public class ScmClientConfig
this.dateFormat = dateFormat;
}
/**
* Constructs {@link ScmClientConfig} object
*
* @since 1.9
*
* @param dateFormat
* @param enableGroupingGrid
*/
public ScmClientConfig(String dateFormat, boolean enableGroupingGrid)
{
this.dateFormat = dateFormat;
this.enableGroupingGrid = enableGroupingGrid;
}
//~--- get methods ----------------------------------------------------------
/**
@@ -74,6 +88,18 @@ public class ScmClientConfig
return dateFormat;
}
/**
* Returns true if the grouping of repositories is enabled.
*
* @since 1.9
*
* @return true if the grouping of repositories is enabled
*/
public boolean isEnableGroupingGrid()
{
return enableGroupingGrid;
}
//~--- set methods ----------------------------------------------------------
/**
@@ -88,8 +114,23 @@ public class ScmClientConfig
this.dateFormat = dateFormat;
}
/**
* Enables or disables the grouping of repositories.
*
* @since 1.9
*
* @param enableGroupingGrid - true to enable repository grouping
*/
public void setEnableGroupingGrid(boolean enableGroupingGrid)
{
this.enableGroupingGrid = enableGroupingGrid;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private String dateFormat;
/** Field description */
private boolean enableGroupingGrid = true;
}

View File

@@ -164,6 +164,7 @@ public class ScmConfiguration
this.proxyPassword = other.proxyPassword;
this.forceBaseUrl = other.forceBaseUrl;
this.baseUrl = other.baseUrl;
this.enableGroupingGrid = other.enableGroupingGrid;
// deprecated fields
this.sslPort = other.sslPort;
@@ -345,6 +346,19 @@ public class ScmConfiguration
return anonymousAccessEnabled;
}
/**
* Method description
*
*
* @since 1.9
*
* @return
*/
public boolean isEnableGroupingGrid()
{
return enableGroupingGrid;
}
/**
* Returns true if port forwarding is enabled.
*
@@ -451,6 +465,19 @@ public class ScmConfiguration
this.dateFormat = dateFormat;
}
/**
* Method description
*
*
* @since 1.9
*
* @param enableGroupingGrid
*/
public void setEnableGroupingGrid(boolean enableGroupingGrid)
{
this.enableGroupingGrid = enableGroupingGrid;
}
/**
* Method description
*
@@ -658,6 +685,9 @@ public class ScmConfiguration
private Set<ConfigChangedListener> listeners =
new HashSet<ConfigChangedListener>();
/** Field description */
private boolean enableGroupingGrid = false;
/**
* JavaScript date format, see http://jacwright.com/projects/javascript/date_format
*/

View File

@@ -247,7 +247,8 @@ public class AuthenticationResource
{
return new ScmState(contextProvider, securityContext,
repositoryManger.getConfiguredTypes(),
new ScmClientConfig(configuration.getDateFormat()));
new ScmClientConfig(configuration.getDateFormat(),
configuration.isEnableGroupingGrid()));
}
//~--- fields ---------------------------------------------------------------

View File

@@ -57,6 +57,9 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
baseUrlText: 'Base Url',
forceBaseUrlText: 'Force Base Url',
// TODO i18n
enableGroupingGridText: 'Enable repository Groups',
// help
servernameHelpText: 'The name of this server. This name will be part of the repository url.',
@@ -80,6 +83,9 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
baseUrlHelpText: 'The url of the application (with context path) i.e. http://localhost:8080/scm',
forceBaseUrlHelpText: 'Redirects to the base url if the request comes from a other url',
// TODO i18n
enableGroupingGridHelpText: 'Enable repository Groups. A complete page reload is required after a change of this value.',
initComponent: function(){
@@ -99,6 +105,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
name: 'force-base-url',
inputValue: 'true',
helpText: this.forceBaseUrlHelpText
},{
xtype: 'checkbox',
fieldLabel: this.enableGroupingGridText,
name: 'enableGroupingGrid',
inputValue: 'true',
helpText: this.enableGroupingGridHelpText
},{
xtype: 'textfield',
fieldLabel: this.dateFormatText,

View File

@@ -144,6 +144,16 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
}]
});
if (debug){
var msg = "grouping is ";
if ( state.clientConfig.enableGroupingGrid ){
msg += "enabled";
} else {
msg += "disabled";
}
console.debug( msg );
}
var config = {
autoExpandColumn: 'description',
store: repositoryStore,
@@ -156,8 +166,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
}
},
view: new Ext.grid.GroupingView({
// TODO configurable
enableGrouping: true,
enableGrouping: state.clientConfig.enableGroupingGrid,
enableNoGroups: false,
forceFit: true,
groupMode: 'value',