[MRM-1576] rewrite proxies connector page

fix update of properties.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1242863 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-10 17:24:11 +00:00
parent 50f5f885fd
commit e56582fb8f
3 changed files with 26 additions and 24 deletions

View File

@ -393,7 +393,7 @@ public abstract class AbstractRepositoryConnector
public void setPropertiesEntries( List<PropertyEntry> propertiesEntries )
{
for ( PropertyEntry propertyEntry : policiesEntries )
for ( PropertyEntry propertyEntry : propertiesEntries )
{
addProperty( propertyEntry.getKey(), propertyEntry.getValue() );
}

View File

@ -88,27 +88,6 @@ $(function() {
this.modified=ko.observable(false);
this.modified.subscribe(function(newValue){$.log("ProxyConnector modified:"+newValue)});
this.deleteProperty=function(key){
$.log("delete property key:"+key());
for(i=0;i<self.propertiesEntries().length;i++){
var entry=self.propertiesEntries()[i];
if (entry.key()==key()){
self.propertiesEntries.remove(entry);
}
}
}
this.addProperty=function(){
var mainContent=$("#main-content");
var key=mainContent.find("#property-key").val();
var value=mainContent.find("#property-value").val();
var oldTab = self.propertiesEntries();
oldTab.push(new Entry(key,value));
self.propertiesEntries(oldTab);
}
this.updatePolicyEntry=function(key,value){
for(i=0;i<policiesEntries.length;i++){
if (policiesEntries[i].key==key){
@ -116,6 +95,7 @@ $(function() {
}
}
}
}
PolicyInformation=function(options,defaultOption,id,name){
@ -249,6 +229,28 @@ $(function() {
}
}
this.deleteProperty=function(key){
$.log("delete property key:"+key());
for(i=0;i<self.proxyConnector.propertiesEntries().length;i++){
var entry=self.proxyConnector.propertiesEntries()[i];
if (entry.key()==key()){
self.proxyConnector.propertiesEntries.remove(entry);
}
}
}
this.addProperty=function(){
var mainContent=$("#main-content");
var key=mainContent.find("#property-key").val();
var value=mainContent.find("#property-value").val();
var oldTab = self.proxyConnector.propertiesEntries();
oldTab.push(new Entry(key,value));
self.proxyConnector.propertiesEntries(oldTab);
mainContent.find("#property-key").val("");
mainContent.find("#property-value").val("");
}
displayGrid=function(){
activateProxyConnectorsGridTab();
}

View File

@ -163,13 +163,13 @@
<thead>
<th><input type="text" id="property-key"/></th>
<th><input type="text" id="property-value"/></th>
<th><a href="#" data-bind="click: function(){ proxyConnector.addProperty() }">${$.i18n.prop('add')}</a></th>
<th><a href="#" data-bind="click: function(){ addProperty() }">${$.i18n.prop('add')}</a></th>
</thead>
<tbody data-bind="foreach: proxyConnector.propertiesEntries">
<tr>
<td data-bind="text: key"></td>
<td data-bind="text: value"></td>
<td><a href="#" data-bind="click: function(){$data.deleteProperty(key)}">${$.i18n.prop('delete')}</a></td>
<td><a href="#" data-bind="click: function(){ $parent.deleteProperty(key)}">${$.i18n.prop('delete')}</a></td>
</tr>
</tbody>
</table>