mirror of https://github.com/apache/archiva.git
display warning message when adding a repository concerns an existing directory location
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1232617 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3474c6f996
commit
b480558763
|
@ -23,9 +23,13 @@
|
||||||
#default common
|
#default common
|
||||||
id=id
|
id=id
|
||||||
warning.not.undone.operation=WARNING: This operation can not be undone.
|
warning.not.undone.operation=WARNING: This operation can not be undone.
|
||||||
|
|
||||||
managedrepository.delete.content=Delete Content too ?
|
managedrepository.delete.content=Delete Content too ?
|
||||||
|
|
||||||
# managed repositories screen
|
# managed repositories screen
|
||||||
managedrepository.delete.confirm=Delete Managed Repository
|
managedrepository.delete.confirm=Delete Managed Repository
|
||||||
managedrepository.delete.warning.message=Are you sure you want to delete the following managed repository?
|
managedrepository.delete.warning.message=Are you sure you want to delete the following managed repository?
|
||||||
managedrepository.deleted=Managed Repository " {0} " deleted.
|
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
|
|
@ -74,6 +74,7 @@ $(function() {
|
||||||
this.managedRepositoriesViewModel = managedRepositoriesViewModel;
|
this.managedRepositoriesViewModel = managedRepositoriesViewModel;
|
||||||
this.update = update;
|
this.update = update;
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
save=function(){
|
save=function(){
|
||||||
var valid = $("#main-content #managed-repository-edit-form").valid();
|
var valid = $("#main-content #managed-repository-edit-form").valid();
|
||||||
if (valid==false) {
|
if (valid==false) {
|
||||||
|
@ -85,33 +86,11 @@ $(function() {
|
||||||
$.ajax("restServices/archivaServices/managedRepositoriesService/updateManagedRepository",
|
$.ajax("restServices/archivaServices/managedRepositoriesService/updateManagedRepository",
|
||||||
{
|
{
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
data: "{\"managedRepository\": " + ko.toJSON(this.managedRepository)+"}",
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: "{\"managedRepository\": " + ko.toJSON(this.managedRepository)+"}",
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data) {
|
|
||||||
displaySuccessMessage($.i18n.prop('managedrepository.updated'));
|
|
||||||
activateManagedRepositoriesGridTab();
|
|
||||||
},
|
|
||||||
error: function(data) {
|
|
||||||
var res = $.parseJSON(data.responseText);
|
|
||||||
displayRestError(res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$.log("add managedRepo");
|
|
||||||
|
|
||||||
$.ajax("restServices/archivaServices/managedRepositoriesService/addManagedRepository",
|
|
||||||
{
|
|
||||||
type: "POST",
|
|
||||||
contentType: 'application/json',
|
|
||||||
data: "{\"managedRepository\": " + ko.toJSON(self.managedRepository)+"}",
|
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
//var repo = mapManagedRepository(data);
|
displaySuccessMessage($.i18n.prop('managedrepository.updated'));
|
||||||
//$.log("data:"+data.responseText);
|
|
||||||
self.managedRepositoriesViewModel.managedRepositories.push(self.managedRepository);
|
|
||||||
displaySuccessMessage($.i18n.prop('managedrepository.added'));
|
|
||||||
activateManagedRepositoriesGridTab();
|
activateManagedRepositoriesGridTab();
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
|
@ -120,9 +99,57 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
var url="restServices/archivaServices/managedRepositoriesService/fileLocationExists";
|
||||||
|
url+="?fileLocation="+encodeURIComponent(self.managedRepository.location());
|
||||||
|
$.ajax(url,
|
||||||
|
{
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
if (data){
|
||||||
|
openDialogConfirm(
|
||||||
|
function(){addManagedRepository(self.managedRepository),function(){window.modalConfirmDialog.modal('hide')}},
|
||||||
|
$.i18n.prop('ok'), $.i18n.prop('cancel'),
|
||||||
|
$.i18n.prop('managedrepository.add.title'),
|
||||||
|
$("#managed-repository-location-warning-tmpl").tmpl(self.managedRepository));
|
||||||
|
}else{
|
||||||
|
addManagedRepository(self.managedRepository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//addManagedRepository(self.managedRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addManagedRepository=function(managedRepository,completeCallbackFn){
|
||||||
|
$.log("add managedRepo");
|
||||||
|
var curManagedRepository=managedRepository;
|
||||||
|
var callbackFn = completeCallbackFn;
|
||||||
|
$.ajax("restServices/archivaServices/managedRepositoriesService/addManagedRepository",
|
||||||
|
{
|
||||||
|
type: "POST",
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: "{\"managedRepository\": " + ko.toJSON(managedRepository)+"}",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
self.managedRepositoriesViewModel.managedRepositories.push(curManagedRepository);
|
||||||
|
displaySuccessMessage($.i18n.prop('managedrepository.added'));
|
||||||
|
activateManagedRepositoriesGridTab();
|
||||||
|
},
|
||||||
|
error: function(data) {
|
||||||
|
var res = $.parseJSON(data.responseText);
|
||||||
|
displayRestError(res);
|
||||||
|
},
|
||||||
|
complete:function(data){
|
||||||
|
if(callbackFn){
|
||||||
|
callbackFn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
displayGrid=function(){
|
displayGrid=function(){
|
||||||
activateManagedRepositoriesGridTab();
|
activateManagedRepositoriesGridTab();
|
||||||
}
|
}
|
||||||
|
@ -237,7 +264,7 @@ $(function() {
|
||||||
title: "Repository type (default is Maven 2)"
|
title: "Repository type (default is Maven 2)"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
pageSize: 10
|
pageSize: 5
|
||||||
});
|
});
|
||||||
ko.applyBindings(managedRepositoriesViewModel,$("#main-content #managed-repositories-table").get(0));
|
ko.applyBindings(managedRepositoriesViewModel,$("#main-content #managed-repositories-table").get(0));
|
||||||
$("#main-content #managed-repositories-pills").pills();
|
$("#main-content #managed-repositories-pills").pills();
|
||||||
|
|
|
@ -217,3 +217,18 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
<script id="managed-repository-location-warning-tmpl" type='text/x-jquery-tmpl'>
|
||||||
|
<div>
|
||||||
|
<a class="close" href="#">×</a>
|
||||||
|
<div class="alert-message warning">
|
||||||
|
<p>
|
||||||
|
<strong>${$.i18n.prop('managedrepository.location.already.exists')}</strong>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span><strong>${$.i18n.prop('managedrepository.location.already.exists.warning.message')}</strong>.</span>
|
||||||
|
<div>${$.i18n.prop('id')}: ${id()}</div>
|
||||||
|
<div>${$.i18n.prop('name')}: ${name()}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
Loading…
Reference in New Issue