[MRM-1574] delete managed repository

TODO ask for delete content !

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1232063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-16 16:54:20 +00:00
parent b1741f9726
commit 14438ff947
3 changed files with 64 additions and 2 deletions

View File

@ -19,3 +19,12 @@
# --------------------------------------------------------------------
# Archiva webapp i18n default en file
# --------------------------------------------------------------------
#default common
id=id
warning.not.undone.operation=WARNING: This operation can not be undone.
# managed repositories screen
managedrepository.delete.confirm=Delete Managed Repository
managedrepository.delete.warning.message=Are you sure you want to delete the following managed repository?
managedrepository.deleted=Managed Repository " {0} " deleted.

View File

@ -65,6 +65,8 @@ $(function() {
//private boolean stageRepoNeeded;
this.stageRepoNeeded=ko.observable(stageRepoNeeded);
}
ManagedRepositoryViewModel=function(managedRepository, update, managedRepositoriesViewModel){
@ -151,6 +153,40 @@ $(function() {
activateManagedRepositoryFormValidation();
}
removeManagedRepository=function(managedRepository){
clearUserMessages();
openDialogConfirm(
function(){
var url = "restServices/archivaServices/managedRepositoriesService/deleteManagedRepository?";
url += "repositoryId="+encodeURIComponent(managedRepository.id());
url += "&deleteContent=false";
$.ajax(url,
{
type: "GET",
success: function(data) {
self.managedRepositories.remove(managedRepository);
displaySuccessMessage($.i18n.prop("managedrepository.deleted",managedRepository.name()));
},
error: function(data) {
var res = $.parseJSON(data.responseText);
displayRestError(res);
},
complete: function(){
closeDialogConfirm();
}
}
);
},
$.i18n.prop("ok"),
$.i18n.prop("cancel"),
$.i18n.prop("managedrepository.delete.confirm",managedRepository.name()),
$("#managed-repository-delete-warning-tmpl").tmpl(managedRepository));
}
}
activateManagedRepositoriesGridTab=function(){

View File

@ -68,7 +68,7 @@
<th>${$.i18n.prop('release.included')}</th>
<th>${$.i18n.prop('snapshots.included')}</th>
<th>${$.i18n.prop('edit')}</th>
<th>${$.i18n.prop('delete')}</th>
</tr>
</thead>
<tbody>
@ -92,7 +92,8 @@
<img src="images/dialog-error.png"/>
{{/if}}
</td>
<td><a href="#" data-bind="click: function(){ editManagedRepository(row) }">Edit</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) }">${$.i18n.prop('delete')}</a></td>
</tr>
{{/each}}
</tbody>
@ -190,4 +191,20 @@
<button data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
<button data-bind="click: displayGrid" class="btn">${$.i18n.prop('cancel')}</button>
</form>
</script>
<script id="managed-repository-delete-warning-tmpl" type='text/x-jquery-tmpl'>
<div>
<a class="close" href="#">×</a>
<div class="alert-message warning">
<p>
<strong>${$.i18n.prop('warning.not.undone.operation')}</strong>
</p>
</div>
<div>
<span><strong>${$.i18n.prop('managedrepository.delete.warning.message')}</strong>.</span>
<div>${$.i18n.prop('id')}: ${id()}</div>
<div>${$.i18n.prop('name')}: ${name()}</div>
</div>
</div>
</script>