]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1576] rewrite proxies connector page
authorOlivier Lamy <olamy@apache.org>
Fri, 10 Feb 2012 17:24:11 +0000 (17:24 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 10 Feb 2012 17:24:11 +0000 (17:24 +0000)
fix update of properties.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1242863 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/AbstractRepositoryConnector.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html

index 4efc1a818f330a622c09c431110e5ea33ef0ff78..f6afff08c387d14a408c65bd6eff316a75b8ed4d 100644 (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() );
         }
index bde340acb67c94a092e8f2c659b2582acc6d5eff..ae0c71d3c13549225bef1cf6c2ee4a70359bb6fb 100644 (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();
     }
index b32e8bc04681666e83226695e4d947721a67977f..b278748d22788c0976b060a3b6875e0f577e44b8 100644 (file)
               <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>