[MRM-1574] action to scan repository

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1233134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-19 00:01:18 +00:00
parent 8233740cf9
commit bf40346375
3 changed files with 47 additions and 1 deletions

View File

@ -33,3 +33,6 @@ managedrepository.deleted=Managed Repository " {0} " deleted.
managedrepository.location.already.exists=WARNING: Repository location already exists.
managedrepository.location.already.exists.warning.message=Are you sure you want to use this directory
managedrepository.add.title=Add Managed Repository
managedrepository.scan.now=Scan Repository Now
managedrepository.scan.all=Process All Artifacts
managedrepository.scanned=Managed Repository " {0} " scanned.

View File

@ -224,6 +224,41 @@ $(function() {
activateManagedRepositoryFormValidation();
}
scanNow=function(managedRepository){
clearUserMessages();
openDialogConfirm(
function(){
$("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
var checked = $("#managed-repository-scan-now-all").get(0).checked;
var url = "restServices/archivaServices/repositoriesService/scanRepositoryNow?";
url += "repositoryId="+encodeURIComponent(managedRepository.id());
url += "&fullScan="+(checked==true?"true":"false");
$.ajax(url,
{
type: "GET",
success: function(data) {
self.managedRepositories.remove(managedRepository);
displaySuccessMessage($.i18n.prop("managedrepository.scanned",managedRepository.name()));
},
error: function(data) {
var res = $.parseJSON(data.responseText);
displayRestError(res);
},
complete: function(){
removeSmallSpinnerImg();
closeDialogConfirm();
}
}
);
},
$.i18n.prop("ok"),
$.i18n.prop("cancel"),
$.i18n.prop("managedrepository.scan.now"),
$("#managed-repository-scan-now-modal-tmpl").tmpl(managedRepository));
}
removeManagedRepository=function(managedRepository){
clearUserMessages();
openDialogConfirm(

View File

@ -66,6 +66,7 @@
{{/each}}
<th>${$.i18n.prop('release.included')}</th>
<th>${$.i18n.prop('snapshots.included')}</th>
<th>${$.i18n.prop('managedrepository.scan.now')}</th>
<th>${$.i18n.prop('edit')}</th>
<th>${$.i18n.prop('delete')}</th>
</tr>
@ -91,6 +92,7 @@
<img src="images/dialog-error.png"/>
{{/if}}
</td>
<td><a href="#" data-bind="click: function(){ scanNow(row) }">${$.i18n.prop('managedrepository.scan.now')}</a></td>
<td><a href="#" data-bind="click: function(){ editManagedRepository(row) }">${$.i18n.prop('edit')}</a></td>
<td>
<a href="#" data-bind="click: function(){ removeManagedRepository(row) }">
@ -237,3 +239,9 @@
</div>
</div>
</script>
<script id="managed-repository-scan-now-modal-tmpl" type='text/x-jquery-tmpl'>
<div>
${$.i18n.prop('managedrepository.scan.all')}: <input type="checkbox" id="managed-repository-scan-now-all">
</div>
</script>