Refactor global proxy implementation

revert-dabc3590
Madawa Soysa 6 years ago
parent 09bc51c5e0
commit 967eb3ce31

@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* This class represents the information of setting up global proxy * This class represents the information of setting up global proxy
@ -35,71 +34,75 @@ import java.util.List;
) )
public class GlobalProxy extends AndroidOperation implements Serializable { public class GlobalProxy extends AndroidOperation implements Serializable {
@ApiModelProperty(name = "host", value = "The hostname of the proxy server", required = true) @ApiModelProperty(
private String host; name = "proxyConfigType",
value = "Type of the proxy",
required = true
)
private ProxyType proxyConfigType;
@ApiModelProperty( @ApiModelProperty(
name = "port", name = "proxyHost",
value = "The port which the proxy server is running", value = "The hostname of the proxy server"
required = true) )
private int port; private String proxyHost;
@ApiModelProperty( @ApiModelProperty(
name = "excludedList", name = "proxyPort",
value = "Hosts to exclude using the proxy on connections for. These hosts can use wildcards such as " + value = "The port which the proxy server is running"
"*.example.com"
) )
private List<String> excludedList; private int proxyPort;
@ApiModelProperty( @ApiModelProperty(
name = "username", name = "proxyExclList",
value = "Username of the proxy server" value = "Hosts to exclude using the proxy on connections for. These hosts can use wildcards such as " +
"*.example.com"
) )
private String username; private String proxyExclList;
@ApiModelProperty( @ApiModelProperty(
name = "password", name = "proxyPacUrl",
value = "Password of the proxy server" value = "PAC file URL to auto config proxy"
) )
private String password; private String proxyPacUrl;
public String getHost() { public ProxyType getProxyConfigType() {
return host; return proxyConfigType;
} }
public void setHost(String host) { public void setProxyConfigType(ProxyType proxyConfigType) {
this.host = host; this.proxyConfigType = proxyConfigType;
} }
public int getPort() { public String getProxyHost() {
return port; return proxyHost;
} }
public void setPort(int port) { public void setProxyHost(String proxyHost) {
this.port = port; this.proxyHost = proxyHost;
} }
public List<String> getExcludedList() { public int getProxyPort() {
return excludedList; return proxyPort;
} }
public void setExcludedList(List<String> excludedList) { public void setProxyPort(int proxyPort) {
this.excludedList = excludedList; this.proxyPort = proxyPort;
} }
public String getUsername() { public String getProxyExclList() {
return username; return proxyExclList;
} }
public void setUsername(String username) { public void setProxyExclList(String proxyExclList) {
this.username = username; this.proxyExclList = proxyExclList;
} }
public String getPassword() { public String getProxyPacUrl() {
return password; return proxyPacUrl;
} }
public void setPassword(String password) { public void setProxyPacUrl(String proxyPacUrl) {
this.password = password; this.proxyPacUrl = proxyPacUrl;
} }
} }

@ -161,8 +161,6 @@ var androidOperationModule = function () {
"proxyHost": operationPayload["proxyHost"], "proxyHost": operationPayload["proxyHost"],
"proxyPort": operationPayload["proxyPort"], "proxyPort": operationPayload["proxyPort"],
"proxyExclList": operationPayload["proxyExclList"], "proxyExclList": operationPayload["proxyExclList"],
"proxyUsername": operationPayload["proxyUsername"],
"proxyPassword": operationPayload["proxyPassword"],
"proxyPacUrl": operationPayload["proxyPacUrl"] "proxyPacUrl": operationPayload["proxyPacUrl"]
}; };
break; break;
@ -331,8 +329,6 @@ var androidOperationModule = function () {
"proxyHost": operationData["proxyHost"], "proxyHost": operationData["proxyHost"],
"proxyPort": operationData["proxyPort"], "proxyPort": operationData["proxyPort"],
"proxyExclList": operationData["proxyExclList"], "proxyExclList": operationData["proxyExclList"],
"proxyUsername": operationData["proxyUsername"],
"proxyPassword": operationData["proxyPassword"],
"proxyPacUrl": operationData["proxyPacUrl"] "proxyPacUrl": operationData["proxyPacUrl"]
} }
}; };

