Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN addgroup -S -g $EGO_UI_GID $EGO_UI_USER \
# defaults
ENV REACT_APP_EGO_CLIENT_ID=ego
ENV REACT_APP_API=http://localhost:8081/
ENV PUBLIC_URL="/"
ENV REACT_APP_PUBLIC_URL="/"

USER $EGO_UI_UID

Expand Down
45 changes: 24 additions & 21 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
<link rel="manifest" href="%REACT_APP_PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%REACT_APP_PUBLIC_URL%/favicon.ico" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -20,16 +19,21 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
<title>Admin Portal</title>
</head>
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ"
crossorigin="anonymous"
/>
<title>Admin Portal</title>
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

Expand All @@ -39,6 +43,5 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</body>
</html>
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ResourceRoute from 'components/ResourceRoute';
import RESOURCE_MAP from 'common/RESOURCE_MAP';
import Nav from 'components/Nav';
import NoAccess from 'components/NoAccess';
import { PUBLIC_URL } from 'common/injectGlobals';

const enhance = compose(provideLoggedInUser);

Expand All @@ -22,7 +23,7 @@ const ProtectedRoute = injectState(({ component, state, ...rest }) => (
class App extends React.Component<any, any> {
render() {
return (
<Router>
<Router basename={PUBLIC_URL}>
<div style={{ height: '100%', display: 'flex' }}>
<Switch>
<Route path="/" exact component={Login} />
Expand Down
2 changes: 2 additions & 0 deletions src/common/injectGlobals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const API_ROOT = process.env.REACT_APP_API;
export const EGO_CLIENT_ID = process.env.REACT_APP_EGO_CLIENT_ID;
export const USE_DUMMY_DATA = process.env.REACT_APP_DUMMY;

export const PUBLIC_URL = process.env.REACT_APP_PUBLIC_URL;

export const STATUSES = ['DISABLED', 'APPROVED', 'PENDING', 'REJECTED'];
export const DATE_KEYS = ['createdAt', 'lastLogin'];
export const DATE_FORMAT = 'YYYY-MM-DD hh:mm A';
Expand Down
4 changes: 2 additions & 2 deletions src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const isLocalhost = Boolean(
export default function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL!, window.location.toString());
const publicUrl = new URL(process.env.REACT_APP_PUBLIC_URL!, window.location.toString());
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
Expand All @@ -29,7 +29,7 @@ export default function register() {
}

window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
const swUrl = `${process.env.REACT_APP_PUBLIC_URL}/service-worker.js`;

if (!isLocalhost) {
// Is not local host. Just register service worker
Expand Down