Skip to content

Commit

Permalink
Merge pull request #189 from InseeFr/acceptance
Browse files Browse the repository at this point in the history
3.0.5
  • Loading branch information
alicela authored Jun 16, 2021
2 parents f5e8a32 + 99c3444 commit 1e53451
Show file tree
Hide file tree
Showing 50 changed files with 964 additions and 151 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Bauhaus CI
on: [push]
jobs:
test-build:
name: Test & build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 15
- run: yarn
# Build modules
- run: yarn build-insee
# Build sonar reports
- run: yarn test:coverage
- name: Upload deploy artifact
uses: actions/upload-artifact@v2
with:
name: coverage
path: |
app/coverage/
packages/**/coverage/
sonarcloud:
runs-on: ubuntu-latest
needs: test-build
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download coverage artifact
uses: actions/download-artifact@v2
with:
name: coverage
path: coverage
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
deploy:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: sonarcloud
steps:
- name: Download deploy artifact
uses: actions/download-artifact@v2
with:
name: deploy
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
25 changes: 25 additions & 0 deletions .kubernetes/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: bauhaus
spec:
replicas: 1
selector:
matchLabels:
app: bauhaus
template:
metadata:
labels:
app: bauhaus
spec:
containers:
- name: bauhaus
image: nicolaslaval/bauhaus:3.0.0
env:
- name: API_BASE_HOST
value: 'https://bauhaus-api.toto.fr/api'
- name: API_MODE
# server or local
value: 'server'
- name: APPLICATIONS
value: 'concepts,classifications,operations,structures'
18 changes: 18 additions & 0 deletions .kubernetes/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: bauhaus
annotations:
kubernetes.io/ingress.class: nginx
spec:
tls:
- hosts:
- bauhaus.todo.fr
rules:
- host: bauhaus.todo.fr
http:
paths:
- path: /
backend:
serviceName: bauhaus
servicePort: http
11 changes: 11 additions & 0 deletions .kubernetes/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: bauhaus
spec:
ports:
- name: http
targetPort: 80
port: 80
selector:
app: bauhaus
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

21 changes: 8 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
FROM node:12 as node
WORKDIR /bauhaus
COPY ./ /bauhaus/
RUN yarn
RUN yarn build-insee

FROM nginx:1.17
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=node /bauhaus/app/build /usr/share/nginx/html
ADD ./config/start.sh /usr/share/nginx
RUN chmod +x /usr/share/nginx/start.sh
ENTRYPOINT [ "/usr/share/nginx/start.sh"]
CMD nginx -g 'daemon off;'
FROM nginx
RUN rm etc/nginx/conf.d/default.conf
COPY config/nginx.conf etc/nginx/conf.d/
COPY /app/build /usr/share/nginx/html
COPY app/entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD ["nginx", "-g", "daemon off;"]
4 changes: 3 additions & 1 deletion app/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
SKIP_PREFLIGHT_CHECK=true
REACT_APP_API_MODE = 'server'
REACT_APP_API_MODE=server
REACT_APP_API_BASE_HOST=
REACT_APP_APPLICATIONS=concepts,classifications,operations,structures
2 changes: 1 addition & 1 deletion app/.env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
REACT_APP_API_BASE_HOST = 'http://localhost:8080/Bauhaus_BO_war/api'
REACT_APP_APPLICATIONS = "concepts,classifications,operations"

