Skip to content

Commit d42851a

Browse files
committed
Migrating to react scripts to vite and updating eslint version
1 parent 03296e2 commit d42851a

File tree

16 files changed

+4852
-16820
lines changed

16 files changed

+4852
-16820
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
.idea
33
**/build
4+
**/dist
45
pipeline-ui/integration-tests/cypress/videos

pipeline-ui/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:22-alpine3.20 as compile-image
1+
FROM node:22-alpine3.20 AS compile-image
22

33
# npm install frontend
44
COPY ./frontend/package.json /home/node/app/frontend/package.json
@@ -22,10 +22,10 @@ WORKDIR /home/node/app/backend
2222
RUN npm run build
2323

2424
# Build app container
25-
FROM node:22-alpine3.20 as runtime-image
25+
FROM node:22-alpine3.20 AS runtime-image
2626
WORKDIR /usr/src/app
2727
COPY --from=compile-image /home/node/app/backend/build/ /usr/src/app
28-
COPY --from=compile-image /home/node/app/frontend/build /usr/src/app/public
28+
COPY --from=compile-image /home/node/app/frontend/dist /usr/src/app/public
2929
COPY --from=compile-image /home/node/app/backend/node_modules/ /usr/src/app/node_modules/
3030

3131
CMD ["node", "./index.js"]

pipeline-ui/backend/src/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import express from 'express';
22
import bodyParser from 'body-parser';
3+
import path from 'path';
34
// @ts-ignore - Problem with the cors typing.
45
import cors from 'cors';
56
import pinoHttp from 'pino-http';
@@ -25,7 +26,7 @@ app.use(httpLogger);
2526

2627
// Render the default page when browsing the root
2728
app.get('/', function(req, res) {
28-
res.sendFile('index.html', {root: __dirname + '/public/index.html'} );
29+
res.sendFile('index.html', {root: path.join(__dirname, 'public')} );
2930
});
3031

3132
app.ws('/api/v1/getLogstashOutput', (ws, req) => {});
@@ -34,6 +35,11 @@ app.use('/api/v1/sendLogLines', apiV1SendLogLines);
3435
app.use('/api/v1/receiveLogstashOutput', apiV1ReceiveLogstashOutput);
3536
app.use('/api/v1/logstashStatus', apiV1LogstashStatus);
3637

38+
// Catch-all handler: send back React's index.html file for client-side routing
39+
app.get('*', (req, res) => {
40+
res.sendFile('index.html', {root: path.join(__dirname, 'public')});
41+
});
42+
3743
app.listen(port,
3844
() => logger.info(`Logstash config tester running on port ${port}!`));
3945

pipeline-ui/frontend/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

pipeline-ui/frontend/.eslintrc.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import react from 'eslint-plugin-react';
4+
import tseslint from 'typescript-eslint';
5+
6+
export default tseslint.config(
7+
{
8+
ignores: ['src/serviceWorker.ts', 'dist/**', 'node_modules/**'],
9+
},
10+
js.configs.recommended,
11+
...tseslint.configs.recommended,
12+
{
13+
files: ['**/*.{js,jsx,ts,tsx}'],
14+
languageOptions: {
15+
ecmaVersion: 2021,
16+
sourceType: 'module',
17+
parserOptions: {
18+
ecmaFeatures: {
19+
jsx: true,
20+
},
21+
},
22+
globals: {
23+
...globals.browser,
24+
...globals.es2021,
25+
},
26+
},
27+
plugins: {
28+
react,
29+
},
30+
settings: {
31+
react: {
32+
version: 'detect',
33+
},
34+
},
35+
rules: {
36+
...react.configs.recommended.rules,
37+
...react.configs['jsx-runtime'].rules,
38+
'require-jsdoc': 'off',
39+
'new-cap': 'off',
40+
'indent': ['error', 2],
41+
'padded-blocks': 'off',
42+
'react/react-in-jsx-scope': 'off', // Not needed with React 17+
43+
'react/prop-types': 'off', // Using TypeScript for types
44+
'react/display-name': 'off', // Not needed for icon components
45+
'no-unused-vars': 'off', // Turn off base rule
46+
'@typescript-eslint/no-unused-vars': ['error', {
47+
argsIgnorePattern: '^_',
48+
varsIgnorePattern: '^_',
49+
caughtErrorsIgnorePattern: '^_'
50+
}],
51+
},
52+
},
53+
);
54+

pipeline-ui/frontend/index.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
6+
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
7+
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
8+
<link rel="manifest" href="/site.webmanifest">
9+
<meta name="msapplication-TileColor" content="#da532c">
10+
11+
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
12+
<meta name="msapplication-TileColor" content="#da532c">
13+
<meta name="theme-color" content="#ffffff">
14+
15+
<meta name="viewport" content="width=device-width, initial-scale=1" />
16+
<meta name="theme-color" content="#000000" />
17+
<meta
18+
name="description"
19+
content="Logstash Pipeline Tester"
20+
/>
21+
<link rel="manifest" href="/manifest.json" />
22+
<title>Logstash Pipeline Tester</title>
23+
</head>
24+
<body>
25+
<noscript>You need to enable JavaScript to run this app.</noscript>
26+
<div id="root"></div>
27+
<script type="module" src="/src/index.tsx"></script>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)