//private String location;
this.location=ko.observable(location);
- //private boolean snapshots = false;
- this.snapshots=ko.observable(snapshots);
-
- //private boolean releases = true;
- this.releases=ko.observable(releases);
-
- //private boolean blockRedeployments = false;
- this.blockRedeployments=ko.observable(blockRedeployments);
-
//private String cronExpression = "0 0 * * * ?";
this.cronExpression=ko.observable(cronExpression);
//private ManagedRepository stagingRepository;
- //private boolean scanned = false;
- this.scanned=ko.observable(scanned);
-
//private int daysOlder = 100;
this.daysOlder=ko.observable(daysOlder);
//private int retentionCount = 2;
this.retentionCount=ko.observable(retentionCount);
+ //private boolean scanned = false;
+ this.scanned=ko.observable(scanned);
+
//private boolean deleteReleasedSnapshots;
this.deleteReleasedSnapshots=ko.observable(deleteReleasedSnapshots);
//private boolean stageRepoNeeded;
this.stageRepoNeeded=ko.observable(stageRepoNeeded);
+ //private boolean snapshots = false;
+ this.snapshots=ko.observable(snapshots);
+
+ //private boolean releases = true;
+ this.releases=ko.observable(releases);
+
+ //private boolean blockRedeployments = false;
+ this.blockRedeployments=ko.observable(blockRedeployments);
+
}
ManagedRepositoryViewModel=function(managedRepository, update, managedRepositoriesViewModel){
- this.managedRepository=ko.observable(managedRepository);
+ this.managedRepository=managedRepository;
this.managedRepositoriesViewModel = managedRepositoriesViewModel;
this.update = update;
var self = this;
+ var currentManagedRepository = this.managedRepository;
save=function(){
var valid = $("#main-content #managed-repository-edit-form").valid();
if (valid==false) {
return;
}
- $.log("save:"+this.managedRepository().name());
+ $.log("save:"+this.managedRepository.name());
clearUserMessages();
if (this.update){
$.ajax("restServices/archivaServices/managedRepositoriesService/updateManagedRepository",
dataType: 'json',
success: function(data) {
displaySuccessMessage($.i18n.prop('managedrepository.updated'));
+ activateManagedRepositoriesGridTab();
},
error: function(data) {
var res = $.parseJSON(data.responseText);
);
} else {
$.log("add managedRepo");
+
$.ajax("restServices/archivaServices/managedRepositoriesService/addManagedRepository",
{
type: "POST",
contentType: 'application/json',
- data: "{\"managedRepository\": " + ko.toJSON(this.managedRepository)+"}",
+ data: "{\"managedRepository\": " + ko.toJSON(currentManagedRepository)+"}",
dataType: 'json',
- success: function(data) {
- self.managedRepositoriesViewModel.managedRepositories.push(mapManagedRepository(data));
- displaySuccessMessage($.i18n.prop('managedrepository.added'));
- },
- error: function(data) {
- var res = $.parseJSON(data.responseText);
- displayRestError(res);
- }
+ success: function(data) {
+ //var repo = mapManagedRepository(data);
+ //$.log("data:"+repo.name);
+ self.managedRepositoriesViewModel.managedRepositories.push(currentManagedRepository);
+ displaySuccessMessage($.i18n.prop('managedrepository.added'));
+ activateManagedRepositoriesGridTab();
+ },
+ error: function(data) {
+ var res = $.parseJSON(data.responseText);
+ displayRestError(res);
+ }
}
);
}
}
ManagedRepositoriesViewModel=function(){
- this.managedRepositories=ko.observableArray(new Array());
+ this.managedRepositories=ko.observableArray([]);
this.gridViewModel = null;
var self = this;
clearUserMessages();
openDialogConfirm(
function(){
+ $("#dialog-confirm-modal #modal-login-footer").append(smallSpinnerImg());
var url = "restServices/archivaServices/managedRepositoriesService/deleteManagedRepository?";
url += "repositoryId="+encodeURIComponent(managedRepository.id());
displayRestError(res);
},
complete: function(){
+ removeSmallSpinnerImg();
closeDialogConfirm();
}
}
}
- activateManagedRepositoriesGridTab=function(){
- $("#main-content #managed-repository-edit-li").removeClass("active");
- $("#main-content #managed-repository-edit").removeClass("active");
- // activate roles grid tab
- $("#main-content #managed-repositories-view-li").addClass("active");
- $("#main-content #managed-repositories-view").addClass("active");
- }
-
- activateManagedRepositoryEditTab=function(){
- $("#main-content #managed-repositories-view-li").removeClass("active");
- $("#main-content #managed-repositories-view").removeClass("active");
- // activate role edit tab
- $("#main-content #managed-repository-edit-li").addClass("active");
- $("#main-content #managed-repository-edit").addClass("active");
- }
-
displayRepositoriesGrid=function(){
clearUserMessages();
$("#main-content").html(mediumSpinnerImg());
$("#main-content #managed-repositories-content").append(mediumSpinnerImg());
$("#main-content #remote-repositories-content").append(mediumSpinnerImg());
-
+ var managedRepositoriesViewModel = new ManagedRepositoriesViewModel();
$.ajax("restServices/archivaServices/managedRepositoriesService/getManagedRepositories", {
type: "GET",
dataType: 'json',
success: function(data) {
-
- var managedRepositoriesViewModel = new ManagedRepositoriesViewModel();
managedRepositoriesViewModel.managedRepositories(mapManagedRepositories(data));
managedRepositoriesViewModel.gridViewModel = new ko.simpleGrid.viewModel({
data: managedRepositoriesViewModel.managedRepositories,
removeMediumSpinnerImg("#main-content #managed-repositories-content");
$("#main-content #managed-repositories-table [title]").twipsy();
activateManagedRepositoriesGridTab();
- $("#main-content #managed-repositories-pills").bind('change', function (e) {
-
- if ($(e.target).attr("href")=="#managed-repository-edit") {
- var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel);
- ko.applyBindings(viewModel,$("#main-content #managed-repository-edit").get(0));
- activateManagedRepositoryFormValidation();
- }
- if ($(e.target).attr("href")=="#managed-repositories-view") {
- $("#main-content #managed-repository-edit-li a").html($.i18n.prop("add"));
- }
-
- });
}
}
);
+ $("#main-content #managed-repositories-pills").bind('change', function (e) {
+ if ($(e.target).attr("href")=="#managed-repository-edit") {
+ var viewModel = new ManagedRepositoryViewModel(new ManagedRepository(),false,managedRepositoriesViewModel);
+ ko.applyBindings(viewModel,$("#main-content #managed-repository-edit").get(0));
+ activateManagedRepositoryFormValidation();
+ }
+ if ($(e.target).attr("href")=="#managed-repositories-view") {
+ $("#main-content #managed-repository-edit-li a").html($.i18n.prop("add"));
+ }
+
+ });
+
}
mapManagedRepositories=function(data){
data.scanned,data.daysOlder,data.retentionCount,data.deleteReleasedSnapshots,data.stageRepoNeeded);
}
+ activateManagedRepositoriesGridTab=function(){
+ $("#main-content #managed-repository-edit-li").removeClass("active");
+ $("#main-content #managed-repository-edit").removeClass("active");
+ // activate roles grid tab
+ $("#main-content #managed-repositories-view-li").addClass("active");
+ $("#main-content #managed-repositories-view").addClass("active");
+ $("#main-content #managed-repository-edit-li a").html($.i18n.prop("add"));
+ }
+
+ activateManagedRepositoryEditTab=function(){
+ $("#main-content #managed-repositories-view-li").removeClass("active");
+ $("#main-content #managed-repositories-view").removeClass("active");
+ // activate role edit tab
+ $("#main-content #managed-repository-edit-li").addClass("active");
+ $("#main-content #managed-repository-edit").addClass("active");
+ }
+
});
\ No newline at end of file
{{/if}}
</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>
+ <td>
+ <a href="#" data-bind="click: function(){ removeManagedRepository(row) }">
+ <img src="images/delete.png" title="${$.i18n.prop('delete')}"/>
+ </a>
+ </td>
</tr>
{{/each}}
</tbody>
<label for="name">${$.i18n.prop('id')}</label>
<div class="input">
{{if update}}
- <span class="uneditable-input">${$data.managedRepository().id}</span>
+ <span class="uneditable-input">${$data.managedRepository.id}</span>
{{else}}
<input type="text" class="xlarge required" id="id" name="id" size="50"
- data-bind="value: managedRepository().id,css:{'uneditable-input': update},readonly:update"/>
+ data-bind="value: managedRepository.id,css:{'uneditable-input': update},readonly:update"/>
{{/if}}
</div>
</div>
<label for="name">${$.i18n.prop('name')}</label>
<div class="input">
<input type="text" class="xlarge required" id="name" name="name" size="50"
- data-bind="value: managedRepository().name"/>
+ data-bind="value: managedRepository.name"/>
</div>
</div>
<div class="clearfix">
<label for="location">${$.i18n.prop('directory')}</label>
<div class="input">
- <input type="text" class="xlarge required" id="location" name="location" size="50" data-bind="value: managedRepository().location"/>
+ <input type="text" class="xlarge required" id="location" name="location" size="50" data-bind="value: managedRepository.location"/>
</div>
</div>
<div class="clearfix">
<label for="indexDirectory">${$.i18n.prop('index.directory')}</label>
<div class="input">
- <input type="text" class="xlarge" id="indexDirectory" name="indexDirectory" size="50" data-bind="value: managedRepository().indexDirectory"/>
+ <input type="text" class="xlarge" id="indexDirectory" name="indexDirectory" size="50" data-bind="value: managedRepository.indexDirectory"/>
</div>
</div>
<div class="clearfix">
<label for="cronExpression">${$.i18n.prop('cronExpression')}</label>
<div class="input">
- <input type="text" id="cronExpression" class="required" name="cronExpression" size="40" data-bind="value: managedRepository().cronExpression"/>
+ <input type="text" id="cronExpression" class="required" name="cronExpression" size="40" data-bind="value: managedRepository.cronExpression"/>
</div>
</div>
<div class="clearfix">
<label for="daysOlder">${$.i18n.prop('daysOlder')}</label>
<div class="input">
- <input type="text" id="daysOlder" class="digits" name="daysOlder" size="5" data-bind="value: managedRepository().daysOlder"/>
+ <input type="text" id="daysOlder" class="digits" name="daysOlder" size="5" data-bind="value: managedRepository.daysOlder"/>
</div>
</div>
<div class="clearfix">
<label for="retentionCount">${$.i18n.prop('retentionCount')}</label>
<div class="input">
- <input type="text" id="retentionCount" name="retentionCount" size="5" data-bind="value: managedRepository().retentionCount"/>
+ <input type="text" id="retentionCount" name="retentionCount" size="5" data-bind="value: managedRepository.retentionCount"/>
</div>
</div>
<div class="clearfix">
<label for="releases">${$.i18n.prop('releases')}</label>
<div class="input">
- <input type="checkbox" id="releases" name="releases" size="5" data-bind="checked: managedRepository().releases"/>
+ <input type="checkbox" id="releases" name="releases" size="5" data-bind="checked: managedRepository.releases"/>
</div>
</div>
<div class="clearfix">
<label for="snapshots">${$.i18n.prop('snapshots')}</label>
<div class="input">
- <input type="checkbox" id="snapshots" name="snapshots" size="5" data-bind="checked: managedRepository().snapshots"/>
+ <input type="checkbox" id="snapshots" name="snapshots" size="5" data-bind="checked: managedRepository.snapshots"/>
</div>
</div>
<div class="clearfix">
<label for="blockRedeployments">${$.i18n.prop('blockRedeployments')}</label>
<div class="input">
- <input type="checkbox" id="blockRedeployments" name="blockRedeployments" size="5" data-bind="checked: managedRepository().blockRedeployments"/>
+ <input type="checkbox" id="blockRedeployments" name="blockRedeployments" size="5" data-bind="checked: managedRepository.blockRedeployments"/>
</div>
</div>
<div class="clearfix">
<label for="scanned">${$.i18n.prop('scanned')}</label>
<div class="input">
- <input type="checkbox" id="scanned" name="scanned" size="5" data-bind="checked: managedRepository().scanned"/>
+ <input type="checkbox" id="scanned" name="scanned" size="5" data-bind="checked: managedRepository.scanned"/>
</div>
</div>
<div class="clearfix">
<label for="deleteReleasedSnapshots">${$.i18n.prop('deleteReleasedSnapshots')}</label>
<div class="input">
- <input type="checkbox" id="deleteReleasedSnapshots" name="deleteReleasedSnapshots" size="5" data-bind="checked: managedRepository().deleteReleasedSnapshots"/>
+ <input type="checkbox" id="deleteReleasedSnapshots" name="deleteReleasedSnapshots" size="5"
+ data-bind="checked: managedRepository.deleteReleasedSnapshots"/>
</div>
</div>
<div class="clearfix">
<label for="stageRepoNeeded">${$.i18n.prop('stageRepoNeeded')}</label>
<div class="input">
- <input type="checkbox" id="stageRepoNeeded" name="stageRepoNeeded" size="5" data-bind="checked: managedRepository().stageRepoNeeded"/>
+ <input type="checkbox" id="stageRepoNeeded" name="stageRepoNeeded" size="5"
+ data-bind="checked: managedRepository.stageRepoNeeded"/>
</div>
</div>
</fieldset>