REACT_APP_APPLICATIONS = "concepts,classifications"
6 changes: 6 additions & 0 deletions app/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
echo "window._env_['SKIP_PREFLIGHT_CHECK'] = '$SKIP_PREFLIGHT_CHECK';" >> /usr/share/nginx/html/env-config.js
echo "window._env_['API_MODE'] = '$API_MODE';" >> /usr/share/nginx/html/env-config.js
echo "window._env_['API_BASE_HOST'] = '$API_BASE_HOST';" >> /usr/share/nginx/html/env-config.js
echo "window._env_['APPLICATIONS'] = '$APPLICATIONS';" >> /usr/share/nginx/html/env-config.js
exec "$@"
6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bauhaus",
"version": "3.0.0",
"version": "3.0.5",
"description": "Web application for the management of concepts, classifications and other statistical objects",
"repository": {
"type": "git",
Expand Down Expand Up @@ -31,7 +31,7 @@
"bauhaus-operations": "^0.0.0",
"bootstrap": "3.4.1",
"create-react-class": "^15.6.3",
"dompurify": "2.0.8",
"dompurify": "2.2.9",
"file-saver": "1.3.3",
"jwt-decode": "2.2.0",
"keycloak": "1.2.0",
Expand All @@ -40,7 +40,7 @@
"react-16-bootstrap-date-picker": "5.1.2",
"react-bootstrap": "0.31.5",
"react-d3-tree": "1.10.3",
"react-draft-wysiwyg": "1.13.2",
"react-draft-wysiwyg": "1.14.6",
"react-dropzone": "11.0.1",
"react-modal": "3.11.2",
"react-router-hash-link": "1.2.0",
Expand Down
1 change: 1 addition & 0 deletions app/public/env-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
if (!window._env_) window._env_ = {};
2 changes: 2 additions & 0 deletions app/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />

<script src="%PUBLIC_URL%/env-config.js"></script>

<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
32 changes: 18 additions & 14 deletions app/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,31 @@ import React from 'react';
import { Link } from 'react-router-dom';
import D from 'js/i18n';
import adminLogo from 'img/admin.svg';
import { getEnvVar } from 'js/utils/env';

import { Auth } from 'bauhaus-utilities';
import 'bootstrap/dist/css/bootstrap.css';
import './app.scss';

function App() {
document.title = 'Bauhaus';

const apps = process.env.REACT_APP_APPLICATIONS.split(',').map((appName) => {
const app = appName.trim();
const defaultRoute = require(`./applications/${app}/config`).defaultRoute;
return (
<div key={appName} className={appName}>
<Link to={'/' + app + defaultRoute}>
<h2 className="items page-title page-title-link">
{D[app + 'Title']}
</h2>
<img src={require(`img/${app}_blanc.svg`)} alt={app} />
</Link>
</div>
);
});
const apps = getEnvVar('APPLICATIONS')
.split(',')
.map(appName => {
const app = appName.trim();
const defaultRoute = require(`./applications/${app}/config`).defaultRoute;
return (
<div key={appName} className={appName}>
<Link to={'/' + app + defaultRoute}>
<h2 className="items page-title page-title-link">
{D[app + 'Title']}
</h2>
<img src={require(`img/${app}_blanc.svg`)} alt={app} />
</Link>
</div>
);
});

return (
<div className="home-page-links home-page-links__grid-3">
Expand Down
23 changes: 17 additions & 6 deletions app/src/js/applications/codelists/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import React from 'react';
import React from 'react';
import { Switch, Route } from 'react-router-dom';

import { Home } from 'bauhaus-codelists';

import D from 'js/i18n';
import {
Menu,
Home,
CodelistComponentView,
D,
SearchFormList,
} from 'bauhaus-codelists';

const CodesListComponent = () => {
console.log("yo")
document.title = 'Bauhaus - ' + D.structuresTitle;
document.title = 'Bauhaus - ' + D.codelistsTitle;
document.getElementById('root-app').classList = ['structures'];
return (
<>
<Menu />
<div className="container">
<Switch>
<Route exact path="/codelists" component={Home} />
<Route
exact
path="/codelists/components/:id"
component={CodelistComponentView}
/>
<Route exact path="/codelists/search" component={SearchFormList} />
</Switch>
</div>
</>
Expand Down
3 changes: 2 additions & 1 deletion app/src/js/applications/structures/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@inseefr/wilco';
import { StructureAPI } from 'bauhaus-structures';
import D from 'js/i18n';
import { getEnvVar } from 'js/utils/env';

const Home = () => {
const [DSDs, setDSDs] = useState([]);
Expand All @@ -19,7 +20,7 @@ const Home = () => {
});
}, []);

const isLocal = process.env.REACT_APP_API_MODE === 'local';
const isLocal = getEnvVar('API_MODE') === 'local';
return (
<div className="container">
<div className="row">
Expand Down
7 changes: 7 additions & 0 deletions app/src/js/reducers/concepts/by-id/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import * as generalUtils from 'js/utils/concepts/general';
export default function(state = {}, action) {
const { type, payload } = action;
switch (type) {
case A.DELETE_CONCEPT_SUCCESS: {
const { id } = payload;
return {
...state,
[id]: {},
};
}
case A.UPDATE_CONCEPT_SUCCESS: {
const { id } = payload;
return {
Expand Down
7 changes: 7 additions & 0 deletions app/src/js/reducers/concepts/by-id/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { LOADED } from 'js/constants';
export default function(state = {}, action) {
const { type, payload } = action;
switch (type) {
case A.DELETE_CONCEPT_SUCCESS: {
const { id } = payload;
return {
...state,
[id]: {},
};
}
case A.LOAD_CONCEPT_LINKS_SUCCESS: {
const { id, results } = payload;
return {
Expand Down
7 changes: 7 additions & 0 deletions app/src/js/reducers/concepts/by-id/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import { ArrayUtils } from 'bauhaus-utilities';
export default function(state = {}, action) {
const { type, payload } = action;
switch (type) {
case A.DELETE_CONCEPT_SUCCESS: {
const { id } = payload;
return {
...state,
[id]: {},
};
}
case A.LOAD_NOTES_VERSION:
const { id, version } = payload;
const otherVersions = state[id];
Expand Down
5 changes: 5 additions & 0 deletions app/src/js/reducers/operations/current.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export const operationsSeriesCurrent = function(state = {}, action) {
case A.SAVE_OPERATIONS_INDICATOR_SUCCESS:
//When we save an item, we reset the current item stored in the store in order to send a new GET HTTP request
return {};
case A.DELETE_SIMS_SUCCESS:
return {
...state,
idSims: null
}
default:
return state;
}
Expand Down
9 changes: 5 additions & 4 deletions app/src/js/router/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Routes from './routes';
import bauhausLogo from 'img/logo_noir.svg';
import { getEnvVar } from 'js/utils/env';

import 'react-app-polyfill/stable';

const Root = () => {
const footer = `${process.env.REACT_APP_NAME} - ${process.env.REACT_APP_VERSION}`;
const Root = () => {
const footer = `${getEnvVar('NAME')} - ${getEnvVar('VERSION')}`;
return (
<>
<div id="root-app">
Expand All @@ -23,6 +24,6 @@ const Root = () => {
</footer>
</>
);
}
};

export default Root;
Loading

0 comments on commit 1e53451

Please sign in to comment.