]> source.dussan.org Git - archiva.git/commitdiff
avoid npe when admin user has not been created
authorOlivier Lamy <olamy@apache.org>
Wed, 11 Jul 2012 22:02:51 +0000 (22:02 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 11 Jul 2012 22:02:51 +0000 (22:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360435 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/menu.html
archiva-modules/archiva-web/archiva-webapp-js/src/test/tomcat/tomcat-context-archiva.xml

index ac061bcb462fcbc797bcaf488e49b93bafd37e9c..99fc1a63c1dddae5913ab9d01979017b0b31bc49 100644 (file)
             <appserver.base>${archivaAppServerBase}</appserver.base>
             <appserver.home>${archivaAppServerBase}</appserver.home>
             <derby.system.home>${archivaAppServerBase}/logs</derby.system.home>
-            <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
+            <!-- remove admin auto creation that must be tested too -->
+            <!--redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file-->
             <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
             <archiva.user.configFileName>${archivaAppServerBase}/conf/archiva.xml</archiva.user.configFileName>
             <archiva.devMode>${archiva.devMode}</archiva.devMode>
index b5dc9a0f33a9ee7c85e726728a2d0bc1698ba0ab..d1c1bf26f4f9ad6f9f83858458ba95d2c80f42b1 100644 (file)
                     }
                 });
 
-
-
-
                 require(['jquery','i18n','sammy','startup','utils','domReady!'], function (domReady) {
                     loadi18n(function () {
                       $.ajax({
                               window.archivaRuntimeInfo=data;
 
                               require(['sammy','archiva.main','domReady!'],function (domReady) {
-                                      $.log("startArchivaApplication");
-                                      startArchivaApplication();
-                                      $("#loadingDiv").hide();
+                                  $.log("startArchivaApplication");
+                                  startArchivaApplication();
+                                  $("#loadingDiv").hide();
                               })
-
-
-
                           }
                         })
                     })
index 137328d28f520439a28624b1096e553234f4dd5b..4b7167314cf35e490511c76e8520bee8723c096c 100644 (file)
@@ -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,
index 89f6cd72265deeed83a56ce7c19e03b05e2242a4..f77c8db58d1e1348481cb3049acd7af40b4bbeb5 100644 (file)
@@ -28,7 +28,6 @@
           <a data-bind="text: text, attr: { id: id, href: href}"></a>
        </li>
        <!-- /ko -->
-
     </ul>
 
     <ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}" data-bind="foreach: administrationMenuItems">
@@ -65,7 +64,7 @@
           <div id="organisation-logo" class="pull-left"></div>
           <ul class="nav pull-right">
             <li id="create-admin-link" style="display: none">
-              <a href="#" onclick="adminCreateBox();" id="create-admin-link-a">
+              <a href="#open-admin-create-box" onclick="adminCreateBox();" id="create-admin-link-a">
                 <span class="label label-important">${$.i18n.prop('create.admin.page.link')}</span>
               </a>
             </li>
index fda8f8221482b75541b3d07447fc1d37c100ee20..4f7ce1d69b59f7fe34da3b45fe0f57bcb4f7ead6 100644 (file)
@@ -22,7 +22,7 @@
             username="sa"
             password=""
             driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
-            url="jdbc:derby:${catalina.base}/target/database/users;create=true"
+            url="jdbc:derby:${appserver.base}/database/users;create=true"
   />
   <Resource name="mail/Session" auth="Container"
           type="javax.mail.Session"