Added initial POC support for running at ./ instead of absolute / for the main dashboard

This commit is contained in:
2025-06-24 16:55:32 -05:00
parent d41f5f8339
commit ad0b9698b1
4 changed files with 534 additions and 501 deletions

1002
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,8 @@
"@types/react-dom": "18.0.0",
"@types/react-router-hash-link": "2.4.5",
"ace-builds": "1.12.3",
"ajv": "^8.11.0",
"ajv-keywords": "^5.1.0",
"chart.js": "3.4.1",
"chroma-js": "2.4.2",
"cmdk": "0.2.0",
@ -35,8 +37,8 @@
"html-react-parser": "1.4.8",
"html-to-text": "^9.0.5",
"http-proxy-middleware": "2.0.6",
"lodash": "4.17.21",
"jwt-decode": "3.1.2",
"lodash": "4.17.21",
"oidc-client-ts": "2.4.1",
"rapidoc": "9.3.4",
"react": "18.0.0",
@ -60,14 +62,15 @@
"yup": "0.32.11"
},
"scripts": {
"build": "react-scripts build",
"build": "PUBLIC_URL=. react-scripts build",
"clean": "rm -rf node_modules package-lock.json lib",
"eject": "react-scripts eject",
"clean-and-install": "rm -rf node_modules/ && rm -rf package-lock.json && rm -rf lib/ && npm install --legacy-peer-deps && npm dedupe --force",
"npm-install": "npm install --legacy-peer-deps",
"prepublishOnly": "tsc -p ./ --outDir lib/",
"start": "BROWSER=none react-scripts --max-http-header-size=65535 start",
"test": "react-scripts test"
"start": "PUBLIC_URL=. BROWSER=none react-scripts --max-http-header-size=65535 start",
"test": "react-scripts test",
"export": "rm -rf dist && PUBLIC_URL=. react-scripts build && rm -rf src/main/resources/material-dashboard && mkdir -p src/main/resources/material-dashboard && cp -r build/* src/main/resources/material-dashboard"
},
"eslintConfig": {
"extends": [

View File

@ -66,7 +66,7 @@
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-backend-core</artifactId>
<version>0.25.0-integration-sprint-62-20250307-205536</version>
<version>0.26.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>

View File

@ -36,6 +36,20 @@ import {BrowserRouter} from "react-router-dom";
const qController = Client.getInstance();
function getBasePath(): string
{
// You can change this logic depending on how you detect your mount point
const path = window.location.pathname;
console.warn("Using hacked base path for QQQ application, please update this code to be better : path ["+ path +"].");
// Example: If app is deployed at /admin or /portal
if (path.startsWith("/admin")) return "/admin";
if (path.startsWith("/portal")) return "/portal"; // TODO: This is all temporary, we need to fix this properly
return "/";
}
if (document.location.search && document.location.search.indexOf("clearAuthenticationMetaDataLocalStorage") > -1)
{
qController.clearAuthenticationMetaDataLocalStorage();
@ -89,19 +103,19 @@ authenticationMetaDataPromise.then((authenticationMetaData) =>
if (authenticationMetaData.type === "AUTH_0")
{
root.render(<BrowserRouter>
root.render(<BrowserRouter basename={getBasePath()}>
<Auth0RouterBody />
</BrowserRouter>);
}
else if (authenticationMetaData.type === "OAUTH2")
{
root.render(<BrowserRouter>
root.render(<BrowserRouter basename={getBasePath()}>
<OAuth2RouterBody />
</BrowserRouter>);
}
else if (authenticationMetaData.type === "FULLY_ANONYMOUS" || authenticationMetaData.type === "MOCK")
{
root.render(<BrowserRouter>
root.render(<BrowserRouter basename={getBasePath()}>
<AnonymousRouterBody />
</BrowserRouter>);
}