You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/02/10 00:07:54 UTC
svn commit: r1242595 - in
/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva:
proxy-connectors.js templates/proxy-connectors.html
Author: olamy
Date: Thu Feb 9 23:07:54 2012
New Revision: 1242595
URL: http://svn.apache.org/viewvc?rev=1242595&view=rev
Log:
[MRM-1576] rewrite proxies connector page
delete proxyConnector impl.
Modified:
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js?rev=1242595&r1=1242594&r2=1242595&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors.js Thu Feb 9 23:07:54 2012
@@ -112,12 +112,14 @@ $(function() {
}
- 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);
}
@@ -235,20 +237,44 @@ $(function() {
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;
}
}
@@ -258,7 +284,7 @@ $(function() {
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;
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html?rev=1242595&r1=1242594&r2=1242595&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/proxy-connectors.html Thu Feb 9 23:07:54 2012
@@ -54,12 +54,12 @@
</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()}}
@@ -70,10 +70,13 @@
<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>