From 9b1ab5d366a7872ba23797c1396a4d95d6a2a24e Mon Sep 17 00:00:00 2001 From: Olivier Lamy <olamy@apache.org> Date: Tue, 27 Sep 2011 13:56:10 +0000 Subject: [PATCH] trigger download remote index call in async mode git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1176386 13f79535-47bb-0310-9956-ffa450edef68 --- .../jsp/admin/editRemoteRepository.jsp | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp index e946446ff..8ab2b1eb5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/editRemoteRepository.jsp @@ -19,12 +19,14 @@ <%@ page contentType="text/html; charset=UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> <html> <head> <title>Admin: Edit Remote Repository</title> <s:head/> + <script type="text/javascript" src="<c:url value='/js/jquery-1.6.1.min.js'/>"></script> </head> <body> @@ -42,28 +44,32 @@ <s:submit value="Update Repository"/> </s:form> <redback:ifAuthorized permission="archiva-run-indexer"> - <s:form method="post" action="editRemoteRepository!downloadRemoteIndex" namespace="/admin" validate="false" - onsubmit="javascript:downloadRemote();"> - <s:hidden name="repoid"/> - <s:checkbox name="now" label="Now" /> - <s:checkbox name="fullDownload" label="Full download"/> - <s:submit value="download Remote Index" onclick="javascript:downloadRemote();"/> - </s:form> + <form id="downloadRemoteForm" name="downloadRemoteForm"> + <input type="hidden" value="${repoid}" id="repoid"/> + Now: <input type="checkbox" name="now"/><br/> + Full download: <input type="checkbox" name="fullDownload" /><br/> + <input type="button" onclick="downloadRemote();" value="Download Remote Index" /> + + </form> </redback:ifAuthorized> - <script type="text/javascript"> - document.getElementById("editRemoteRepository_repository_name").focus(); - function downloadRemote() { - $.ajax({ - url: "test.html", - success: function(){ - alert("ok"); - } - }); - } - </script> </div> +<script type="text/javascript"> + function downloadRemote() { + + $.ajax({ + url: "${pageContext.request.contextPath}/restServices/archivaServices/repositoriesService/scheduleDownloadRemoteIndex", + data: "repositoryId="+document.getElementById("downloadRemoteForm").repoid.value+"&now="+document.getElementById("downloadRemoteForm").now.value+"&fullDownload="+document.getElementById("downloadRemoteForm").fullDownload.value , + error: function(){ + alert('error'); + } + }); + return false; + } + document.getElementById("editRemoteRepository_repository_name").focus(); + +</script> </body> </html> \ No newline at end of file