Skip to content

Commit eb5c3f8

Browse files
authored
refactor(ui): migrate to Vuetify 4 and Vue Router 5 (#80)
1 parent 219a77b commit eb5c3f8

32 files changed

Lines changed: 3822 additions & 3277 deletions

.github/workflows/reuse-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout git repository
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@v5
1212

1313
- name: Set up Docker Buildx
1414
uses: docker/setup-buildx-action@v3

.github/workflows/reuse-quality.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout git repository
11-
uses: actions/checkout@v4
12-
13-
- uses: actions/setup-node@v3
11+
uses: actions/checkout@v5
12+
13+
- uses: actions/setup-node@v5
1414
with:
1515
node-version: 24
1616
cache: 'npm'
17-
17+
1818
- name: Install dependencies
19-
run: |
20-
npm ci --no-audit --no-fund --omit=optional
21-
npm i --no-save @rollup/rollup-linux-x64-gnu
19+
run: npm ci
2220

2321
- name: Run quality checks
2422
run: npm run quality

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
data/
22
node_modules/
3-
worker/config/local-*
4-
api/config/local-*
3+
**/config/local-*
54
.config/
65
.type/

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ FROM node:24.11.1-alpine3.22 AS base
55

66
WORKDIR /app
77
ENV NODE_ENV=production
8+
ENV DEBUG=upgrade*
89

910
# =============================
1011
# Package preparation (stripping version for caching)

api/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,24 @@
2121
"@types/ws": "^8.5.12"
2222
},
2323
"dependencies": {
24-
"@data-fair/lib-express": "^1.20.4",
25-
"@data-fair/lib-node": "^2.8.1",
26-
"@data-fair/lib-utils": "^1.6.1",
24+
"@data-fair/lib-express": "^1.22.5",
25+
"@data-fair/lib-node": "^2.12.1",
26+
"@data-fair/lib-utils": "^1.10.1",
2727
"@data-fair/processings-shared": "*",
2828
"ajv": "^8.17.1",
2929
"ajv-formats": "^3.0.1",
30-
"config": "^4.0.0",
30+
"config": "^4.4.1",
3131
"crypto-random-string": "^5.0.0",
32-
"express": "^5.0.1",
33-
"fs-extra": "^11.2.0",
32+
"express": "^5.2.0",
33+
"fs-extra": "^11.3.0",
3434
"http-terminator": "^3.2.0",
3535
"memoizee": "^0.4.17",
36-
"mongodb": "^6.10.0",
37-
"multer": "^2.0.1",
36+
"mongodb": "^6.17.0",
37+
"multer": "^2.0.2",
3838
"nanoid": "^5.0.8",
3939
"resolve-path": "^1.4.0",
4040
"semver": "^7.7.4",
4141
"tmp-promise": "^3.0.3",
42-
"ws": "^8.18.0"
42+
"ws": "^8.18.2"
4343
}
4444
}

api/src/config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { assertValid, type ApiConfig } from '../config/type/index.ts'
1+
import type { ApiConfig } from '../config/type/index.ts'
2+
import { assertValid } from '../config/type/index.ts'
23
import config from 'config'
34

45
// we reload the config instead of using the singleton from the config module for testing purposes
56
// @ts-ignore
67
const apiConfig = process.env.NODE_ENV === 'test' ? config.util.loadFileConfigs(process.env.NODE_CONFIG_DIR, { skipConfigSources: true }) : config
78
assertValid(apiConfig, { lang: 'en', name: 'config', internal: true })
89

9-
config.util.makeImmutable(apiConfig)
10-
1110
export default apiConfig as ApiConfig
1211

