From: Olivier Lamy Date: Wed, 11 Jul 2012 22:02:51 +0000 (+0000) Subject: avoid npe when admin user has not been created X-Git-Tag: archiva-1.4-M3~509 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=450f03a6a6c68ad02985cff93ff40daeebba0d70;p=archiva.git avoid npe when admin user has not been created git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360435 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml index ac061bcb4..99fc1a63c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml @@ -808,7 +808,8 @@ ${archivaAppServerBase} ${archivaAppServerBase} ${archivaAppServerBase}/logs - ${basedir}/target/auto-admin-creation.properties + + ${project.build.directory} ${archivaAppServerBase}/conf/archiva.xml ${archiva.devMode} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index b5dc9a0f3..d1c1bf26f 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -148,9 +148,6 @@ } }); - - - require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) { loadi18n(function () { $.ajax({ @@ -162,13 +159,10 @@ window.archivaRuntimeInfo=data; require(['sammy','archiva.main','domReady!'],function (domReady) { - $.log("startArchivaApplication"); - startArchivaApplication(); - $("#loadingDiv").hide(); + $.log("startArchivaApplication"); + startArchivaApplication(); + $("#loadingDiv").hide(); }) - - - } }) }) 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 137328d28..4b7167314 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 @@ -269,7 +269,8 @@ function() { }); this.get('#:folder', function () { self.activeMenuId(this.params.folder); - ko.utils.arrayFirst(self.artifactMenuItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) { + var baseItems = self.artifactMenuItems?self.artifactMenuItems:[]; + ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) { if ( p.href == "#"+self.activeMenuId()) { p.func(); return; @@ -277,21 +278,27 @@ function() { }); }); + this.get('#open-admin-create-box',function(){ + $.log("#open-admin-create-box"); + adminCreateBox(); + }); //this.get('', function () { this.app.runRoute('get', '#search') }); } ); sammyArchivaApplication.run(); } startArchivaApplication=function(){ + $.log("startArchivaApplication"); $('#topbar-menu-container').html($("#topbar_menu_tmpl" ).tmpl()); $('#sidebar-content').html($("#main_menu_tmpl").tmpl()); ko.bindingHandlers.redbackP = { - init: function(element, valueAccessor) { - $(element).attr("redback-permissions",valueAccessor); - } + init: function(element, valueAccessor) { + $(element).attr("redback-permissions",valueAccessor); + } }; + ko.applyBindings(new MainMenuViewModel()); hideElementWithKarma(); @@ -299,8 +306,6 @@ function() { checkCreateAdminLink(); $('#footer-content').html($('#footer-tmpl').tmpl(window.archivaRuntimeInfo)); - - $( "#quick-search-autocomplete" ).autocomplete({ minLength: 3, delay: 600, diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/menu.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/menu.html index 89f6cd722..f77c8db58 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/menu.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/menu.html @@ -28,7 +28,6 @@ -