@ -855,17 +855,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI
var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) { var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) {
var selectedValueOnChange = selectElement.value; var selectedValueOnChange = selectElement.value;
var paneSelector = "#" + paneIdPrefix; var paneSelector = "#" + paneIdPrefix;
var pane;
for (var i = 0; i < valueSet.length; ++i) { for (var i = 0; i < valueSet.length; ++i) {
if (selectedValueOnChange !== valueSet[i]) { if (selectedValueOnChange !== valueSet[i]) {
if ($(paneSelector).hasClass("expanded")) { pane = paneSelector + valueSet[i].toLowerCase();
$(paneSelector).removeClass("expanded"); if ($(pane).hasClass("expanded")) {
$(pane).removeClass("expanded");
} }
$(paneSelector + valueSet[i]).slideUp(); $(pane).slideUp();
} else { } else {
if (!$(paneSelector).hasClass("expanded")) { pane = paneSelector + selectedValueOnChange.toLowerCase();
$(paneSelector).addClass("expanded"); if (!$(pane).hasClass("expanded")) {
$(pane).addClass("expanded");
} }
$(paneSelector + selectedValueOnChange).slideDown(); $(pane).slideDown();
} }
} }
}; };

@ -1014,9 +1014,9 @@
<label class="wr-input-control radio light"> <label class="wr-input-control radio light">
<input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type" <input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="manual" value="MANUAL"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['manual','auto'])"/> 'global-proxy-configuration-type-', ['MANUAL','AUTO'])"/>
<span class="helper" title="Manually enter proxy configurations."> <span class="helper" title="Manually enter proxy configurations.">
Manual Manual
</span> </span>
@ -1024,9 +1024,9 @@
<label class="wr-input-control radio light"> <label class="wr-input-control radio light">
<input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type" <input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="auto" value="AUTO"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['auto','manual'])"/> 'global-proxy-configuration-type-', ['AUTO','MANUAL'])"/>
<span class="helper" <span class="helper"
title="Proxy configurations will be automatically fetched from Proxy PAC file."> title="Proxy configurations will be automatically fetched from Proxy PAC file.">
Auto Auto
@ -1069,26 +1069,6 @@
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList" <input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Example: localhost, *.example.com ]"/> placeholder="[ Example: localhost, *.example.com ]"/>
</div> </div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50"/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100"/>
</div>
</div> </div>
<div id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none"> <div id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none">
<div class="wr-input-control"> <div class="wr-input-control">

@ -179,17 +179,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI
var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) { var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) {
var selectedValueOnChange = selectElement.value; var selectedValueOnChange = selectElement.value;
var paneSelector = "#" + paneIdPrefix; var paneSelector = "#" + paneIdPrefix;
var pane;
for (var i = 0; i < valueSet.length; ++i) { for (var i = 0; i < valueSet.length; ++i) {
if (selectedValueOnChange !== valueSet[i]) { if (selectedValueOnChange !== valueSet[i]) {
if ($(paneSelector).hasClass("expanded")) { pane = paneSelector + valueSet[i].toLowerCase();
$(paneSelector).removeClass("expanded"); if ($(pane).hasClass("expanded")) {
$(pane).removeClass("expanded");
} }
$(paneSelector + valueSet[i]).slideUp(); $(pane).slideUp();
} else { } else {
if (!$(paneSelector).hasClass("expanded")) { pane = paneSelector + selectedValueOnChange.toLowerCase();
$(paneSelector).addClass("expanded"); if (!$(pane).hasClass("expanded")) {
$(pane).addClass("expanded");
} }
$(paneSelector + selectedValueOnChange).slideDown(); $(pane).slideDown();
} }
} }
}; };

