-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Production update 21.9.2023
- Loading branch information
Showing
49 changed files
with
1,525 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ REACT_APP_SENTRY_DSN="https://[email protected] | |
REACT_APP_DISABLE_SENTRY=0 | ||
REACT_APP_FEATURE_PUBLIC_HANKKEET=1 | ||
REACT_APP_FEATURE_HANKE=1 | ||
REACT_APP_FEATURE_ACCESS_RIGHTS=0 | ||
REACT_APP_FEATURE_ACCESS_RIGHTS=1 | ||
REACT_APP_WARNING_NOTIFICATION_LABEL="" | ||
REACT_APP_WARNING_NOTIFICATION_LABEL_SV="" | ||
REACT_APP_WARNING_NOTIFICATION_LABEL_EN="" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
FROM registry.redhat.io/rhel8/nginx-116 | ||
FROM node:16-alpine as staticbuilder | ||
COPY . /builder/ | ||
WORKDIR /builder | ||
RUN yarn && yarn cache clean --force | ||
RUN REACT_APP_DISABLE_SENTRY=0 yarn build | ||
|
||
FROM nginx:stable | ||
EXPOSE 8000 | ||
COPY ./build /usr/share/nginx/html | ||
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf | ||
COPY --from=staticbuilder ./builder/build /usr/share/nginx/html | ||
COPY --from=staticbuilder ./builder/nginx/nginx.conf /etc/nginx/nginx.conf | ||
WORKDIR /usr/share/nginx/html | ||
COPY .env . | ||
|
||
USER root | ||
|
||
RUN chgrp -R 0 /usr/share/nginx/html && \ | ||
chmod -R g=u /usr/share/nginx/html | ||
# Create the environment file so that the user that will run the backend has | ||
# permission to overwrite the config based on environment variables. | ||
RUN touch env-config.js | ||
RUN chmod a+rw env-config.js | ||
|
||
# Copy default environment config and setup script | ||
# Copy package.json so env.sh can read it | ||
COPY ./scripts/env.sh /opt/env.sh | ||
COPY .env /opt/.env | ||
COPY package.json /opt/package.json | ||
COPY --from=staticbuilder ./builder/scripts/env.sh /opt/env.sh | ||
COPY --from=staticbuilder ./builder/.env /opt/.env | ||
COPY --from=staticbuilder ./builder/package.json /opt/package.json | ||
RUN chmod +x /opt/env.sh | ||
|
||
ENV REACT_APP_DISABLE_SENTRY=0 | ||
|
||
CMD ["/bin/bash", "-c", "/opt/env.sh /opt /usr/share/nginx/html && nginx -g \"daemon off;\""] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React from 'react'; | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
import { I18nextProvider } from 'react-i18next'; | ||
import { QueryClient, QueryClientProvider } from 'react-query'; | ||
import { InitialEntry } from '@remix-run/router'; | ||
import { User } from 'oidc-client'; | ||
import { Provider } from 'react-redux'; | ||
import AppRoutes from './AppRoutes'; | ||
import { FeatureFlagsProvider } from '../components/featureFlags/FeatureFlagsContext'; | ||
import { GlobalNotificationProvider } from '../components/globalNotification/GlobalNotificationContext'; | ||
import authService from '../../domain/auth/authService'; | ||
import { store } from '../redux/store'; | ||
import i18n from '../../locales/i18n'; | ||
import { REDIRECT_PATH_KEY } from './constants'; | ||
|
||
afterEach(() => { | ||
sessionStorage.clear(); | ||
}); | ||
|
||
const path = '/fi/johtoselvityshakemus'; | ||
|
||
const mockUser: Partial<User> = { | ||
id_token: 'fffff-aaaaaa-11111', | ||
access_token: '.BnutWVN1x7RSAP5bU2a-tXdVPuof_9pBNd_Ozw', | ||
profile: { | ||
iss: '', | ||
sub: '', | ||
aud: '', | ||
exp: 0, | ||
iat: 0, | ||
}, | ||
}; | ||
|
||
function getWrapper(routerInitialEntries?: InitialEntry[]) { | ||
const queryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
retryDelay: 0, | ||
}, | ||
}, | ||
}); | ||
|
||
return render( | ||
<MemoryRouter initialEntries={routerInitialEntries}> | ||
<Provider store={store}> | ||
<QueryClientProvider client={queryClient}> | ||
<I18nextProvider i18n={i18n}> | ||
<FeatureFlagsProvider> | ||
<GlobalNotificationProvider> | ||
<AppRoutes /> | ||
</GlobalNotificationProvider> | ||
</FeatureFlagsProvider> | ||
</I18nextProvider> | ||
</QueryClientProvider> | ||
</Provider> | ||
</MemoryRouter>, | ||
); | ||
} | ||
|
||
test('Should save path to session storage and navigate to login if trying to navigate to private route', async () => { | ||
const login = jest.spyOn(authService, 'login').mockResolvedValue(); | ||
|
||
getWrapper([path]); | ||
|
||
await waitFor(() => expect(login).toHaveBeenCalled()); | ||
expect(window.sessionStorage.getItem(REDIRECT_PATH_KEY)).toBe(path); | ||
}); | ||
|
||
test('Should redirect to path stored in session storage after login if one exists', async () => { | ||
sessionStorage.setItem(REDIRECT_PATH_KEY, path); | ||
jest.spyOn(authService.userManager, 'getUser').mockResolvedValue(mockUser as User); | ||
|
||
getWrapper(); | ||
|
||
await waitFor(() => | ||
expect(window.document.title).toBe('Haitaton - Luo uusi johtoselvityshakemus'), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const REDIRECT_PATH_KEY = 'redirect-path'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/domain/hanke/accessRights/AccessRightsView.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
@import 'src/assets/styles/layout.scss'; | ||
|
||
.container { | ||
background-color: var(--color-white); | ||
height: 100%; | ||
} | ||
|
||
.header { | ||
background-color: var(--color-summer-light); | ||
padding-top: var(--spacing-2-xl); | ||
padding-bottom: var(--spacing-xl); | ||
} | ||
|
||
.mainContent { | ||
padding-top: var(--spacing-m); | ||
padding-bottom: var(--spacing-m); | ||
} | ||
|
||
.hankeLink { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--spacing-2-xs); | ||
margin-bottom: var(--spacing-m); | ||
|
||
&:hover { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
.infoAccordion { | ||
margin-bottom: var(--spacing-xl); | ||
|
||
.infoList { | ||
padding-left: var(--spacing-m); | ||
|
||
& > li { | ||
margin-bottom: var(--spacing-2-xs); | ||
|
||
&:last-child { | ||
margin-bottom: var(--spacing-l); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.searchInput { | ||
max-width: 328px; | ||
margin-bottom: var(--spacing-m); | ||
} | ||
|
||
.table > div { | ||
overflow-x: initial; | ||
|
||
@include respond-below(m) { | ||
display: none; | ||
} | ||
} | ||
|
||
.userCards { | ||
@include respond-above(m) { | ||
display: none; | ||
} | ||
} | ||
|
||
.pagination { | ||
margin-top: var(--spacing-xs); | ||
margin-bottom: var(--spacing-s); | ||
|
||
* { | ||
box-sizing: content-box; | ||
} | ||
} |
Oops, something went wrong.