}
- ManagedRepositoryConnectorView=function(source,targetRepos){
+ ManagedRepositoryConnectorView=function(source,sourceName,targetRepos){
var self=this;
this.modified=ko.observable(false);
-
-
+ //this.proxyConnector=ko.observable(proxyConnector);
+ //$.log("new ManagedRepositoryConnectorView:"+proxyConnector.id);
this.source=ko.observable(source);
+ this.sourceName=ko.observable(sourceName);
+ //$.log("new ManagedRepositoryConnectorView source id:"+this.source.id);
this.targetRepos=ko.observableArray(targetRepos);
}
this.remoteRepositories=ko.observableArray([]);
this.networkProxies=ko.observableArray([]);
- editProxyConnector=function(proxyConnector){
+ editProxyConnector=function(managedRepositoryConnectorView){
+ $.log("editProxyConnector");
+ }
+ removeProxyConnector=function(managedRepositoryConnectorView,targetRepoId){
+ $.log("removeProxyConnector:"+managedRepositoryConnectorView.source()+","+targetRepoId);
+ var url="restServices/archivaServices/proxyConnectorService/removeProxyConnector?";
+ url += "sourceRepoId="+encodeURIComponent(managedRepositoryConnectorView.source());
+ url += "&targetRepoId="+encodeURIComponent(targetRepoId);
+ $.ajax(url,
+ {
+ type: "GET",
+ contentType: 'application/json',
+ success: function(data) {
+ clearUserMessages();
+ displaySuccessMessage($.i18n.prop('proxyconnector.removed'));
+ //self.proxyConnectors.remove ProxyConnector=function(sourceRepoId,targetRepoId
+ self.displayGrid();
+ },
+ error: function(data) {
+ var res = $.parseJSON(data.responseText);
+ displayRestError(res);
+ }
+ }
+ );
}
this.findUniqueManagedRepos=function(){
var sourcesRepos=[];
//sourceRepoId
for(i=0;i<self.proxyConnectors().length;i++){
- var curSrcRepo=self.proxyConnectors()[i].sourceRepoId();
+ var curSrcRepo=self.proxyConnectors()[i];
+ var curSrcRepoId=curSrcRepo.sourceRepoId();
var curTarget=self.proxyConnectors()[i];
var sourceRepo = $.grep(sourcesRepos,
function(srcRepo,idx){
for (j=0;j<sourcesRepos.length;j++){
- if (srcRepo.source()==curSrcRepo){
+ if (srcRepo.source()==curSrcRepoId){
return true;
}
}
if (sourceRepo.length>0){
sourceRepo[0].targetRepos.push(curTarget);
} else {
- sourcesRepos.push(new ManagedRepositoryConnectorView(curSrcRepo,[curTarget]));
+ sourcesRepos.push(new ManagedRepositoryConnectorView(curSrcRepoId,getManagedRepository(curSrcRepoId).name(),[curTarget]));
}
}
return sourcesRepos;
</thead>
{{each(i, row) itemsOnCurrentPage()}}
+ {{var sourceId = row.source()}}
<tr data-bind="css:{ 'modified': row.modified()}">
- {{var val = row.source()}}
<td>
<blockquote>
- <p>${val}</p>
- <p>${getManagedRepository(val).name()}</p>
+ <p>${row.source()}</p>
+ <p>${row.sourceName()}</p>
</blockquote>
<td>
{{each(j, targetRepo) row.targetRepos()}}
<p>${getRemoteRepository(targetRepoId).url()}</p>
<p>
<a popover-title="${$.i18n.prop('proxy-connectors.grid.remoterepo.settings.popover.title')}"
- data-bind="event: { mouseover: function(){ showSettings(val,targetRepoId)},}"
- id="proxy-connectors-grid-remoterepo-settings-edit-${val}-${targetRepoId}" href="#">
+ data-bind="event: { mouseover: function(){ showSettings(sourceId,targetRepoId)},},click: function(){ editProxyConnector(row)}"
+ id="proxy-connectors-grid-remoterepo-settings-edit-${sourceId}-${targetRepoId}" href="#">
${$.i18n.prop('edit')}
- </a>
+ </a>
+ <a href="#" data-bind="click: function(){ removeProxyConnector(row,targetRepoId) }">
+ <img src="images/edit-cut.png" title="${$.i18n.prop('delete')}"/>
+ </a>
<div id="proxy-connectors-grid-remoterepo-settings-content-${val}-${targetRepoId}" style="display:none"></div>
</p>
</blockquote>