mirror of https://github.com/apache/archiva.git
implements bulk save mode for remote repositories management
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1243456 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4019c9546
commit
1bea9f1680
|
@ -92,6 +92,9 @@ remoteDownloadNetworkProxyId=Proxy for Remote Download Index
|
|||
downloadRemoteIndexOnStartup=Download Remote Index on Startup
|
||||
remoteDownloadTimeout=Download Remote Timeout
|
||||
remoterepository.added=Remote Repository added.
|
||||
remoterepositories.bulk.save.confirm=Are you sure to update {0} Remote Repository(ies)
|
||||
remoterepositories.bulk.save.confirm.title=Remote Repositories Bulk Save
|
||||
remoterepository.updated=Remote Repository {0} updated.
|
||||
|
||||
#network proxy
|
||||
networkproxy.updated=Network Proxy " {0} " updated.
|
||||
|
|
|
@ -310,6 +310,7 @@ $(function() {
|
|||
activateProxyConnectorsEditTab();
|
||||
mainContent.find("#proxy-connectors-view-tabs-li-edit a").html($.i18n.prop("edit"));
|
||||
}
|
||||
|
||||
deleteProxyConnector=function(proxyConnector){
|
||||
|
||||
openDialogConfirm(
|
||||
|
|
|
@ -610,7 +610,7 @@ $(function() {
|
|||
|
||||
this.availableLayouts = window.managedRepositoryTypes;
|
||||
|
||||
save=function(){
|
||||
this.save=function(){
|
||||
var valid = $("#main-content #remote-repository-edit-form").valid();
|
||||
if (valid==false) {
|
||||
return;
|
||||
|
@ -624,8 +624,9 @@ $(function() {
|
|||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
displaySuccessMessage($.i18n.prop('remoterepository.updated'));
|
||||
displaySuccessMessage($.i18n.prop('remoterepository.updated',self.remoteRepository.id()));
|
||||
activateRemoteRepositoriesGridTab();
|
||||
self.remoteRepository.modified(false);
|
||||
},
|
||||
error: function(data) {
|
||||
var res = $.parseJSON(data.responseText);
|
||||
|
@ -706,6 +707,38 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
this.bulkSave=function(){
|
||||
return getModifiedRemoteRepositories().length>0;
|
||||
}
|
||||
|
||||
getModifiedRemoteRepositories=function(){
|
||||
var prx = $.grep(self.remoteRepositories(),
|
||||
function (remoteRepository,i) {
|
||||
return remoteRepository.modified();
|
||||
});
|
||||
return prx;
|
||||
}
|
||||
|
||||
updateModifiedRemoteRepositories=function(){
|
||||
var modifiedRemoteRepositories = getModifiedRemoteRepositories();
|
||||
|
||||
openDialogConfirm(function(){
|
||||
for(i=0;i<modifiedRemoteRepositories.length;i++){
|
||||
updateRemoteRepository(modifiedRemoteRepositories[i]);
|
||||
}
|
||||
closeDialogConfirm();
|
||||
},
|
||||
$.i18n.prop('ok'),
|
||||
$.i18n.prop('cancel'),
|
||||
$.i18n.prop('remoterepositories.bulk.save.confirm.title'),
|
||||
$.i18n.prop('remoterepositories.bulk.save.confirm',modifiedRemoteRepositories.length));
|
||||
}
|
||||
|
||||
updateRemoteRepository=function(remoteRepository){
|
||||
var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self);
|
||||
viewModel.save();
|
||||
}
|
||||
|
||||
scheduleDownloadRemoteIndex=function(remoteRepository){
|
||||
openDialogConfirm(
|
||||
function(){
|
||||
|
@ -863,7 +896,7 @@ $(function() {
|
|||
}
|
||||
});
|
||||
var mainContent = $("#main-content");
|
||||
ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-table").get(0));
|
||||
ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-view").get(0));
|
||||
mainContent.find("#remote-repositories-pills #remote-repositories-view-a").tab('show')
|
||||
removeMediumSpinnerImg("#main-content #remote-repositories-content");
|
||||
});
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
</ul>
|
||||
<div id="remote-repositories-tabs-content" class="pill-content">
|
||||
<div id="remote-repositories-view" class="pill-pane active">
|
||||
<div id="remote-repositories-bulk-save-btn" data-bind='template:{name:"remote-repositories-bulk-save-tmpl"}'></div>
|
||||
<table class="table table-striped table-bordered" id="remote-repositories-table"
|
||||
data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko_remote-repositoriesGrid',pageLinksId:'remote-repositoriesPagination',data:'remoteRepositories'">
|
||||
</table>
|
||||
|
@ -310,6 +311,7 @@
|
|||
{{/each}}
|
||||
<th>${$.i18n.prop('edit')}</th>
|
||||
<th>${$.i18n.prop('delete')}</th>
|
||||
<th>${$.i18n.prop('modified')}</th>
|
||||
<th>${$.i18n.prop('remoterepository.downloadremoteindex')}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -327,6 +329,13 @@
|
|||
<img src="images/edit-cut.png" title="${$.i18n.prop('delete')}"/>
|
||||
</a>
|
||||
</td>
|
||||
{{if row.modified()}}
|
||||
<td>
|
||||
<a href="#" class="btn btn-warning" data-bind="click: function(){ updateRemoteRepository(row) }">${$.i18n.prop('save')}</a>
|
||||
</td>
|
||||
{{else}}
|
||||
<td></td>
|
||||
{{/if}}
|
||||
<td>
|
||||
<a href="#" data-bind="click: function(){ scheduleDownloadRemoteIndex(row) }">
|
||||
<img src="images/view-refresh.png" title="${$.i18n.prop('remoterepository.downloadremoteindex.now')}"/>
|
||||
|
@ -459,4 +468,10 @@
|
|||
{{if bulkSave()}}
|
||||
<a data-bind="click: updateModifiedManagedRepositories" class="btn btn-danger" href="#">${$.i18n.prop('save.all')}</a>
|
||||
{{/if}}
|
||||
</script>
|
||||
|
||||
<script id="remote-repositories-bulk-save-tmpl" type='text/x-jquery-tmpl'>
|
||||
{{if bulkSave()}}
|
||||
<a data-bind="click: updateModifiedRemoteRepositories" class="btn btn-danger" href="#">${$.i18n.prop('save.all')}</a>
|
||||
{{/if}}
|
||||
</script>
|
Loading…
Reference in New Issue