@ -1021,9 +1021,9 @@
<input id="manual-proxy-configuration-radio-button" type="radio" <input id="manual-proxy-configuration-radio-button" type="radio"
name="global-proxy-config-type" name="global-proxy-config-type"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['manual','auto'])" 'global-proxy-configuration-type-', ['MANUAL','AUTO'])"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="manual" disabled/> value="MANUAL" disabled/>
<span class="helper" title="Manually enter proxy configurations."> <span class="helper" title="Manually enter proxy configurations.">
Manual Manual
</span> </span>
@ -1032,9 +1032,9 @@
<input id="auto-proxy-configuration-radio-button" type="radio" <input id="auto-proxy-configuration-radio-button" type="radio"
name="global-proxy-config-type" name="global-proxy-config-type"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['auto','manual'])" 'global-proxy-configuration-type-', ['AUTO','MANUAL'])"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="auto" disabled/> value="AUTO" disabled/>
<span class="helper" <span class="helper"
title="Proxy configurations will be automatically fetched from Proxy PAC file."> title="Proxy configurations will be automatically fetched from Proxy PAC file.">
Auto Auto
@ -1078,26 +1078,6 @@
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList" <input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Example: localhost, *.example.com ]" disabled/> placeholder="[ Example: localhost, *.example.com ]" disabled/>
</div> </div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50" disabled/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100" disabled/>
</div>
</div> </div>
<div id="global-proxy-configuration-type-auto" class="wr-input-control"> <div id="global-proxy-configuration-type-auto" class="wr-input-control">
<div class="wr-input-control"> <div class="wr-input-control">

@ -819,17 +819,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI
var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) { var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) {
var selectedValueOnChange = selectElement.value; var selectedValueOnChange = selectElement.value;
var paneSelector = "#" + paneIdPrefix; var paneSelector = "#" + paneIdPrefix;
var pane;
for (var i = 0; i < valueSet.length; ++i) { for (var i = 0; i < valueSet.length; ++i) {
if (selectedValueOnChange !== valueSet[i]) { if (selectedValueOnChange !== valueSet[i]) {
if ($(paneSelector).hasClass("expanded")) { pane = paneSelector + valueSet[i].toLowerCase();
$(paneSelector).removeClass("expanded"); if ($(pane).hasClass("expanded")) {
$(pane).removeClass("expanded");
} }
$(paneSelector + valueSet[i]).slideUp(); $(pane).slideUp();
} else { } else {
if (!$(paneSelector).hasClass("expanded")) { pane = paneSelector + selectedValueOnChange.toLowerCase();
$(paneSelector).addClass("expanded"); if (!$(pane).hasClass("expanded")) {
$(pane).addClass("expanded");
} }
$(paneSelector + selectedValueOnChange).slideDown(); $(pane).slideDown();
} }
} }
}; };

@ -1038,9 +1038,9 @@
<label class="wr-input-control radio light"> <label class="wr-input-control radio light">
<input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type" <input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="manual" value="MANUAL"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['manual','auto'])" checked/> 'global-proxy-configuration-type-', ['MANUAL','AUTO'])" checked/>
<span class="helper" title="Manually enter proxy configurations."> <span class="helper" title="Manually enter proxy configurations.">
Manual Manual
</span> </span>
@ -1048,9 +1048,9 @@
<label class="wr-input-control radio light"> <label class="wr-input-control radio light">
<input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type" <input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
class="form-control operationDataKeys" data-key="proxyConfigType" class="form-control operationDataKeys" data-key="proxyConfigType"
value="auto" value="AUTO"
onclick="switchPaneAgainstValueSetForRadioButtons(this, onclick="switchPaneAgainstValueSetForRadioButtons(this,
'global-proxy-configuration-type-', ['auto','manual'])"/> 'global-proxy-configuration-type-', ['AUTO','MANUAL'])"/>
<span class="helper" <span class="helper"
title="Proxy configurations will be automatically fetched from Proxy PAC file."> title="Proxy configurations will be automatically fetched from Proxy PAC file.">
Auto Auto
@ -1093,26 +1093,6 @@
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList" <input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
placeholder="[ Example: localhost, *.example.com ]"/> placeholder="[ Example: localhost, *.example.com ]"/>
</div> </div>
<div class="wr-input-control" id="control-proxy-username">
<label class="wr-input-label" for="proxy-username">
Username
<span class="helper" title="Username for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-username" class="form-control operationDataKeys"
data-key="proxyUsername" maxlength="50"/>
</div>
<div class="wr-input-control" id="control-proxy-password">
<label class="wr-input-label" for="proxy-password">
Password
<span class="helper" title="Password for the proxy server.">
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<input id="proxy-password" type="password" class="form-control operationDataKeys"
data-key="proxyPassword" maxlength="100"/>
</div>
</div> </div>
<div id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none"> <div id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none">
<div class="wr-input-control"> <div class="wr-input-control">

Loading…
Cancel
Save