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;
|
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 ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,6 +88,18 @@ public class ScmClientConfig
|
|||||||
return dateFormat;
|
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 ----------------------------------------------------------
|
//~--- set methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,8 +114,23 @@ public class ScmClientConfig
|
|||||||
this.dateFormat = dateFormat;
|
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 ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String dateFormat;
|
private String dateFormat;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private boolean enableGroupingGrid = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ public class ScmConfiguration
|
|||||||
this.proxyPassword = other.proxyPassword;
|
this.proxyPassword = other.proxyPassword;
|
||||||
this.forceBaseUrl = other.forceBaseUrl;
|
this.forceBaseUrl = other.forceBaseUrl;
|
||||||
this.baseUrl = other.baseUrl;
|
this.baseUrl = other.baseUrl;
|
||||||
|
this.enableGroupingGrid = other.enableGroupingGrid;
|
||||||
|
|
||||||
// deprecated fields
|
// deprecated fields
|
||||||
this.sslPort = other.sslPort;
|
this.sslPort = other.sslPort;
|
||||||
@@ -345,6 +346,19 @@ public class ScmConfiguration
|
|||||||
return anonymousAccessEnabled;
|
return anonymousAccessEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @since 1.9
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isEnableGroupingGrid()
|
||||||
|
{
|
||||||
|
return enableGroupingGrid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if port forwarding is enabled.
|
* Returns true if port forwarding is enabled.
|
||||||
*
|
*
|
||||||
@@ -451,6 +465,19 @@ public class ScmConfiguration
|
|||||||
this.dateFormat = dateFormat;
|
this.dateFormat = dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @since 1.9
|
||||||
|
*
|
||||||
|
* @param enableGroupingGrid
|
||||||
|
*/
|
||||||
|
public void setEnableGroupingGrid(boolean enableGroupingGrid)
|
||||||
|
{
|
||||||
|
this.enableGroupingGrid = enableGroupingGrid;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -658,6 +685,9 @@ public class ScmConfiguration
|
|||||||
private Set<ConfigChangedListener> listeners =
|
private Set<ConfigChangedListener> listeners =
|
||||||
new HashSet<ConfigChangedListener>();
|
new HashSet<ConfigChangedListener>();
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private boolean enableGroupingGrid = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavaScript date format, see http://jacwright.com/projects/javascript/date_format
|
* JavaScript date format, see http://jacwright.com/projects/javascript/date_format
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -247,7 +247,8 @@ public class AuthenticationResource
|
|||||||
{
|
{
|
||||||
return new ScmState(contextProvider, securityContext,
|
return new ScmState(contextProvider, securityContext,
|
||||||
repositoryManger.getConfiguredTypes(),
|
repositoryManger.getConfiguredTypes(),
|
||||||
new ScmClientConfig(configuration.getDateFormat()));
|
new ScmClientConfig(configuration.getDateFormat(),
|
||||||
|
configuration.isEnableGroupingGrid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
|||||||
baseUrlText: 'Base Url',
|
baseUrlText: 'Base Url',
|
||||||
forceBaseUrlText: 'Force Base Url',
|
forceBaseUrlText: 'Force Base Url',
|
||||||
|
|
||||||
|
// TODO i18n
|
||||||
|
enableGroupingGridText: 'Enable repository Groups',
|
||||||
|
|
||||||
|
|
||||||
// help
|
// help
|
||||||
servernameHelpText: 'The name of this server. This name will be part of the repository url.',
|
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',
|
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',
|
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(){
|
initComponent: function(){
|
||||||
|
|
||||||
@@ -99,6 +105,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
|||||||
name: 'force-base-url',
|
name: 'force-base-url',
|
||||||
inputValue: 'true',
|
inputValue: 'true',
|
||||||
helpText: this.forceBaseUrlHelpText
|
helpText: this.forceBaseUrlHelpText
|
||||||
|
},{
|
||||||
|
xtype: 'checkbox',
|
||||||
|
fieldLabel: this.enableGroupingGridText,
|
||||||
|
name: 'enableGroupingGrid',
|
||||||
|
inputValue: 'true',
|
||||||
|
helpText: this.enableGroupingGridHelpText
|
||||||
},{
|
},{
|
||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
fieldLabel: this.dateFormatText,
|
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 = {
|
var config = {
|
||||||
autoExpandColumn: 'description',
|
autoExpandColumn: 'description',
|
||||||
store: repositoryStore,
|
store: repositoryStore,
|
||||||
@@ -156,8 +166,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
view: new Ext.grid.GroupingView({
|
view: new Ext.grid.GroupingView({
|
||||||
// TODO configurable
|
enableGrouping: state.clientConfig.enableGroupingGrid,
|
||||||
enableGrouping: true,
|
|
||||||
enableNoGroups: false,
|
enableNoGroups: false,
|
||||||
forceFit: true,
|
forceFit: true,
|
||||||
groupMode: 'value',
|
groupMode: 'value',
|
||||||
|
|||||||
Reference in New Issue
Block a user