]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1576] rewrite proxies connector page
authorOlivier Lamy <olamy@apache.org>
Sat, 11 Feb 2012 08:07:22 +0000 (08:07 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 11 Feb 2012 08:07:22 +0000 (08:07 +0000)
display policy name rather than id in settings popover.

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

archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
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 ef88c63a4a32759785e4345791ca7e772c7869d1..9b03ca57d0eca7cb7821a2c8a07e5b11f249193b 100644 (file)
@@ -90,6 +90,7 @@ remoteIndexUrl=Remote Index Url
 remoteDownloadNetworkProxyId=Proxy for Remote Download Index
 downloadRemoteIndexOnStartup=Download Remote Index on Startup
 remoteDownloadTimeout=Download Remote Timeout
+remoterepository.added=Remote Repository added.
 
 #network proxy
 networkproxy.updated=Network Proxy " {0} " updated.
@@ -100,6 +101,7 @@ networkproxy.delete.confirm=Are you sure to delete Network Proxy {0}
 networkproxy.deleted=Network Proxy {0} deleted
 bulk.save.confirm.title=Network Proxy Bulk Save
 networkproxy.bulk.save.confirm=Are you sure to update {0} network proxy(ies)
+network.proxy.useNtlm=Use NTLM
 
 #menu
 menu.users=User Management
index 76fdba8af01c2e7a05ca2a9482d4c5f95f267ee2..015555e24781ee70cf9d08035d1ab93833bd387d 100644 (file)
@@ -112,6 +112,7 @@ $(function() {
     this.name.subscribe(function(newValue){self.modified(true)});
 
   }
+
   ProxyConnectorViewModel=function(proxyConnector,update,proxyConnectorsViewModel){
     var self=this;
     this.proxyConnector=proxyConnector;
@@ -256,6 +257,13 @@ $(function() {
   ProxyConnectorsViewModel=function(){
     var self=this;
     this.proxyConnectors=ko.observableArray([]);
+    this.proxyConnectors.subscribe(function(newValue){
+      $.log("ProxyConnectorsViewModel#proxyConnectors modified")
+      self.proxyConnectors().sort(function(a,b){
+        if ( a.sourceRepoId()== b.sourceRepoId()) return a.order() - b.order();
+        return (a.sourceRepoId() > b.sourceRepoId())? -1:1;
+      });
+    });
     this.policyInformations=ko.observableArray([]);
     this.managedRepositories=ko.observableArray([]);
     this.remoteRepositories=ko.observableArray([]);
@@ -347,7 +355,10 @@ $(function() {
                                 +proxyConnector.sourceRepoId()+"-"+proxyConnector.targetRepoId());
       targetContent.html("");
       targetContent.append($("#proxy-connectors-remote-settings-popover-tmpl")
-                               .tmpl(ko.toJS(proxyConnector)));
+                               .tmpl({
+                                    proxyConnectorsViewModel: self,
+                                    proxyConnector:ko.toJS(proxyConnector)
+                                    }));
 
       var targetImg = $("#proxy-connectors-grid-remoterepo-settings-edit-"+proxyConnector.sourceRepoId()
                             +"-"+proxyConnector.targetRepoId());
@@ -363,6 +374,16 @@ $(function() {
 
     }
 
+    this.findPolicyInformationName=function(id){
+      for(i=0;i<self.policyInformations().length;i++){
+        if (id==self.policyInformations()[i].id()){
+          return self.policyInformations()[i].name();
+        }
+      }
+      return null;
+    }
+
+
     this.displayGrid=function(){
       this.gridViewModel = new ko.simpleGrid.viewModel({
         data: self.proxyConnectors,
index cb15943b408f819a8255b25066858041a44ea5eb..15a9cbb1533b855c2aa1a3b32e2b827c5bd39d6f 100644 (file)
@@ -91,7 +91,7 @@
 <script id='proxy-connectors-remote-settings-popover-tmpl' type='text/x-jquery-tmpl'>
   <div>
     {{if proxyId}}
-      ${$.i18n.prop('proxy-connectors.remoterepo.settings.networkproxy')}: ${proxyId}
+      ${$.i18n.prop('proxy-connectors.remoterepo.settings.networkproxy')}: ${proxyConnector.proxyId}
     {{else}}
       ${$.i18n.prop('proxy-connectors.remoterepo.settings.networkproxy')}: ${$.i18n.prop('none')}
     {{/if}}
         <th colspan="2">${$.i18n.prop('proxy-connector.policies')}</th>
       </thead>
       <tbody>
-        {{each(i, entry) policiesEntries}}
+        {{each(i, entry) proxyConnector.policiesEntries}}
+        {{var name = proxyConnectorsViewModel.findPolicyInformationName(entry.key)}}
         <tr>
-          <td>${entry.key}</td>
+          <td>${name}</td>
           <td>${entry.value}</td>
         </tr>
         {{/each}}