mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-02 04:39:14 +01:00
improve port configuration
This commit is contained in:
@@ -83,7 +83,8 @@ public class ScmConfiguration
|
||||
this.pluginUrl = other.pluginUrl;
|
||||
this.sslPort = other.sslPort;
|
||||
this.enableSSL = other.enableSSL;
|
||||
this.port = other.port;
|
||||
this.enablePortForward = other.enablePortForward;
|
||||
this.forwardPort = other.forwardPort;
|
||||
this.anonymousAccessEnabled = other.anonymousAccessEnabled;
|
||||
this.adminUsers = other.adminUsers;
|
||||
this.adminGroups = other.adminGroups;
|
||||
@@ -119,9 +120,9 @@ public class ScmConfiguration
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPluginUrl()
|
||||
public int getForwardPort()
|
||||
{
|
||||
return pluginUrl;
|
||||
return forwardPort;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,9 +131,9 @@ public class ScmConfiguration
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPort()
|
||||
public String getPluginUrl()
|
||||
{
|
||||
return port;
|
||||
return pluginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +169,17 @@ public class ScmConfiguration
|
||||
return anonymousAccessEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isEnablePortForward()
|
||||
{
|
||||
return enablePortForward;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -214,6 +226,17 @@ public class ScmConfiguration
|
||||
this.anonymousAccessEnabled = anonymousAccessEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param enablePortForward
|
||||
*/
|
||||
public void setEnablePortForward(boolean enablePortForward)
|
||||
{
|
||||
this.enablePortForward = enablePortForward;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -229,22 +252,22 @@ public class ScmConfiguration
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param pluginUrl
|
||||
* @param forwardPort
|
||||
*/
|
||||
public void setPluginUrl(String pluginUrl)
|
||||
public void setForwardPort(int forwardPort)
|
||||
{
|
||||
this.pluginUrl = pluginUrl;
|
||||
this.forwardPort = forwardPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param port
|
||||
* @param pluginUrl
|
||||
*/
|
||||
public void setPort(int port)
|
||||
public void setPluginUrl(String pluginUrl)
|
||||
{
|
||||
this.port = port;
|
||||
this.pluginUrl = pluginUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,11 +305,11 @@ public class ScmConfiguration
|
||||
private Set<String> adminUsers;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "plugin-url")
|
||||
private String pluginUrl = DEFAULT_PLUGINURL;
|
||||
private int forwardPort = 80;
|
||||
|
||||
/** Field description */
|
||||
private int port = -1;
|
||||
@XmlElement(name = "plugin-url")
|
||||
private String pluginUrl = DEFAULT_PLUGINURL;
|
||||
|
||||
/** Field description */
|
||||
private String servername = "localhost";
|
||||
@@ -294,6 +317,9 @@ public class ScmConfiguration
|
||||
/** Field description */
|
||||
private boolean enableSSL = false;
|
||||
|
||||
/** Field description */
|
||||
private boolean enablePortForward = false;
|
||||
|
||||
/** Field description */
|
||||
private int sslPort = 8181;
|
||||
|
||||
|
||||
@@ -97,12 +97,11 @@ public class HttpUtil
|
||||
{
|
||||
port = configuration.getSslPort();
|
||||
}
|
||||
else
|
||||
else if (configuration.isEnablePortForward())
|
||||
{
|
||||
port = configuration.getPort();
|
||||
port = configuration.getForwardPort();
|
||||
}
|
||||
|
||||
if (port <= 0)
|
||||
else
|
||||
{
|
||||
port = request.getLocalPort();
|
||||
}
|
||||
|
||||
@@ -99,9 +99,21 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
||||
name: 'servername',
|
||||
allowBlank: false
|
||||
},{
|
||||
xtype: 'checkbox',
|
||||
fieldLabel: 'Enable forwarding (mod_proxy)',
|
||||
name: 'enablePortForward',
|
||||
inputValue: 'true',
|
||||
listeners: {
|
||||
check: function(){
|
||||
Ext.getCmp('serverport').setDisabled( ! this.checked );
|
||||
}
|
||||
}
|
||||
},{
|
||||
id: 'serverport',
|
||||
xtype: 'numberfield',
|
||||
fieldLabel: 'Serverport',
|
||||
name: 'port',
|
||||
fieldLabel: 'Forward Port',
|
||||
name: 'forwardPort',
|
||||
disabled: true,
|
||||
allowBlank: false
|
||||
},{
|
||||
xtype: 'textfield',
|
||||
@@ -118,11 +130,18 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
||||
xtype: 'checkbox',
|
||||
fieldLabel: 'Enable SSL',
|
||||
name: 'enableSSL',
|
||||
inputValue: 'true'
|
||||
inputValue: 'true',
|
||||
listeners: {
|
||||
check: function(){
|
||||
Ext.getCmp('sslPort').setDisabled( ! this.checked );
|
||||
}
|
||||
}
|
||||
},{
|
||||
id: 'sslPort',
|
||||
xtype: 'numberfield',
|
||||
fieldLabel: 'SSL Port',
|
||||
name: 'sslPort',
|
||||
disabled: true,
|
||||
allowBlank: false
|
||||
},{
|
||||
xtype : 'textfield',
|
||||
@@ -137,6 +156,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
||||
}],
|
||||
|
||||
onSubmit: function(values){
|
||||
if ( ! values.enableSSL ){
|
||||
values.sslPort = Ext.getCmp('sslPort').getValue();
|
||||
}
|
||||
if ( ! values.enablePortForward ){
|
||||
values.forwardPort = Ext.getCmp('serverport').getValue();
|
||||
}
|
||||
this.el.mask('Submit ...');
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'config.json',
|
||||
@@ -163,6 +188,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
|
||||
success: function(response){
|
||||
var obj = Ext.decode(response.responseText);
|
||||
this.load(obj);
|
||||
if ( obj.enablePortForward ){
|
||||
Ext.getCmp('serverport').setDisabled(false);
|
||||
}
|
||||
if ( obj.enableSSL ){
|
||||
Ext.getCmp('sslPort').setDisabled(false);
|
||||
}
|
||||
clearTimeout(tid);
|
||||
el.unmask();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user