mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Refactor global proxy implementation
This commit is contained in:
parent
09bc51c5e0
commit
967eb3ce31
@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
@ApiModelProperty(name = "host", value = "The hostname of the proxy server", required = true)
|
||||
private String host;
|
||||
@ApiModelProperty(
|
||||
name = "proxyConfigType",
|
||||
value = "Type of the proxy",
|
||||
required = true
|
||||
)
|
||||
private ProxyType proxyConfigType;
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "port",
|
||||
value = "The port which the proxy server is running",
|
||||
required = true)
|
||||
private int port;
|
||||
name = "proxyHost",
|
||||
value = "The hostname of the proxy server"
|
||||
)
|
||||
private String proxyHost;
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "excludedList",
|
||||
name = "proxyPort",
|
||||
value = "The port which the proxy server is running"
|
||||
)
|
||||
private int proxyPort;
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "proxyExclList",
|
||||
value = "Hosts to exclude using the proxy on connections for. These hosts can use wildcards such as " +
|
||||
"*.example.com"
|
||||
)
|
||||
private List<String> excludedList;
|
||||
private String proxyExclList;
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "username",
|
||||
value = "Username of the proxy server"
|
||||
name = "proxyPacUrl",
|
||||
value = "PAC file URL to auto config proxy"
|
||||
)
|
||||
private String username;
|
||||
private String proxyPacUrl;
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "password",
|
||||
value = "Password of the proxy server"
|
||||
)
|
||||
private String password;
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
public ProxyType getProxyConfigType() {
|
||||
return proxyConfigType;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
public void setProxyConfigType(ProxyType proxyConfigType) {
|
||||
this.proxyConfigType = proxyConfigType;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
public String getProxyHost() {
|
||||
return proxyHost;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
public void setProxyHost(String proxyHost) {
|
||||
this.proxyHost = proxyHost;
|
||||
}
|
||||
|
||||
public List<String> getExcludedList() {
|
||||
return excludedList;
|
||||
public int getProxyPort() {
|
||||
return proxyPort;
|
||||
}
|
||||
|
||||
public void setExcludedList(List<String> excludedList) {
|
||||
this.excludedList = excludedList;
|
||||
public void setProxyPort(int proxyPort) {
|
||||
this.proxyPort = proxyPort;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
public String getProxyExclList() {
|
||||
return proxyExclList;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
public void setProxyExclList(String proxyExclList) {
|
||||
this.proxyExclList = proxyExclList;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
public String getProxyPacUrl() {
|
||||
return proxyPacUrl;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
public void setProxyPacUrl(String proxyPacUrl) {
|
||||
this.proxyPacUrl = proxyPacUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
package org.wso2.carbon.mdm.services.android.bean;
|
||||
|
||||
public enum ProxyType {
|
||||
MANUAL, AUTO
|
||||
}
|
||||
@ -161,8 +161,6 @@ var androidOperationModule = function () {
|
||||
"proxyHost": operationPayload["proxyHost"],
|
||||
"proxyPort": operationPayload["proxyPort"],
|
||||
"proxyExclList": operationPayload["proxyExclList"],
|
||||
"proxyUsername": operationPayload["proxyUsername"],
|
||||
"proxyPassword": operationPayload["proxyPassword"],
|
||||
"proxyPacUrl": operationPayload["proxyPacUrl"]
|
||||
};
|
||||
break;
|
||||
@ -331,8 +329,6 @@ var androidOperationModule = function () {
|
||||
"proxyHost": operationData["proxyHost"],
|
||||
"proxyPort": operationData["proxyPort"],
|
||||
"proxyExclList": operationData["proxyExclList"],
|
||||
"proxyUsername": operationData["proxyUsername"],
|
||||
"proxyPassword": operationData["proxyPassword"],
|
||||
"proxyPacUrl": operationData["proxyPacUrl"]
|
||||
}
|
||||
};
|
||||
|
||||
@ -855,17 +855,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI
|
||||
var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) {
|
||||
var selectedValueOnChange = selectElement.value;
|
||||
var paneSelector = "#" + paneIdPrefix;
|
||||
var pane;
|
||||
for (var i = 0; i < valueSet.length; ++i) {
|
||||
if (selectedValueOnChange !== valueSet[i]) {
|
||||
if ($(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).removeClass("expanded");
|
||||
pane = paneSelector + valueSet[i].toLowerCase();
|
||||
if ($(pane).hasClass("expanded")) {
|
||||
$(pane).removeClass("expanded");
|
||||
}
|
||||
$(paneSelector + valueSet[i]).slideUp();
|
||||
$(pane).slideUp();
|
||||
} else {
|
||||
if (!$(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).addClass("expanded");
|
||||
pane = paneSelector + selectedValueOnChange.toLowerCase();
|
||||
if (!$(pane).hasClass("expanded")) {
|
||||
$(pane).addClass("expanded");
|
||||
}
|
||||
$(paneSelector + selectedValueOnChange).slideDown();
|
||||
$(pane).slideDown();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1014,9 +1014,9 @@
|
||||
<label class="wr-input-control radio light">
|
||||
<input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="manual"
|
||||
value="MANUAL"
|
||||
onclick="switchPaneAgainstValueSetForRadioButtons(this,
|
||||
'global-proxy-configuration-type-', ['manual','auto'])"/>
|
||||
'global-proxy-configuration-type-', ['MANUAL','AUTO'])"/>
|
||||
<span class="helper" title="Manually enter proxy configurations.">
|
||||
Manual
|
||||
</span>
|
||||
@ -1024,9 +1024,9 @@
|
||||
<label class="wr-input-control radio light">
|
||||
<input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="auto"
|
||||
value="AUTO"
|
||||
onclick="switchPaneAgainstValueSetForRadioButtons(this,
|
||||
'global-proxy-configuration-type-', ['auto','manual'])"/>
|
||||
'global-proxy-configuration-type-', ['AUTO','MANUAL'])"/>
|
||||
<span class="helper"
|
||||
title="Proxy configurations will be automatically fetched from Proxy PAC file.">
|
||||
Auto
|
||||
@ -1069,26 +1069,6 @@
|
||||
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
|
||||
placeholder="[ Example: localhost, *.example.com ]"/>
|
||||
</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 id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none">
|
||||
<div class="wr-input-control">
|
||||
|
||||
@ -179,17 +179,20 @@ var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneI
|
||||
var switchPaneAgainstValueSetForRadioButtons = function (selectElement, paneIdPrefix, valueSet) {
|
||||
var selectedValueOnChange = selectElement.value;
|
||||
var paneSelector = "#" + paneIdPrefix;
|
||||
var pane;
|
||||
for (var i = 0; i < valueSet.length; ++i) {
|
||||
if (selectedValueOnChange !== valueSet[i]) {
|
||||
if ($(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).removeClass("expanded");
|
||||
pane = paneSelector + valueSet[i].toLowerCase();
|
||||
if ($(pane).hasClass("expanded")) {
|
||||
$(pane).removeClass("expanded");
|
||||
}
|
||||
$(paneSelector + valueSet[i]).slideUp();
|
||||
$(pane).slideUp();
|
||||
} else {
|
||||
if (!$(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).addClass("expanded");
|
||||
pane = paneSelector + selectedValueOnChange.toLowerCase();
|
||||
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"
|
||||
name="global-proxy-config-type"
|
||||
onclick="switchPaneAgainstValueSetForRadioButtons(this,
|
||||
'global-proxy-configuration-type-', ['manual','auto'])"
|
||||
'global-proxy-configuration-type-', ['MANUAL','AUTO'])"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="manual" disabled/>
|
||||
value="MANUAL" disabled/>
|
||||
<span class="helper" title="Manually enter proxy configurations.">
|
||||
Manual
|
||||
</span>
|
||||
@ -1032,9 +1032,9 @@
|
||||
<input id="auto-proxy-configuration-radio-button" type="radio"
|
||||
name="global-proxy-config-type"
|
||||
onclick="switchPaneAgainstValueSetForRadioButtons(this,
|
||||
'global-proxy-configuration-type-', ['auto','manual'])"
|
||||
'global-proxy-configuration-type-', ['AUTO','MANUAL'])"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="auto" disabled/>
|
||||
value="AUTO" disabled/>
|
||||
<span class="helper"
|
||||
title="Proxy configurations will be automatically fetched from Proxy PAC file.">
|
||||
Auto
|
||||
@ -1078,26 +1078,6 @@
|
||||
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
|
||||
placeholder="[ Example: localhost, *.example.com ]" disabled/>
|
||||
</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 id="global-proxy-configuration-type-auto" 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 selectedValueOnChange = selectElement.value;
|
||||
var paneSelector = "#" + paneIdPrefix;
|
||||
var pane;
|
||||
for (var i = 0; i < valueSet.length; ++i) {
|
||||
if (selectedValueOnChange !== valueSet[i]) {
|
||||
if ($(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).removeClass("expanded");
|
||||
pane = paneSelector + valueSet[i].toLowerCase();
|
||||
if ($(pane).hasClass("expanded")) {
|
||||
$(pane).removeClass("expanded");
|
||||
}
|
||||
$(paneSelector + valueSet[i]).slideUp();
|
||||
$(pane).slideUp();
|
||||
} else {
|
||||
if (!$(paneSelector).hasClass("expanded")) {
|
||||
$(paneSelector).addClass("expanded");
|
||||
pane = paneSelector + selectedValueOnChange.toLowerCase();
|
||||
if (!$(pane).hasClass("expanded")) {
|
||||
$(pane).addClass("expanded");
|
||||
}
|
||||
$(paneSelector + selectedValueOnChange).slideDown();
|
||||
$(pane).slideDown();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1038,9 +1038,9 @@
|
||||
<label class="wr-input-control radio light">
|
||||
<input id="manual-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="manual"
|
||||
value="MANUAL"
|
||||
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.">
|
||||
Manual
|
||||
</span>
|
||||
@ -1048,9 +1048,9 @@
|
||||
<label class="wr-input-control radio light">
|
||||
<input id="auto-proxy-configuration-radio-button" type="radio" name="global-proxy-config-type"
|
||||
class="form-control operationDataKeys" data-key="proxyConfigType"
|
||||
value="auto"
|
||||
value="AUTO"
|
||||
onclick="switchPaneAgainstValueSetForRadioButtons(this,
|
||||
'global-proxy-configuration-type-', ['auto','manual'])"/>
|
||||
'global-proxy-configuration-type-', ['AUTO','MANUAL'])"/>
|
||||
<span class="helper"
|
||||
title="Proxy configurations will be automatically fetched from Proxy PAC file.">
|
||||
Auto
|
||||
@ -1093,26 +1093,6 @@
|
||||
<input id="proxy-excl" class="form-control operationDataKeys" data-key="proxyExclList"
|
||||
placeholder="[ Example: localhost, *.example.com ]"/>
|
||||
</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 id="global-proxy-configuration-type-auto" class="wr-input-control" style="display:none">
|
||||
<div class="wr-input-control">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user