1312
export const uiConfig = {

api/src/limits/router.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ const isAccountMember = async (req: Request, res: Response, next: NextFunction)
2020
const sessionState = await session.req(req)
2121
if (!sessionState.user) return res.status(401).send()
2222
if (sessionState.user.adminMode) return next()
23-
if (!['organization', 'user'].includes(req.params.type)) return res.status(400).send('Wrong consumer type')
24-
if (req.params.type === 'user') {
25-
if (sessionState.user.id !== req.params.id) return res.status(403).send()
23+
const type = req.params.type as string
24+
const id = req.params.id as string
25+
if (!['organization', 'user'].includes(type)) return res.status(400).send('Wrong consumer type')
26+
if (type === 'user') {
27+
if (sessionState.user.id !== id) return res.status(403).send()
2628
}
27-
if (req.params.type === 'organization') {
28-
const org = sessionState.user.organizations.find(o => o.id === req.params.id)
29+
if (type === 'organization') {
30+
const org = sessionState.user.organizations.find(o => o.id === id)
2931
if (!org) return res.status(403).send()
3032
}
3133
next()
@@ -49,7 +51,7 @@ router.post('/:type/:id', async (req, res) => {
4951

5052
// A user can get limits information for himself only
5153
router.get('/:type/:id', isAccountMember, async (req, res) => {
52-
const consumer = { type: req.params.type as 'organization' | 'user', id: req.params.id, name: req.params.id, department: '' }
54+
const consumer = { type: req.params.type as 'organization' | 'user', id: req.params.id as string, name: req.params.id as string, department: '' }
5355
const limits = await getLimits(mongo.db, consumer)
5456
if (!limits) return res.status(404).send()
5557
if ('_id' in limits) delete limits._id

api/src/plugins/router.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,20 @@ router.get('/:id', async (req, res) => {
258258
})
259259

260260
router.delete('/:id', permissions.isSuperAdmin, async (req, res) => {
261-
if (!req.params.id) throw httpError(400, 'Plugin ID is required')
262-
if (!fs.existsSync(path.join(pluginsDir, req.params.id))) throw httpError(404, 'Plugin not found')
263-
264-
await fs.remove(path.join(pluginsDir, req.params.id))
265-
await fs.remove(path.join(pluginsDir, req.params.id + '-config.json'))
266-
await fs.remove(path.join(pluginsDir, req.params.id + '-access.json'))
267-
await fs.remove(path.join(pluginsDir, req.params.id + '-metadata.json'))
261+
const id = req.params.id as string
262+
if (!id) throw httpError(400, 'Plugin ID is required')
263+
if (!fs.existsSync(path.join(pluginsDir, id))) throw httpError(404, 'Plugin not found')
264+
265+
await fs.remove(path.join(pluginsDir, id))
266+
await fs.remove(path.join(pluginsDir, id + '-config.json'))
267+
await fs.remove(path.join(pluginsDir, id + '-access.json'))
268+
await fs.remove(path.join(pluginsDir, id + '-metadata.json'))
268269
res.status(204).send()
269270
})
270271

271272
router.put('/:id/config', permissions.isSuperAdmin, async (req, res) => {
272-
const pluginPath = path.join(pluginsDir, req.params.id, 'plugin.json')
273+
const id = req.params.id as string
274+
const pluginPath = path.join(pluginsDir, id, 'plugin.json')
273275
if (!await fs.pathExists(pluginPath)) {
274276
throw httpError(404, 'Plugin not found')
275277
}
@@ -278,27 +280,29 @@ router.put('/:id/config', permissions.isSuperAdmin, async (req, res) => {
278280
const validate = ajv.compile(pluginConfigSchema)
279281
const valid = validate(req.body)
280282
if (!valid) return res.status(400).send(validate.errors)
281-
await fs.writeJson(path.join(pluginsDir, req.params.id + '-config.json'), req.body)
283+
await fs.writeJson(path.join(pluginsDir, id + '-config.json'), req.body)
282284
res.send(req.body)
283285
})
284286

285287
router.put('/:id/metadata', permissions.isSuperAdmin, async (req, res) => {
286-
if (!await fs.pathExists(path.join(pluginsDir, req.params.id, 'plugin.json'))) {
288+
const id = req.params.id as string
289+
if (!await fs.pathExists(path.join(pluginsDir, id, 'plugin.json'))) {
287290
throw httpError(404, 'Plugin not found')
288291
}
289292

290293
const validate = ajv.compile(pluginMetadataSchema)
291294
const valid = validate(req.body)
292295
if (!valid) return res.status(400).send(validate.errors)
293-
await fs.writeJson(path.join(pluginsDir, req.params.id + '-metadata.json'), req.body)
296+
await fs.writeJson(path.join(pluginsDir, id + '-metadata.json'), req.body)
294297
res.send(req.body)
295298
})
296299

297300
router.put('/:id/access', permissions.isSuperAdmin, async (req, res) => {
298-
if (!await fs.pathExists(path.join(pluginsDir, req.params.id, 'plugin.json'))) {
301+
const id = req.params.id as string
302+
if (!await fs.pathExists(path.join(pluginsDir, id, 'plugin.json'))) {
299303
throw httpError(404, 'Plugin not found')
300304
}
301305

302-
await fs.writeJson(path.join(pluginsDir, req.params.id + '-access.json'), req.body)
306+
await fs.writeJson(path.join(pluginsDir, id + '-access.json'), req.body)
303307
res.send(req.body)
304308
})

docker-compose.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
# reverse proxy for the whole environment
55
#####
66
nginx:
7-
image: nginx:1.23.1-alpine
7+
image: nginx:1.29.4-alpine
88
network_mode: host
99
volumes:
1010
- ./dev/resources/nginx.conf:/etc/nginx/nginx.conf:ro
@@ -29,20 +29,21 @@ services:
2929
- MAILDEV_ACTIVE=true
3030
- MONGO_URL=mongodb://localhost:27017/simple-directory
3131
- STORAGE_TYPE=file
32-
- AUTHRATELIMIT_ATTEMPTS=200
32+
- AUTHRATELIMIT_ATTEMPTS=500
33+
- AUTHRATELIMIT_DURATION=30
3334
- OBSERVER_ACTIVE=false
3435
- MANAGE_PARTNERS=true
3536
- MANAGE_DEPARTMENTS=true
36-
- CIPHER_PASSWORD=cipherpassword
37+
- CIPHER_PASSWORD=dev
3738
volumes:
38-
- ./dev/resources/users.json:/webapp/data/users.json
39-
- ./dev/resources/organizations.json:/webapp/data/organizations.json
39+
- ./dev/resources/users.json:/app/data/users.json
40+
- ./dev/resources/organizations.json:/app/data/organizations.json
4041

4142
data-fair:
4243
profiles:
4344
- dev
4445
- test
45-
image: ghcr.io/data-fair/data-fair:master
46+
image: ghcr.io/data-fair/data-fair:5
4647
restart: on-failure:10
4748
network_mode: host
4849
depends_on:
@@ -107,12 +108,14 @@ services:
107108
environment:
108109
- discovery.type=single-node
109110
- xpack.security.enabled=false
110-
- "ES_JAVA_OPTS=-Xms128m -Xmx128m"
111+
- ES_HEAP_SIZE=128m
112+
- "ES_JAVA_OPTS=-Xms128m -Xmx128m -server"
111113
volumes:
112114
- elasticsearch-data:/usr/share/elasticsearch/data
113115
healthcheck:
114116
test: ["CMD", "curl", "-f", "http://localhost:9200"]
115-
timeout: 10s
117+
start_period: 10s
118+
timeout: 5s
116119
interval: 2s
117120
retries: 50
118121

0 commit comments

Comments
 (0)