Skip to content

Commit

Permalink
Merge pull request #19 from Inist-CNRS/feat/istex-front
Browse files Browse the repository at this point in the history
ISTEX Theme and Front refactoring
  • Loading branch information
AlasDiablo authored Mar 8, 2024
2 parents 0fb0780 + 4b0fa01 commit ff3e553
Show file tree
Hide file tree
Showing 77 changed files with 4,251 additions and 5,518 deletions.
22 changes: 15 additions & 7 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
tdm-be/node_modules/*
tdm-be/node_modules/
tdm-be/dist/*
tdm-fe/node_modules/*
tdm-fe/.next/*
Dockerfile
.git
.gitignore
.dockerignore
tdm-fe/dist/*
tdm-fe/node_modules/
tdm-fe/.stylelintcache
.gitlab-ci.yml
helm/*
tdm-be/environment-recette.ts
.idea
tdm-be/uploads/*
tdm-be/dynamic-config.json
tdm-be/factory.db
tdm-be/logs/*
tdm-be/crash/*
tdm-be/public/*
tdm-be/tmp/*
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ tab_width = 2
indent_size = 2
tab_width = 2

[*.scss]
indent_size = 2
tab_width = 2
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
tdm-be/node_modules/
tdm-be/dist/
tdm-be/dist/*
tdm-fe/dist/*
tdm-fe/node_modules/
tdm-fe/.next/
tdm-fe/.stylelintcache
.gitlab-ci.yml
helm/*
tdm-be/environment-recette.ts
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN npm ci
COPY tdm-fe /app/

# Build the React app
RUN npm run build
RUN VITE_TDM_FACTORY_HOST="" npm run build

#######################################################

Expand Down Expand Up @@ -63,7 +63,7 @@ COPY --chown=daemon:daemon --from=express-build /app/config/production.json /app
COPY --chown=daemon:daemon --from=express-build /app/src /app/src

# Copy front-end files from the build container
COPY --chown=daemon:daemon --from=react-build /app/.next /app/public/_next/
COPY --chown=daemon:daemon --from=react-build /app/dist /app/public/

# Create the required folder
RUN mkdir /app/public/downloads
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ install:
run-dev:
docker compose -f docker-compose.dev.yml up --force-recreate

run-docker:
docker build --tag 'tdm-factory:latest' .
docker run -p 3000:3000 'tdm-factory:latest'

update-front-api:
cd tdm-be && \
npm run swagger-autogen && \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
environment:
NODE_ENV: development
ports:
- "8080:8080"
- "5173:5173"
volumes:
- ./tdm-fe:/app
working_dir: /app
Expand Down
3 changes: 0 additions & 3 deletions tdm-be/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ app.use('/swagger-config', auth, swaggerUi.serve, swaggerUi.setup(swaggerFile));

const dirname = process.cwd();

app.get('/', function (req, res) {
res.sendFile(path.join(dirname, 'public', '_next', 'server', 'app', 'index.html'));
});
app.use(express.static(path.join(dirname, 'public')));

app.get('/*', function (req, res) {
Expand Down
2 changes: 1 addition & 1 deletion tdm-be/src/controller/traitment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ router.post(
// Create the status url return to the client
const statusPanelUrl = `${
environment.hosts.external.isHttps ? 'https' : 'http'
}://${environment.hosts.external.host}?id=${updatedProcessing.id}`;
}://${environment.hosts.external.host}/status/${updatedProcessing.id}`;

// Start the processing by starting the wrapper
wrapper(updatedProcessing.id);
Expand Down
8 changes: 4 additions & 4 deletions tdm-be/src/model/ProcessingModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export type Processing = {
* @param uploadFile Source file of processing
*/
export const createProcessing = (id: string, originalName: string, uploadFile: string): Processing | undefined => {
const stmt = database.prepare<[string, number, string]>(`
insert into processing (id, status, uploadFile)
values (?, ?, ?);
const stmt = database.prepare<[string, number, string, string]>(`
insert into processing (id, status, uploadFile, originalName)
values (?, ?, ?, ?);
`);

const result = stmt.run(id, Status.UNKNOWN, uploadFile);
const result = stmt.run(id, Status.UNKNOWN, uploadFile, originalName);

if (result.changes !== 0) {
return {
Expand Down
17 changes: 14 additions & 3 deletions tdm-fe/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
"project": "tsconfig.eslint.json",
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"root": true,
"env": {
"node": false,
"node": true,
"jest": true,
"browser": true
},
"plugins": [
"@tanstack/query"
],
"extends": [
"@draconides/eslint-config-ts",
"@draconides/eslint-config-react",
"next/core-web-vitals"
"plugin:@tanstack/eslint-plugin-query/recommended"
]
}
19 changes: 19 additions & 0 deletions tdm-fe/.stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-twbs-bootstrap"
],
"rules": {
"declaration-no-important": null,
"scss/dollar-variable-default": [
true,
{
"ignore": "local"
}
],
"selector-max-class": null,
"selector-max-type": null,
"selector-no-qualifying-type": null,
"selector-max-id": 3
}
}
17 changes: 17 additions & 0 deletions tdm-fe/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>IA Factory</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
11 changes: 0 additions & 11 deletions tdm-fe/next.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions tdm-fe/openapitools.json

This file was deleted.

Loading

0 comments on commit ff3e553

Please sign in to comment.