Skip to content

Commit 7d03649

Browse files
solutions-navbar: Rename to shell-ui
1 parent 86b26a6 commit 7d03649

22 files changed

+45
-20
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

solutions-ui-navbar/Dockerfile renamed to shell-ui/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ FROM nginx:${NGINX_IMAGE_VERSION}
1919

2020
WORKDIR /usr/share/nginx/html/
2121
RUN rm -rf ./*
22-
COPY --from=build-step /home/node/dist ./
22+
RUN mkdir shell
23+
COPY health ./shell
24+
COPY conf/config.json /config.json
25+
COPY entrypoint.sh /entrypoint.sh
26+
RUN chmod +x /entrypoint.sh
27+
COPY --from=build-step /home/node/dist ./shell
2328
COPY conf/nginx.conf /etc/nginx/conf.d/default.conf
24-
29+
ENTRYPOINT [ "/entrypoint.sh" ]
2530
CMD ["nginx", "-g", "daemon off;"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

solutions-ui-navbar/src/index.js renamed to shell-ui/src/index.js

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,36 @@ import { logOut } from './auth/logout';
1414
const EVENTS_PREFIX = 'solutions-navbar--';
1515
export const AUTHENTICATED_EVENT: string = EVENTS_PREFIX + 'authenticated';
1616

17+
type Options = { [path: string]: { en: string, fr: string, roles?: string[] } }; // TODO should be able to accept configs for paths in dropdown menu under user name
18+
1719
export type SolutionsNavbarProps = {
18-
'oidc-provider-url': string,
19-
scopes: string,
20-
'client-id': string,
20+
'oidc-provider-url'?: string,
21+
scopes?: string,
22+
'client-id'?: string,
2123
'response-type'?: string,
2224
'redirect-url'?: string,
23-
options?: { [path: string]: { en: string, fr: string, roles?: string[] } },
25+
options?: Options,
2426
onAuthenticated?: (evt: CustomEvent) => void,
2527
logOut?: () => void,
26-
setUserManager?: (userManager: UserManager) =>void;
28+
setUserManager?: (userManager: UserManager) => void,
29+
};
30+
31+
type Config = {
32+
docUrl?: string,
33+
oidc?: {
34+
providerUrl?: string,
35+
redirectUrl?: string,
36+
clientId?: string,
37+
responseType?: string,
38+
scopes?: string,
39+
},
40+
options?: Options,
2741
};
2842

43+
// %CONFIG% is replaced at image boot by a provided configuration
44+
const jsonConfig = '%CONFIG%' || '{}';
45+
const config: Config = JSON.parse(jsonConfig);
46+
2947
const SolutionsNavbar = ({
3048
'oidc-provider-url': oidcProviderUrl,
3149
scopes,
@@ -35,17 +53,19 @@ const SolutionsNavbar = ({
3553
options,
3654
onAuthenticated,
3755
logOut,
38-
setUserManager
56+
setUserManager,
3957
}: SolutionsNavbarProps) => {
40-
4158
const userManager = new UserManager({
42-
authority: oidcProviderUrl,
43-
client_id: clientId,
44-
redirect_uri: redirectUrl || window.location.href,
45-
silent_redirect_uri: redirectUrl || window.location.href,
46-
post_logout_redirect_uri: redirectUrl || window.location.href,
47-
response_type: responseType || 'code',
48-
scope: scopes,
59+
authority: oidcProviderUrl || config.oidc?.providerUrl,
60+
client_id: clientId || config.oidc?.clientId,
61+
redirect_uri:
62+
redirectUrl || config.oidc?.redirectUrl || window.location.href,
63+
silent_redirect_uri:
64+
redirectUrl || config.oidc?.redirectUrl || window.location.href,
65+
post_logout_redirect_uri:
66+
redirectUrl || config.oidc?.redirectUrl || window.location.href,
67+
response_type: responseType || config.oidc?.responseType || 'code',
68+
scope: scopes || config.oidc?.scopes,
4969
loadUserInfo: true,
5070
automaticSilentRenew: true,
5171
monitorSession: false,
@@ -57,7 +77,7 @@ const SolutionsNavbar = ({
5777
setUserManager(userManager);
5878
}
5979
}, [!setUserManager]);
60-
80+
6181
const oidcConfig: AuthProviderProps = {
6282
onBeforeSignIn: () => {
6383
localStorage.setItem('redirectUrl', window.location.href);
@@ -146,13 +166,13 @@ class SolutionsNavbarWebComponent extends reactToWebComponent(
146166
super();
147167
this.setUserManager = (userManager: UserManager) => {
148168
this.userManager = userManager;
149-
}
169+
};
150170
this.onAuthenticated = (evt: CustomEvent) => {
151171
this.dispatchEvent(evt);
152172
};
153173
this.logOut = () => {
154174
logOut(this.userManager);
155-
}
175+
};
156176
}
157177
}
158178

File renamed without changes.

ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"scripts": {
4242
"analyze": "source-map-explorer 'build/static/js/*.js'",
43-
"start:navbar": "docker stop solutions-navbar-dev-server; (docker run --rm -d --name solutions-navbar-dev-server -p 8084:80 $(docker build -q ../solutions-ui-navbar))",
43+
"start:navbar": "docker stop shell-ui-dev-server; (docker run --rm -d --name shell-ui-dev-server -p 8084:80 $(docker build -q ../shell-ui))",
4444
"start:ui": "react-app-rewired start",
4545
"start": "npm run start:navbar && npm run start:ui",
4646
"build": "react-app-rewired --max_old_space_size=2048 build",

0 commit comments

Comments
 (0)