Browse Source

de-dojo admin header menu

Jason Rivard 3 years ago
parent
commit
3a524a671b

+ 2 - 2
rest-test-service/pom.xml

@@ -82,9 +82,9 @@
             <version>2.9.0</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.commons</groupId>
+            <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>1.3.2</version>
+            <version>2.11.0</version>
         </dependency>
         <dependency>
             <groupId>org.pwm-project</groupId>

+ 5 - 5
webapp/src/main/webapp/WEB-INF/jsp/fragment/header-body.jsp

@@ -28,11 +28,10 @@
 <%@ page import="password.pwm.http.JspUtility" %>
 <%@ page import="password.pwm.http.PwmRequestFlag" %>
 <%@ page import="password.pwm.http.tag.conditional.PwmIfTest" %>
+<%@ page import="password.pwm.Permission" %>
+<%@ page import="password.pwm.http.servlet.PwmServletDefinition" %>
 <%@ taglib uri="pwm" prefix="pwm" %>
 
-<pwm:if test="<%=PwmIfTest.headerMenuIsVisible%>">
-    <%@ include file="header-menu.jsp" %>
-</pwm:if>
 <div id="header">
     <div id="header-company-logo">
     </div>
@@ -49,7 +48,6 @@
                 <span class="title-short"><pwm:display key="Title_Application_Abbrev"/></span>
             </div>
         </div>
-
         <div id="header-center-right">
             <div id="header-menu-wrapper">
                 <div id="header-menu">
@@ -65,7 +63,9 @@
                         </pwm:if>
                     </div>
                 </div>
