editNetworkProxy=function(networkProxy){
clearUserMessages();
$.log("editNetworkProxy");
- $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("edit"));
+ var mainContent = $("#main-content");
+ mainContent.find("#network-proxies-view-tabs-li-edit a").html($.i18n.prop("edit"));
var viewModel = new NetworkProxyViewModel(networkProxy,true,self);
- ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
+ ko.applyBindings(viewModel,mainContent.find("#network-proxies-edit").get(0));
activateNetworkProxyFormValidation();
activateNetworkProxyEditTab();
}
displayNetworkProxies=function(){
clearUserMessages();
- $("#main-content").html(mediumSpinnerImg());
- $("#main-content").html($("#networkProxiesMain").tmpl());
- $("#main-content #network-proxies-view-tabs a:first").tab('show');
+ var mainContent = $("#main-content");
+ mainContent.html(mediumSpinnerImg());
+ mainContent.html($("#networkProxiesMain").tmpl());
+ mainContent.find("#network-proxies-view-tabs a:first").tab('show');
var networkProxiesViewModel = new NetworkProxiesViewModel();
- $("#main-content #network-proxies-view-tabs").on('show', function (e) {
+ mainContent.find("#network-proxies-view-tabs").on('show', function (e) {
if ($(e.target).attr("href")=="#network-proxies-edit") {
var viewModel = new NetworkProxyViewModel(new NetworkProxy(),false,networkProxiesViewModel);
ko.applyBindings(viewModel,$("#main-content #network-proxies-edit").get(0));
}
activateNetworkProxiesGridTab=function(){
- $("#main-content #network-proxies-view-tabs-li-edit").removeClass("active");
- $("#main-content #network-proxies-edit").removeClass("active");
+ var mainContent = $("#main-content");
+ mainContent.find("#network-proxies-view-tabs-li-edit").removeClass("active");
+ mainContent.find("#network-proxies-edit").removeClass("active");
- $("#main-content #network-proxies-view-tabs-li-grid").addClass("active");
- $("#main-content #network-proxies-view").addClass("active");
- $("#main-content #network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
+ mainContent.find("#network-proxies-view-tabs-li-grid").addClass("active");
+ mainContent.find("#network-proxies-view").addClass("active");
+ mainContent.find("#network-proxies-view-tabs-li-edit a").html($.i18n.prop("add"));
}
activateNetworkProxyEditTab=function(){
- $("#main-content #network-proxies-view-tabs-li-grid").removeClass("active");
- $("#main-content #network-proxies-view").removeClass("active");
+ var mainContent = $("#main-content");
+ mainContent.find("#network-proxies-view-tabs-li-grid").removeClass("active");
+ mainContent.find("#network-proxies-view").removeClass("active");
- $("#main-content #network-proxies-view-tabs-li-edit").addClass("active");
- $("#main-content #network-proxies-edit").addClass("active");
+ mainContent.find("#network-proxies-view-tabs-li-edit").addClass("active");
+ mainContent.find("#network-proxies-edit").addClass("active");
}
mapNetworkProxy=function(data){
ProxyConnector=function(sourceRepoId,targetRepoId,proxyId,blackListPatterns,whiteListPatterns,policies,properties,
disabled,order){
+ var self=this;
+ this.modified=ko.observable(false);
+
//private String sourceRepoId;
this.sourceRepoId=ko.observable(sourceRepoId);
+ this.sourceRepoId.subscribe(function(newValue){self.modified(true)});
+
//private String targetRepoId;
this.targetRepoId=ko.observable(targetRepoId);
+ this.targetRepoId.subscribe(function(newValue){self.modified(true)});
+
//private String proxyId;
this.proxyId=ko.observable(proxyId);
+ this.proxyId.subscribe(function(newValue){self.modified(true)});
+
//private List<String> blackListPatterns;
this.blackListPatterns=ko.observableArray(blackListPatterns);
+ this.blackListPatterns.subscribe(function(newValue){self.modified(true)});
+
//private List<String> whiteListPatterns;
this.whiteListPatterns=ko.observableArray(whiteListPatterns);
+ this.whiteListPatterns.subscribe(function(newValue){self.modified(true)});
+
//private Map<String, String> policies;
this.policies=ko.observable(policies);
+ this.policies.subscribe(function(newValue){self.modified(true)});
+
//private Map<String, String> properties;
this.properties=ko.observable(properties);
+ this.properties.subscribe(function(newValue){self.modified(true)});
+
//private boolean disabled = false;
this.disabled=ko.observable(disabled);
+ this.disabled.subscribe(function(newValue){self.modified(true)});
+
//private int order = 0;
this.order=ko.observable(order);
+ this.order.subscribe(function(newValue){self.modified(true)});
+
+ this.modified=ko.observable(false);
}
PolicyInformation=function(options,defaultOption,id,name){
+
+ var self=this;
+ this.modified=ko.observable(false);
+
//private List<String> options;
this.options=ko.observableArray(options);
+ this.options.subscribe(function(newValue){self.modified(true)});
+
//private String defaultOption;
this.defaultOption=ko.observable(defaultOption);
+ this.defaultOption.subscribe(function(newValue){self.modified(true)});
+
//private String id;
this.id=ko.observable(id);
+ this.id.subscribe(function(newValue){self.modified(true)});
+
//private String name;
this.name=ko.observable(name);
+ this.name.subscribe(function(newValue){self.modified(true)});
}
ManagedRepositoryConnectorView=function(source,targetRepos){
+ var self=this;
+ this.modified=ko.observable(false);
+
this.source=ko.observable(source);
this.targetRepos=ko.observableArray(targetRepos);
}
ProxyConnectorsViewModel=function(){
- this.proxyConnectors=ko.observableArray([]);
var self=this;
+ this.proxyConnectors=ko.observableArray([]);
this.managedRepositoryConnectorViews=ko.observableArray([]);
this.policyInformations=ko.observableArray([]);
this.managedRepositories=ko.observableArray([]);
}
showSettings=function(sourceRepoId,targetRepoId){
- //proxy-connectors-grid-remoterepo-settings-edit-internal-central
- var targetImgId="#proxy-connectors-grid-remoterepo-settings-edit-"+sourceRepoId+"-"+targetRepoId;
- //proxy-connectors.grid-remoterepo-settings-content-internal-central
- var targetContentId="#proxy-connectors-grid-remoterepo-settings-content-"+sourceRepoId+"-"+targetRepoId;
- $(targetContentId).html("");
- $(targetContentId).append($("#proxy-connectors-remote-settings-popover-tmpl").tmpl(self.getProxyConnector(sourceRepoId,targetRepoId)));
- $(targetImgId).attr("data-content",$(targetContentId).html());
- $(targetImgId).popover(
+ var targetContent = $("#proxy-connectors-grid-remoterepo-settings-content-"+sourceRepoId+"-"+targetRepoId);
+ targetContent.html("");
+ targetContent.append($("#proxy-connectors-remote-settings-popover-tmpl")
+ .tmpl(self.getProxyConnector(sourceRepoId,targetRepoId)));
+
+ var targetImg = $("#proxy-connectors-grid-remoterepo-settings-edit-"+sourceRepoId+"-"+targetRepoId);
+ targetImg.attr("data-content",targetContent.html());
+ targetImg.popover(
{
placement: "left",
html: true,
}
);
- $(targetImgId).popover('show');
+ targetImg.popover('show');
}
// FIXME use various callback to prevent async false !!
displayProxyConnectors=function(){
- $("#main-content").html($("#proxyConnectorsMain").tmpl());
- $("#main-content").append(smallSpinnerImg());
+ var mainContent = $("#main-content");
+ mainContent.html($("#proxyConnectorsMain").tmpl());
+ mainContent.append(smallSpinnerImg());
this.proxyConnectorsViewModel = new ProxyConnectorsViewModel();
var self=this;
if (data==null){
return null;
}
+ var policies = data.policies == null ? null: $.each(data.policies,function(item){
+ return new Entry(item.key, item.value);
+ });
return new ProxyConnector(data.sourceRepoId,data.targetRepoId,data.proxyId,mapStringArray(data.blackListPatterns),
- mapStringArray(data.whiteListPatterns),data.policies,data.properties,
+ mapStringArray(data.whiteListPatterns),policies,data.properties,
data.disabled,data.order);
}
this.availableLayouts = window.managedRepositoryTypes;
this.save=function(){
- $.log("repositories.js#save");
var valid = $("#main-content #managed-repository-edit-form").valid();
if (valid==false) {
return;
var self = this;
editManagedRepository=function(managedRepository){
+ var mainContent = $("#main-content");
var viewModel = new ManagedRepositoryViewModel(managedRepository,true,self);
- ko.applyBindings(viewModel,$("#main-content #managed-repository-edit").get(0));
+ ko.applyBindings(viewModel,mainContent.find("#managed-repository-edit").get(0));
activateManagedRepositoryEditTab();
- $("#managed-repository-edit-li a").html($.i18n.prop('edit'));
+ mainContent.find("#managed-repository-edit-li a").html($.i18n.prop('edit'));
activateManagedRepositoryFormValidation();
}
}
var archivaRepositoryStatistics=mapArchivaRepositoryStatistics(data.archivaRepositoryStatistics);
archivaRepositoryStatistics.managedRepository=curRepo;
-
- $("#managedrepository-stats-"+curRepo.id()).append($("#managed-repository-stats-tmpl").tmpl(archivaRepositoryStatistics));
- $("#managedrepository-stats-img-"+curRepo.id()).attr("data-content",$(calculatePopoverId(curRepo)).html());
- $("#managedrepository-stats-img-"+curRepo.id()).popover(
+ var mainContent = $("#main-content");
+ mainContent.find("#managedrepository-stats-"+curRepo.id()).append($("#managed-repository-stats-tmpl").tmpl(archivaRepositoryStatistics));
+ mainContent.find("#managedrepository-stats-img-"+curRepo.id()).attr("data-content",$(calculatePopoverId(curRepo)).html());
+ mainContent.find("#managedrepository-stats-img-"+curRepo.id()).popover(
{
placement: "left",
html: true,
}
);
- $("#managedrepository-stats-img-"+curRepo.id()).popover('show');
+ mainContent.find("#managedrepository-stats-img-"+curRepo.id()).popover('show');
removeSmallSpinnerImg();
},
error: function(data) {
}
calculatePopoverId=function(managedRepository){
- return "#managedrepository-stats-"+managedRepository.id() + " #managedrepository-stats-"+managedRepository.id()+"-popover";
+ return "#main-content #managedrepository-stats-"+managedRepository.id() + " #managedrepository-stats-"+managedRepository.id()+"-popover";
}
hideStats=function(managedRepository){
}
showPomSnippet=function(managedRepository){
-
- $("#managed-repositories-pom-snippet").html(mediumSpinnerImg());
- $('#managed-repositories-pom-snippet').show();
+ var mainContent = $("#main-content");
+ mainContent.find("#managed-repositories-pom-snippet").html(mediumSpinnerImg());
+ mainContent.find('#managed-repositories-pom-snippet').show();
var url = "restServices/archivaServices/managedRepositoriesService/getPomSnippet/"+encodeURIComponent(managedRepository.id());
$.ajax(url,
{
success: function(data) {
var viewModel = new RemoteRepositoryViewModel(remoteRepository,true,self);
viewModel.networkProxies(mapNetworkProxies(data));
- ko.applyBindings(viewModel,$("#main-content #remote-repository-edit").get(0));
+ var mainContent = $("#main-content");
+ ko.applyBindings(viewModel,mainContent.find("#remote-repository-edit").get(0));
activateRemoteRepositoryEditTab();
- $("#remote-repository-edit-li a").html($.i18n.prop('edit'));
+ mainContent.find("#remote-repository-edit-li a").html($.i18n.prop('edit'));
activateRemoteRepositoryFormValidation();
}
})
}
activateRemoteRepositoriesGridTab=function(){
- $("#main-content #remote-repository-edit-li").removeClass("active");
- $("#main-content #remote-repository-edit").removeClass("active");
+ var mainContent = $("#main-content");
+ mainContent.find("#remote-repository-edit-li").removeClass("active");
+ mainContent.find("#remote-repository-edit").removeClass("active");
- $("#main-content #remote-repositories-view-li").addClass("active");
- $("#main-content #remote-repositories-view").addClass("active");
- $("#main-content #remote-repository-edit-li a").html($.i18n.prop("add"));
+ mainContent.find("#remote-repositories-view-li").addClass("active");
+ mainContent.find("#remote-repositories-view").addClass("active");
+ mainContent.find("#remote-repository-edit-li a").html($.i18n.prop("add"));
}
activateRemoteRepositoryEditTab=function(){
- $("#main-content #remote-repositories-view-li").removeClass("active");
- $("#main-content #remote-repositories-view").removeClass("active");
+ var mainContent = $("#main-content");
+ mainContent.find("#remote-repositories-view-li").removeClass("active");
+ mainContent.find("#remote-repositories-view").removeClass("active");
- $("#main-content #remote-repository-edit-li").addClass("active");
- $("#main-content #remote-repository-edit").addClass("active");
+ mainContent.find("#remote-repository-edit-li").addClass("active");
+ mainContent.find("#remote-repository-edit").addClass("active");
}
//---------------------------
displayRepositoriesGrid=function(){
clearUserMessages();
- $("#main-content").html(mediumSpinnerImg());
- $("#main-content").html($("#repositoriesMain").tmpl());
- $("#main-content #repositories-tabs a:first").tab("show");
+ var mainContent = $("#main-content");
+ mainContent.html(mediumSpinnerImg());
+ mainContent.html($("#repositoriesMain").tmpl());
+ mainContent.find("#repositories-tabs a:first").tab("show");
- $("#main-content #managed-repositories-content").append(mediumSpinnerImg());
- $("#main-content #remote-repositories-content").append(mediumSpinnerImg());
+ mainContent.find("#managed-repositories-content").append(mediumSpinnerImg());
+ mainContent.find("#remote-repositories-content").append(mediumSpinnerImg());
var managedRepositoriesViewModel = new ManagedRepositoriesViewModel();
var remoteRepositoriesViewModel = new RemoteRepositoriesViewModel();
],
pageSize: 5,
gridUpdateCallBack: function(){
- $("#main-content #managed-repositories-table [title]").tooltip();
+ $("#main-content #managed-repositories-table").find("[title]").tooltip();
}
});
- ko.applyBindings(managedRepositoriesViewModel,$("#main-content #managed-repositories-view").get(0));
+ var mainContent = $("#main-content");
+ ko.applyBindings(managedRepositoriesViewModel,mainContent.find("#managed-repositories-view").get(0));
- $("#main-content #managed-repositories-pills a:first").tab('show');
+ mainContent.find("#managed-repositories-pills #managed-repositories-view-a").tab('show');
removeMediumSpinnerImg("#main-content #managed-repositories-content");
activateManagedRepositoriesGridTab();
}
],
pageSize: 5,
gridUpdateCallBack: function(){
- $("#main-content #remote-repositories-table [title]").tooltip();
+ $("#main-content #remote-repositories-table").find("[title]").tooltip();
}
});
- ko.applyBindings(remoteRepositoriesViewModel,$("#main-content #remote-repositories-table").get(0));
- $("#main-content #remote-repositories-pills a:first").tab('show')
+ var mainContent = $("#main-content");
+ ko.applyBindings(remoteRepositoriesViewModel,mainContent.find("#remote-repositories-table").get(0));
+ mainContent.find("#remote-repositories-pills #remote-repositories-view-a").tab('show')
removeMediumSpinnerImg("#main-content #remote-repositories-content");
}
}
$("#main-content #managed-repositories-pills").on('show', function (e) {
+ var mainContent = $("#main-content");
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));
+ ko.applyBindings(viewModel,mainContent.find("#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"));
+ mainContent.find("#managed-repository-edit-li a").html($.i18n.prop("add"));
}
});
<div id="managed-repositories-content" class="tab-pane active">
<ul id="managed-repositories-pills" class="nav nav-pills">
<li class="active" id="managed-repositories-view-li">
- <a data-toggle="tab" href="#managed-repositories-view">${$.i18n.prop('managedrepositories.grid.tab.title')}</a>
+ <a data-toggle="tab" href="#managed-repositories-view" id="managed-repositories-view-a">${$.i18n.prop('managedrepositories.grid.tab.title')}</a>
</li>
<li id="managed-repository-edit-li">
<a data-toggle="tab" href="#managed-repository-edit">${$.i18n.prop('add')}</a>
<div id="remote-repositories-content" class="tab-pane">
<ul id="remote-repositories-pills" class="nav nav-pills">
<li class="active" id="remote-repositories-view-li">
- <a data-toggle="tab" href="#remote-repositories-view">${$.i18n.prop('remoterepositories.grid.tab.title')}</a>
+ <a data-toggle="tab" href="#remote-repositories-view" id="remote-repositories-view-a">${$.i18n.prop('remoterepositories.grid.tab.title')}</a>
</li>
<li id="remote-repository-edit-li">
<a data-toggle="tab" href="#remote-repository-edit">${$.i18n.prop('add')}</a>
return "?"+appendArchivaVersion()+timestampNoCache();
}
+/**
+ * mapping for a java Map entry
+ * @param key
+ * @param value
+ */
+Entry=function(key,value){
+ var self=this;
+ this.modified=ko.observable(false);
+ this.key=ko.observable(key);
+ this.key.subscribe(function(newValue){self.modified(true)});
+
+ this.value=ko.observable(value);
+ this.value.subscribe(function(newValue){self.modified(true)});
+}
// extends jquery tmpl to support var def
$.extend($.tmpl.tag, {