]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1576] rewrite proxies connector page
authorOlivier Lamy <olamy@apache.org>
Mon, 13 Feb 2012 13:56:21 +0000 (13:56 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 13 Feb 2012 13:56:21 +0000 (13:56 +0000)
magnify :-) remote repository ordering

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

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/css/archiva.css
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 ef2c891d462e238b5fcdfab59496d4b6de6ef9d1..9a556f95f354adbd628440a245f587cd48f5b31a 100644 (file)
 .modified td{
     border-top:2px solid #fbc7c6;
     border:2px solid #fbc7c6;
+}
+
+.draggable-item {
+    cursor: move;
+}
+
+.network-proxy-remote-item{
+  margin-bottom: 12px;
+  min-height: 2px;
+  padding: 12px;
+  border: 2px dotted #ddd;
+  margin-left: 2em
 }
\ No newline at end of file
index 92422f32f99eb81aa7996f255c41b966b9237a6c..e8c03f751cecc360ca93fbf8c774be046f810555 100644 (file)
@@ -282,7 +282,7 @@ $(function() {
       return prx;
     }
 
-    updateModifiedProxyConnectors=function(){
+    this.updateModifiedProxyConnectors=function(){
       var modifiedProxyConnectors = getModifiedProxyConnectors();
 
       openDialogConfirm(function(){
@@ -405,7 +405,8 @@ $(function() {
       var proxyConnectors=findProxyConnectorsWithSourceId(proxyConnector);
       $.log("displayOrderEdit:"+proxyConnector.sourceRepoId()+",number:"+proxyConnectors.length);
 
-      var proxyConnectorEditOrderViewModel=new ProxyConnectorEditOrderViewModel(proxyConnectors);
+      var managedRepository = getManagedRepository(proxyConnector.sourceRepoId());
+      var proxyConnectorEditOrderViewModel=new ProxyConnectorEditOrderViewModel(proxyConnectors,self,managedRepository);
       ko.applyBindings(proxyConnectorEditOrderViewModel,$("#main-content #proxy-connector-edit-order").get(0));
       activateProxyConnectorsEditOrderTab();
     }
@@ -442,17 +443,20 @@ $(function() {
           $("#proxy-connectors-view-tabs-a-network-proxies-grid").html($.i18n.prop("proxy-connectors.grid.tab.title"));
           mainContent.find("#proxy-connectors-view-tabs-li-edit a").html($.i18n.prop("add"));
         }
+        if ($(e.target).attr("href")=="#proxy-connectors-edit-order") {
+          activateProxyConnectorsEditOrderTab();
+        }
 
       });
     }
 
   }
 
-  ProxyConnectorEditOrderViewModel=function(proxyConnectors,proxyConnectorsViewModel){
+  ProxyConnectorEditOrderViewModel=function(proxyConnectors,proxyConnectorsViewModel,managedRepository){
     var self=this;
     this.proxyConnectors=ko.observableArray(proxyConnectors);
     this.proxyConnectorsViewModel=proxyConnectorsViewModel;
-
+    this.managedRepository=managedRepository;
     proxyConnectorMoved=function(arg){
       $.log("proxyConnectorMoved:"+arg.sourceIndex+" to " + arg.targetIndex);
       // if only 1 move just update two whereas update all with the new order
@@ -466,6 +470,20 @@ $(function() {
       }
     }
 
+    this.findRemoteRepository=function(id){
+      $.log("findRemoteRepository:"+id());
+      for(i=0;i<self.proxyConnectorsViewModel.remoteRepositories().length;i++){
+        if (self.proxyConnectorsViewModel.remoteRepositories()[i].id()==id()){
+          return self.proxyConnectorsViewModel.remoteRepositories()[i];
+        }
+      }
+      return null;
+    }
+
+    this.updateModifiedProxyConnectors=function(){
+      self.proxyConnectorsViewModel.updateModifiedProxyConnectors();
+    }
+
   }
 
   displayProxyConnectors=function(){
index 051073d01351ff683d7bb9996367db60493ef85b..9a8dc10143ff03c892d5eb9fdfea1273a653fc8d 100644 (file)
       <div id="proxy-connectorsPagination"></div>
     </div>
     <div id="proxy-connectors-edit" class="tab-pane"></div>
-    <div id="proxy-connector-edit-order" class="tab-pane">
-      <ul id="proxy-connector-edit-order-div"
+    <div id="proxy-connector-edit-order" class="tab-pane span8">
+      <div id="proxy-connector-edit-order-managed-repository-div" data-bind='template:{name:"proxy-connector-edit-order-managed-repository-tmpl"}'></div>
+      <div id="proxy-connector-edit-order-div"
          data-bind="sortable: { template: 'proxy-connector-edit-order-tmpl', data: proxyConnectors,afterMove: proxyConnectorMoved}">
-      </ul>
+      </div>
     </div>
   </div>
 
 </script>
 
 <script id="proxy-connector-edit-order-tmpl" type='text/html'>
-    <li>
-      <a href="#">
-        ${sourceRepoId}-${targetRepoId}-${order}
-      </a>
-    </li>
-</script>
\ No newline at end of file
+  <div class="well draggable-item network-proxy-remote-item">
+    {{var remoteRepository=$parent.findRemoteRepository(targetRepoId)}}
+    <div class="row-fluid">
+      <div class="span1">
+        <img src="images/internet-web-browser.png"/>
+      </div>
+      <div class="span6 pull-left">
+        <p>${targetRepoId}</p>
+        <p>${remoteRepository.name()}&nbsp;(<a href="${remoteRepository.url()}" target="_blank">${remoteRepository.url()}</a>)</p>
+        <!--<p>${order}</p>-->
+      </div>
+    </div>
+  </div>
+</script>
+
+<script id="proxy-connector-edit-order-managed-repository-tmpl" type="text/html">
+  <div class="well row-fluid">
+    <div class="span6">
+    <p>${managedRepository.id}</p>
+    <p>${managedRepository.name}</p>
+    </div>
+    <div class="span2">
+      {{if proxyConnectorsViewModel.bulkSave()}}
+        <p>
+           <a data-bind="click: function(){updateModifiedProxyConnectors()}"
+              href="#" class="btn btn-warning">${$.i18n.prop('save.all')}</a></p>
+      {{/if}}
+    </div>
+  </div>
+</script>
+