Pārlūkot izejas kodu

Removed the need for the hash symbol ('#') for angular ui router navigation

James Albright 8 gadi atpakaļ
vecāks
revīzija
c50a18499d

+ 1 - 0
src/main/angular/index.html

@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 <head>
+    <base href="/" />
     <meta charset="UTF-8">
     <meta name="viewport" content="initial-scale=1, maximum-scale=1">
     <title>SSPR Development</title>

+ 7 - 1
src/main/angular/src/routes.ts

@@ -1,8 +1,14 @@
 export default [
     '$stateProvider',
     '$urlRouterProvider',
-    ($stateProvider: angular.ui.IStateProvider, $urlRouterProvider: angular.ui.IUrlRouterProvider) => {
+    '$locationProvider',
+    (
+        $stateProvider: angular.ui.IStateProvider,
+        $urlRouterProvider: angular.ui.IUrlRouterProvider,
+        $locationProvider: angular.ILocationProvider
+    ) => {
         $urlRouterProvider.otherwise('/search/cards');
+        $locationProvider.html5Mode(true);
 
         $stateProvider.state('search', { url: '/search?query', component: 'peopleSearch', reloadOnSearch: false });
         $stateProvider.state('search.table', { url: '/table', component: 'peopleSearchTable' });

+ 2 - 1
src/main/angular/webpack.common.js

@@ -11,7 +11,8 @@ module.exports = {
     devServer: {
         contentBase: outDir,
         outputPath: outDir,
-        port: 4000
+        port: 4000,
+        historyApiFallback: true
     },
     devtool: 'cheap-module-source-map',
     // Externals copied to /dist via CopyWebpackPlugin

+ 4 - 0
src/main/java/password/pwm/http/servlet/peoplesearch/PeopleSearchServlet.java

@@ -52,8 +52,12 @@ import java.util.*;
         urlPatterns = {
                 PwmConstants.URL_PREFIX_PRIVATE + "/peoplesearch",
                 PwmConstants.URL_PREFIX_PUBLIC + "/peoplesearch",
+                PwmConstants.URL_PREFIX_PRIVATE + "/peoplesearch/*",
+                PwmConstants.URL_PREFIX_PUBLIC + "/peoplesearch/*",
                 PwmConstants.URL_PREFIX_PRIVATE + "/PeopleSearch",
                 PwmConstants.URL_PREFIX_PUBLIC + "/PeopleSearch",
+                PwmConstants.URL_PREFIX_PRIVATE + "/PeopleSearch/*",
+                PwmConstants.URL_PREFIX_PUBLIC + "/PeopleSearch/*",
         }
 )
 public class PeopleSearchServlet extends AbstractPwmServlet {

+ 4 - 1
src/main/resources/password/pwm/i18n/Display.properties

@@ -309,6 +309,9 @@ Title_UserInformation=My Account
 Title_ValidateCode=Validate Code
 Title_VerificationSend=Select verification method
 Title_DeleteAccount=Delete My Account
+Title_Management=Management
+Title_DirectReports=Direct Reports
+Title_Organization=Organization
 Tooltip_PasswordStrength=The password strength meter shows how easy it is to guess your password. Try the following to make your password stronger:<ul><li>Make the password longer</li><li>Do not repeat letters or numbers</li><li>Use mixed (upper and lower) case letters</li><li>Add more numbers</li><li>Add more symbol characters</li></ul>
 Confirm_DeleteUser=Are you sure you wish to proceed?  If you continue, the selected user will be deleted permanently.  This can not be undone.
 Confirm=Are you sure you wish to proceed?
@@ -318,4 +321,4 @@ Value_NotApplicable=n/a
 Value_Default=Default
 Value_ProgressComplete=Complete
 Value_ProgressInProgress=In Progress
-Placeholder_Search=Search
+Placeholder_Search=Search

+ 6 - 0
src/main/webapp/WEB-INF/jsp/fragment/header.jsp

@@ -30,8 +30,14 @@
 <%@ page import="password.pwm.http.tag.value.PwmValue" %>
 <%@ page import="password.pwm.http.PwmRequestFlag" %>
 <%@ page import="password.pwm.http.tag.url.PwmThemeURL" %>
+<%@ page import="org.apache.commons.lang3.StringUtils" %>
 <%@ taglib uri="pwm" prefix="pwm" %>
+
 <head>
+    <% if (StringUtils.isNotBlank(request.getParameter("baseHref"))) { %>
+        <base href="${param.baseHref}" />
+    <% } %>
+
     <pwm:if test="<%=PwmIfTest.authenticated%>" negate="true"><title><pwm:display key="Title_TitleBar"/></title></pwm:if>
     <pwm:if test="<%=PwmIfTest.authenticated%>"><title><pwm:display key="Title_TitleBarAuthenticated"/></title></pwm:if>
     <meta http-equiv="content-type" content="text/html;charset=utf-8"/>

+ 3 - 1
src/main/webapp/WEB-INF/jsp/peoplesearch.jsp

@@ -24,7 +24,9 @@
 <%@ page language="java" session="true" isThreadSafe="true" contentType="text/html" %>
 <%@ taglib uri="pwm" prefix="pwm" %>
 <html lang="<pwm:value name="<%=PwmValue.localeCode%>"/>" dir="<pwm:value name="<%=PwmValue.localeDir%>"/>">
-<%@ include file="/WEB-INF/jsp/fragment/header.jsp" %>
+<jsp:include page="/WEB-INF/jsp/fragment/header.jsp">
+    <jsp:param name="baseHref" value="${pageContext.request.contextPath}/private/peoplesearch/" />
+</jsp:include>
 <body class="nihilo">
 <div id="wrapper" class="peoplesearch-wrapper">
     <jsp:include page="/WEB-INF/jsp/fragment/header-body.jsp">

+ 4 - 1
src/main/webapp/public/resources/js/peoplesearch.js

@@ -172,7 +172,10 @@ PWM_PS.applyEventHandlersToDetailView = function(data) {
 //  TODO: need to get this setting from: /peoplesearch?processAction=clientData, see line 426
 //    if (data['hasOrgChart']) {
         PWM_MAIN.addEventHandler('button-peoplesearch-orgChart', 'click', function () {
-            PWM_MAIN.goto(PWM_GLOBAL['url-context'] + '/private/peoplesearch#/orgchart/' + data['userKey']);
+
+            // Access the angular StateService on this page, and use it to navigate to the orgchart using the provided person ID
+            angular.element(document.body).injector().get('$state').go('orgchart', {personId: data['userKey']});
+
             PWM_MAIN.clearDijitWidget('dialogPopup');
 //            PWM_PS.showOrgChartView(data['userKey']);
         });