diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js index 877b447dd..c35a2d372 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js @@ -561,7 +561,59 @@ define("archiva.general-admin",["jquery","i18n","order!utils","order!jquery.tmpl } //--------------------------- - // system status part + // UiConfiguration part + //--------------------------- + + displayUiConfiguration=function(){ + screenChange(); + var mainContent=$("#main-content"); + mainContent.html(mediumSpinnerImg()); + $.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", { + type: "GET", + dataType: 'json', + success: function(data){ + mainContent.html($("#ui-configuration-screen").tmpl()); + var uiConfiguration=new UiConfiguration(data.showFindArtifacts,data.appletFindEnabled,data.disableEasterEggs,data.applicationUrl); + var uiConfigurationViewModel=new UiConfigurationViewModel(uiConfiguration); + ko.applyBindings(uiConfigurationViewModel,mainContent.get(0)); + /*var validator = mainContent.find("#network-configuration-edit-form").validate({ + showErrors: function(validator, errorMap, errorList) { + customShowError(mainContent.find("#network-configuration-edit-form" ).get(0),validator,errorMap,errorMap); + } + });*/ + } + }); + } + + UiConfiguration=function(showFindArtifacts,appletFindEnabled,disableEasterEggs,applicationUrl){ + this.showFindArtifacts = ko.observable(showFindArtifacts); + + this.appletFindEnabled = ko.observable(appletFindEnabled); + + this.disableEasterEggs = ko.observable(disableEasterEggs); + + this.applicationUrl = ko.observable(applicationUrl); + } + + UiConfigurationViewModel=function(uiConfiguration){ + this.uiConfiguration=ko.observable(uiConfiguration); + var self=this; + save=function(){ + $.ajax("restServices/archivaServices/archivaAdministrationService/setUiConfiguration", { + type: "POST", + contentType: 'application/json', + data: ko.toJSON(self.uiConfiguration), + dataType: 'json', + success: function(data){ + displaySuccessMessage( $.i18n.prop("ui-configuration.updated")); + } + }); + } + } + + + //--------------------------- + // System status part //--------------------------- QueueEntry=function(key,entriesNumber){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js index bb99f2c9f..fc47abaa1 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js @@ -124,6 +124,10 @@ function() { displayRepositoriesGrid(); return; } + if (screen=='ui-configuration'&& hasKarma('archiva-manage-configuration')){ + displayUiConfiguration(); + return; + } if (screen=="browse"){ displayBrowse(true); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html index f19635cdb..67236a7e4 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html @@ -315,6 +315,28 @@ + + + +