-
+                <pwm:if test="<%=PwmIfTest.headerMenuIsVisible%>">
+                    <%@ include file="header-menu.jsp" %>
+                </pwm:if>
                 <% if (!JspUtility.isFlag(request, PwmRequestFlag.HIDE_HEADER_BUTTONS)) { %>
                     <pwm:if test="<%=PwmIfTest.authenticated%>">
                         <pwm:if test="<%=PwmIfTest.showHome%>">

+ 17 - 46
webapp/src/main/webapp/public/resources/js/configmanager.js

@@ -101,23 +101,6 @@ PWM_CONFIG.waitForRestart=function(options) {
     PWM_MAIN.ajaxRequest(url,loadFunction,{errorFunction:errorFunction,method:'GET',preventCache:true});
 };
 
-PWM_CONFIG.startNewConfigurationEditor=function(template) {
-    PWM_MAIN.showWaitDialog({title:'Loading...',loadFunction:function(){
-            require(["dojo"],function(dojo){
-                dojo.xhrGet({
-                    url:"ConfigManager?processAction=setOption&pwmFormID=" + PWM_GLOBAL['pwmFormID'] + "&getTemplate=" + template,
-                    preventCache: true,
-                    error: function(errorObj) {
-                        PWM_MAIN.showError("error starting configuration editor: " + errorObj);
-                    },
-                    load: function() {
-                        window.location = "ConfigManager?processAction=editMode&pwmFormID=" + PWM_GLOBAL['pwmFormID'] + '&mode=SETTINGS';
-                    }
-                });
-            });
-        }});
-};
-
 PWM_CONFIG.uploadConfigDialog=function() {
     PWM_MAIN.preloadAll(function() {
         var uploadOptions = {};
@@ -158,25 +141,27 @@ PWM_CONFIG.uploadLocalDB=function() {
 
 PWM_CONFIG.closeHeaderWarningPanel = function() {
     console.log('action closeHeader');
-
     PWM_MAIN.addCssClass('header-warning','nodisplay');
-    PWM_MAIN.addCssClass('header-warning-backdrop','nodisplay');
-    //PWM_MAIN.removeCssClass('button-openHeader','nodisplay');
+    PWM_MAIN.removeCssClass('button-openHeader','nodisplay');
 };
 
 PWM_CONFIG.openHeaderWarningPanel = function() {
     console.log('action openHeader');
+    PWM_MAIN.removeCssClass('header-warning','nodisplay');
+    PWM_MAIN.addCssClass('button-openHeader','nodisplay');
+};
 
-    require(['dojo/dom','dijit/place'], function(dom, place) {
-        PWM_MAIN.removeCssClass('header-warning-backdrop','nodisplay');
-        PWM_MAIN.removeCssClass('header-warning','nodisplay');
-        //PWM_MAIN.addCssClass('button-openHeader','nodisplay');
-        place.around(PWM_MAIN.getObject("header-warning"), PWM_MAIN.getObject("header-username-caret"), ["below-alt"], false);
+PWM_CONFIG.handleWindowClickForHeaderWarningPanel = function(event) {
+    var headerMenuElement = document.getElementById('header-menu');
+    var match = headerMenuElement &&
+        ( headerMenuElement.contains(event.target) || headerMenuElement.contains(event.target) );
 
-        PWM_MAIN.addEventHandler("header-warning-backdrop", "click", function(event) {
-            PWM_CONFIG.closeHeaderWarningPanel();
-        });
-    });
+    if (!match) {
+        var headerWarningElement = PWM_MAIN.getObject('header-warning');
+        if (!headerWarningElement.classList.contains('nodisplay')) {
+            headerWarningElement.classList.add('nodisplay');
+        }
+    }
 };
 
 PWM_CONFIG.showString=function (key, options) {
@@ -205,7 +190,7 @@ PWM_CONFIG.showHeaderHealth = function() {
                     PWM_MAIN.addCssClass('panel-header-healthData','display-none');
                 }
                 setTimeout(function () {
-                    PWM_CONFIG.showHeaderHealth()
+                    PWM_CONFIG.showHeaderHealth();
                 }, 30 * 1000);
             }
         };
@@ -286,10 +271,6 @@ PWM_CONFIG.heartbeatCheck = function() {
         return;
     }
 
-    require(["dojo","dijit/Dialog"],function() {
-        /* make sure dialog js is loaded, server may not be available to load lazy */
-    });
-
     console.log('beginning config-editor heartbeat check');
     var handleErrorFunction = function(message) {
         console.log('config-editor heartbeat failed');
@@ -322,6 +303,7 @@ PWM_CONFIG.initConfigHeader = function() {
     PWM_MAIN.addEventHandler('panel-header-healthData','click',function(){
         PWM_MAIN.gotoUrl('/private/config/manager');
     });
+
     PWM_MAIN.addEventHandler('button-closeHeader','click',function(){
         PWM_CONFIG.closeHeaderWarningPanel();
     });
@@ -332,18 +314,7 @@ PWM_CONFIG.initConfigHeader = function() {
         PWM_CONFIG.openHeaderWarningPanel();
     });
 
-    var newElement = document.createElement('div');
-    newElement.id =  "header-warning-backdrop";
-    newElement.setAttribute('class','nodisplay');
-    document.body.appendChild(newElement);
-
-    /*
-    require(["dojo/dom-construct", "dojo/_base/window", "dojo/dom", "dijit/place"], function(domConstruct, win, dom, place){
-        PWM_MAIN.addEventHandler(window, "resize", function () {
-            place.around(dom.byId("header-warning"), dom.byId("header-username-caret"), ["below-alt"], false);
-        });
-    });
-     */
+    window.addEventListener('click',PWM_CONFIG.handleWindowClickForHeaderWarningPanel);
 
     PWM_CONFIG.showHeaderHealth();
 

+ 11 - 12
webapp/src/main/webapp/public/resources/style.css

@@ -317,7 +317,6 @@ input[type=password]::-ms-reveal {
     width: 165px;
     height: 165px;
     overflow: hidden;
-    z-index: 600;
     font-weight: normal;
 }
 
@@ -572,23 +571,22 @@ html[dir="rtl"] #header-center-right {
     position: absolute;
 }
 
-#header-warning-backdrop {
-    bottom: 0;
-    left: 0;
-    position: absolute;
-    right: 0;
-    top: 0;
-    z-index: 1000;
-}
-
 #header-warning {
+    color: black;
+    opacity: 1.0;
     text-align: center;
     position: absolute;
-    width: 200px;
+    z-index: 100;
+    min-width: 200px;
     border: 2px solid #aaaaaa;
     background-color: #DDDDDD;
     padding: 15px;
-    z-index: 1000;
+    right: 0;
+}
+
+#header-warning-content {
+    position: relative;
+    text-align: center;
 }
 
 #header-warning span {
@@ -643,6 +641,7 @@ html[dir="rtl"] #header-center-right {
 }
 
 .header-error {
+    text-align: center;
     color: #fff;
     white-space: normal;
     max-width: 600px;