mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
added switch to toggle repository grouping view
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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 ---------------------------------------------------------------
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user