return prx;
}
- updateModifiedProxyConnectors=function(){
+ this.updateModifiedProxyConnectors=function(){
var modifiedProxyConnectors = getModifiedProxyConnectors();
openDialogConfirm(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();
}
$("#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
}
}
+ 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(){
<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()} (<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>
+