[MRM-1581] rewrite network configuration page.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1298561 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-03-08 20:29:36 +00:00
parent 9230a9c8a2
commit 478e79a03e
5 changed files with 101 additions and 10 deletions

View File

@ -500,5 +500,52 @@ $(function() {
}
//---------------------------
// network configuration part
//---------------------------
NetworkConfiguration=function(maxTotal,maxTotalPerHost,usePooling){
//private int maxTotal = 30;
this.maxTotal=ko.observable(maxTotal);
//private int maxTotalPerHost = 30;
this.maxTotalPerHost=ko.observable(maxTotalPerHost);
//private boolean usePooling = true;
this.usePooling=ko.observable(usePooling);
}
NetworkConfigurationViewModel=function(networkConfiguration){
var self=this;
this.networkConfiguration=ko.observable(networkConfiguration);
save=function(){
clearUserMessages();
$.ajax("restServices/archivaServices/archivaAdministrationService/setNetworkConfiguration", {
type: "POST",
contentType: 'application/json',
data: ko.toJSON(self.networkConfiguration),
dataType: 'json',
success: function(data){
displaySuccessMessage( $.i18n.prop("network-configuration.updated"));
}
});
}
}
displayNetworkConfiguration=function(){
var mainContent=$("#main-content");
mainContent.html($("#network-configuration-screen").tmpl());
$.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", {
type: "GET",
dataType: 'json',
success: function(data){
var networkConfiguration=new NetworkConfiguration(data.maxTotal,data.maxTotalPerHost,data.usePooling);
var networkConfigurationViewModel=new NetworkConfigurationViewModel(networkConfiguration);
ko.applyBindings(networkConfigurationViewModel,mainContent.get(0));
}
});
}
});

View File

@ -94,6 +94,10 @@ $(function() {
displayRepositoryScanning();
return;
}
if (screen=='network-configuration'&& hasKarma('archiva-manage-configuration')){
displayNetworkConfiguration();
return;
}
}
// by default display search screen

View File

@ -274,5 +274,40 @@
</table>
</script>
<script id="network-configuration-screen" type="text/html">
<div class="page-header">
<h3>${$.i18n.prop('network-configuration.header')}</h3>
</div>
<div id="network-configuration-form" data-bind='template: {name:"network-configuration-form-tmpl"}'></div>
</script>
<script id="network-configuration-form-tmpl" type="text/html">
<form id="network-proxy-edit-form" class="well form-horizontal">
<fieldset id="network-proxy-edit-fieldset">
<div class="control-group">
<label class="control-label" for="maxTotal">${$.i18n.prop('network-configuration.maxTotal')}</label>
<div class="controls">
<input type="text" class="xlarge required digits" id="maxTotal" name="maxTotal" size="8"
data-bind="value: networkConfiguration().maxTotal"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="maxTotal">${$.i18n.prop('network-configuration.maxTotalPerHost')}</label>
<div class="controls">
<input type="text" class="xlarge required digits" id="maxTotalPerHost" name="maxTotalPerHost" size="8"
data-bind="value: networkConfiguration().maxTotalPerHost"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="usePooling">${$.i18n.prop('network-configuration.usePooling')}</label>
<div class="controls">
<input type="checkbox" id="usePooling" name="usePooling" data-bind="checked: networkConfiguration().usePooling"/>
</div>
</div>
</fieldset>
<button id="network-configuration-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
</form>
</script>

View File

@ -48,6 +48,11 @@
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-repository-scanning-list-a" onclick="displayRepositoryScanning()">${$.i18n.prop('menu.repository-scanning')}</a>
</li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-network-configuration-list-a" onclick="displayNetworkConfiguration()">${$.i18n.prop('menu.network-configuration')}</a>
</li>
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-users']}">

View File

@ -109,46 +109,46 @@
</div>
</div>
<div class="control-group">
<label class="control-label" for="protocol">${$.i18n.prop('protocol')}</label>
<label class="control-label" for="protocol">${$.i18n.prop('protocol')}</label>
<div class="controls">
<input type="text" class="xlarge required" id="protocol" name="protocol" size="8"
data-bind="value: networkProxy.protocol"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="host">${$.i18n.prop('host')}</label>
<label class="control-label" for="host">${$.i18n.prop('host')}</label>
<div class="controls">
<input type="text" class="xlarge required" id="host" name="host" size="15"
data-bind="value: networkProxy.host"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="port">${$.i18n.prop('port')}</label>
<label class="control-label" for="port">${$.i18n.prop('port')}</label>
<div class="controls">
<input type="text" class="xlarge required digits" id="port" name="port" size="6"
data-bind="value: networkProxy.port"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="username">${$.i18n.prop('username')}</label>
<label class="control-label" for="username">${$.i18n.prop('username')}</label>
<div class="controls">
<input type="text" class="xlarge" id="username" name="username" size="50"
data-bind="value: networkProxy.username"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">${$.i18n.prop('password')}</label>
<label class="control-label" for="password">${$.i18n.prop('password')}</label>
<div class="controls">
<input type="password" class="xlarge" id="password" name="password" size="50"
data-bind="value: networkProxy.password"/>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">${$.i18n.prop('network.proxy.useNtlm')}</label>
<div class="controls">
<input type="checkbox" id="useNtlm" name="useNtlm" data-bind="checked: networkProxy.useNtlm"/>
</div>
<div class="control-group">
<label class="control-label" for="useNtlm">${$.i18n.prop('network.proxy.useNtlm')}</label>
<div class="controls">
<input type="checkbox" id="useNtlm" name="useNtlm" data-bind="checked: networkProxy.useNtlm"/>
</div>
</div>
</fieldset>
<button id="network-proxy-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>