Skip to content

Commit 688c2fc

Browse files
author
Arief Rahmansyah
authored
chore: Upgrade UI (caraml-dev#100)
* Update Elastic UI Commented some errors for now and mark them as TODOs. Will revisit them later after finish updating other deps. * Minor upgrade deps * Upgrade jwt-decode, query-string, react-collapsed * Upgrade React to 18 * Add minimum node version * Update non rollup deps * Upgrade rollup * Update github actions * Revert go lint * Fix nav drawer not expanding * Resolve TODO
1 parent be7a48a commit 688c2fc

File tree

22 files changed

+4385
-3601
lines changed

22 files changed

+4385
-3601
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# Automatically run CI on Release and Pre-Release tags and main branch
55
push:
66
tags:
7-
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
- "v[0-9]+.[0-9]+.[0-9]+*"
88
branches:
99
- main
1010
paths-ignore:
@@ -23,7 +23,7 @@ on:
2323
env:
2424
GO_VERSION: "1.20"
2525
GO_LINT_VERSION: v1.51.2
26-
NODE_VERSION: 16
26+
NODE_VERSION: 20
2727
ARTIFACT_RETENTION_DAYS: 7
2828
CONTAINER_REGISTRY: ghcr.io
2929
LOCAL_REGISTRY: registry.localhost:5000
@@ -35,18 +35,12 @@ jobs:
3535
build-ui:
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v3
39-
- uses: actions/setup-node@v3
38+
- uses: actions/checkout@v4
39+
- uses: actions/setup-node@v4
4040
with:
4141
node-version: ${{ env.NODE_VERSION }}
42-
43-
- name: Cache Dependencies
44-
uses: actions/cache@v3
45-
with:
46-
path: ui/node_modules
47-
key: |
48-
${{ runner.os }}-modules-${{ hashFiles('ui/yarn.lock') }}
49-
restore-keys: ${{ runner.os }}-modules-
42+
cache: yarn
43+
cache-dependency-path: ui/yarn.lock
5044

5145
- name: Install
5246
working-directory: ui
@@ -61,7 +55,7 @@ jobs:
6155
run: make build-ui
6256

6357
- name: Publish Artifact
64-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
6559
with:
6660
name: mlp-ui-dist
6761
path: ui/build/
@@ -72,7 +66,7 @@ jobs:
7266
outputs:
7367
api-version: ${{ steps.build-image.outputs.api-version }}
7468
steps:
75-
- uses: actions/checkout@v3
69+
- uses: actions/checkout@v4
7670
with:
7771
fetch-depth: 0
7872

@@ -90,7 +84,7 @@ jobs:
9084
mlp-api:${{ steps.build-image.outputs.api-version }}
9185
9286
- name: Publish Artifact
93-
uses: actions/upload-artifact@v3
87+
uses: actions/upload-artifact@v4
9488
with:
9589
name: mlp-api.${{ steps.build-image.outputs.api-version }}.tar
9690
path: mlp-api.${{ steps.build-image.outputs.api-version }}.tar
@@ -101,18 +95,11 @@ jobs:
10195
env:
10296
GOPATH: ${{ github.workspace }}/.go
10397
steps:
104-
- uses: actions/checkout@v3
105-
- uses: actions/setup-go@v3
98+
- uses: actions/checkout@v4
99+
- uses: actions/setup-go@v5
106100
with:
107101
go-version: ${{ env.GO_VERSION }}
108-
109-
- name: Cache Dependencies
110-
uses: actions/cache@v3
111-
with:
112-
path: .go/pkg/mod/
113-
key: |
114-
gomod-${{ hashFiles('go.mod') }}
115-
restore-keys: gomod-
102+
cache-dependency-path: api/go.sum
116103

117104
- name: Lint code
118105
uses: golangci/golangci-lint-action@v2
@@ -138,15 +125,15 @@ jobs:
138125
- build-api
139126
- test-api
140127
steps:
141-
- uses: actions/checkout@v3
128+
- uses: actions/checkout@v4
142129

143-
- uses: actions/checkout@v3
130+
- uses: actions/checkout@v4
144131
with:
145132
repository: ${{ env.CARAML_CHARTS_REPOSITORY }}
146133
ref: ${{ env.CARAML_CHARTS_REF }}
147-
path: 'helm-charts'
134+
path: "helm-charts"
148135

149-
- uses: actions/setup-go@v3
136+
- uses: actions/setup-go@v5
150137
with:
151138
go-version: ${{ env.GO_VERSION }}
152139

@@ -166,7 +153,7 @@ jobs:
166153
--k3s-arg "--no-deploy=metrics-server@server:*"
167154
168155
- name: Download API image tar
169-
uses: actions/download-artifact@v3
156+
uses: actions/download-artifact@v4
170157
with:
171158
name: mlp-api.${{ needs.build-api.outputs.api-version }}.tar
172159

@@ -198,28 +185,28 @@ jobs:
198185
echo "::group::describe deployment/mlp"
199186
kubectl describe deployment/mlp
200187
echo "::endgroup::"
201-
188+
202189
echo "::group::configmap/mlp-config"
203190
kubectl get cm/mlp-config -o jsonpath='{.data.mlp-config\.yaml}'
204191
echo "::endgroup::"
205-
192+
206193
echo "::group::logs deployment/mlp"
207194
kubectl logs deployment/mlp
208195
echo "::endgroup::"
209-
196+
210197
echo "::group::kubernetes events"
211198
kubectl get events
212199
echo "::endgroup::"
213200
214201
echo "::group::kubernetes pod describe"
215202
kubectl describe pod
216-
echo "::endgroup::"
203+
echo "::endgroup::"
217204
218205
- name: Setup MLP project
219206
shell: bash
220207
run: |
221208
sleep 2
222-
209+
223210
tee payload.json <<EOF
224211
{
225212
"name": "e2e-test",
@@ -274,7 +261,7 @@ jobs:
274261
runs-on: ubuntu-latest
275262
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
276263
steps:
277-
- uses: actions/checkout@v3
264+
- uses: actions/checkout@v4
278265

279266
- name: Log in to the Container registry
280267
uses: docker/login-action@v2
@@ -284,12 +271,12 @@ jobs:
284271
password: ${{ secrets.GITHUB_TOKEN }}
285272

286273
- name: Download API image tar
287-
uses: actions/download-artifact@v3
274+
uses: actions/download-artifact@v4
288275
with:
289276
name: mlp-api.${{ needs.build-api.outputs.api-version }}.tar
290277

291278
- name: Download MLP UI Dist
292-
uses: actions/download-artifact@v3
279+
uses: actions/download-artifact@v4
293280
with:
294281
name: mlp-ui-dist
295282
path: ui/build
@@ -309,7 +296,7 @@ jobs:
309296
changed: ${{ steps.changes.outputs.ui-lib }}
310297
runs-on: ubuntu-latest
311298
steps:
312-
- uses: actions/checkout@v3
299+
- uses: actions/checkout@v4
313300
- uses: dorny/paths-filter@v2
314301
id: changes
315302
with:
@@ -340,17 +327,17 @@ jobs:
340327
runs-on: ubuntu-latest
341328
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
342329
steps:
343-
- uses: actions/checkout@v3
330+
- uses: actions/checkout@v4
344331
with:
345332
fetch-depth: 0
346333

347-
- uses: actions/setup-node@v3
334+
- uses: actions/setup-node@v4
348335
with:
349336
node-version: ${{ env.NODE_VERSION }}
350337
registry-url: https://registry.npmjs.org
351338

352339
- name: Cache Dependencies
353-
uses: actions/cache@v3
340+
uses: actions/cache@v4
354341
with:
355342
path: ui/node_modules
356343
key: |
@@ -367,4 +354,4 @@ jobs:
367354
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
368355
run: |
369356
yarn set-version-from-git
370-
yarn lib publish
357+
yarn lib publish

ui/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
],
1414
"nohoist": []
1515
},
16+
"engines": {
17+
"node": ">=20.13.1"
18+
},
1619
"scripts": {
1720
"app": "yarn workspace mlp-ui",
1821
"lib": "yarn workspace @caraml-dev/ui-lib",
@@ -32,11 +35,11 @@
3235
"version-from-git": "../scripts/vertagen/vertagen.sh"
3336
},
3437
"devDependencies": {
35-
"husky": "^8.0.1",
36-
"lint-staged": "^11.1.2",
38+
"husky": "^9.0.11",
39+
"lint-staged": "^15.2.5",
3740
"npm-run-all": "^4.1.5",
38-
"prettier": "^1.17.0",
39-
"wait-on": "^5.1.0"
41+
"prettier": "^3.2.5",
42+
"wait-on": "^7.2.0"
4043
},
4144
"lint-staged": {
4245
"**/*.{js,jsx,ts,tsx,json,css,scss,md}": [

ui/packages/app/package.json

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@
66
"dependencies": {
77
"@caraml-dev/ui-lib": "^1.7.5-build.5-59f13e1",
88
"@elastic/datemath": "^5.0.3",
9-
"@elastic/eui": "66.0.0",
10-
"@emotion/react": "^11.9.0",
11-
"@sentry/browser": "5.15.5",
12-
"moment": "^2.29.4",
9+
"@elastic/eui": "^94.5.2",
10+
"@emotion/css": "^11.11.2",
11+
"@emotion/react": "^11.11.4",
12+
"@sentry/browser": "8.5.0",
13+
"moment": "^2.30.1",
1314
"object-assign-deep": "0.4.0",
1415
"proper-url-join": "2.1.1",
15-
"query-string": "^7.0.1",
16-
"react": "17.0.2",
17-
"react-dom": "17.0.2",
18-
"react-router-dom": "^6.3.0"
16+
"query-string": "^9.0.0",
17+
"react": "18.3.1",
18+
"react-dom": "18.3.1",
19+
"react-router-dom": "^6.23.1"
1920
},
2021
"devDependencies": {
21-
"@craco/craco": "^6.4.5",
22+
"@craco/craco": "^7.1.0",
2223
"react-scripts": "^5.0.1"
2324
},
25+
"engines": {
26+
"node": ">=20.13.1"
27+
},
2428
"scripts": {
29+
"start": "craco start",
2530
"build": "craco build",
26-
"postbuild": "mv build ../../build",
31+
"test": "craco test",
2732
"eject": "craco eject",
2833
"lint": "eslint --max-warnings 0 src",
2934
"lint:fix": "eslint --fix src",
30-
"start": "craco start",
31-
"test": "craco test"
35+
"postbuild": "mv build ../../build"
3236
},
3337
"proxy": "http://localhost:8080",
3438
"browserslist": {

ui/packages/app/src/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import React from "react";
21
import {
32
AuthProvider,
4-
Page404,
53
ErrorBoundary,
64
Login,
75
MlpApiContextProvider,
6+
Page404,
87
Toast
98
} from "@caraml-dev/ui-lib";
10-
import config from "./config";
11-
import { PrivateLayout } from "./PrivateLayout";
129
import { EuiProvider } from "@elastic/eui";
10+
import React from "react";
1311
import { Route, Routes } from "react-router-dom";
1412
import AppRoutes from "./AppRoutes";
13+
import { PrivateLayout } from "./PrivateLayout";
14+
import config from "./config";
1515

1616
const App = () => (
1717
<EuiProvider>

ui/packages/app/src/PrivateLayout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import React from "react";
21
import {
32
ApplicationsContext,
43
ApplicationsContextProvider,
54
Header,
65
PrivateRoute,
76
ProjectsContextProvider
87
} from "@caraml-dev/ui-lib";
9-
import config from "./config";
108
import urlJoin from "proper-url-join";
9+
import React from "react";
1110
import { Outlet, useNavigate } from "react-router-dom";
11+
import config from "./config";
1212

1313
export const PrivateLayout = () => {
1414
const navigate = useNavigate();

ui/packages/app/src/bootstrap.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1+
import * as Sentry from "@sentry/browser";
12
import React from "react";
2-
import ReactDOM from "react-dom";
3+
import { createRoot } from "react-dom/client";
4+
import { BrowserRouter } from "react-router-dom";
35
import App from "./App";
4-
import * as Sentry from "@sentry/browser";
5-
import * as serviceWorker from "./serviceWorker";
66
import { sentryConfig } from "./config";
7-
import { BrowserRouter } from "react-router-dom";
7+
import * as serviceWorker from "./serviceWorker";
88

9-
// Styles
10-
import "@elastic/eui/dist/eui_theme_light.css";
119
import "@caraml-dev/ui-lib/dist/index.css";
10+
import "@elastic/eui/dist/eui_theme_light.css";
1211

1312
Sentry.init(sentryConfig);
1413

15-
ReactDOM.render(
16-
<React.StrictMode>
17-
<BrowserRouter>
18-
<App />
19-
</BrowserRouter>
20-
</React.StrictMode>,
21-
document.getElementById("root")
14+
const container = document.getElementById("root");
15+
const root = createRoot(container);
16+
17+
root.render(
18+
<BrowserRouter>
19+
<App />
20+
</BrowserRouter>,
2221
);
2322

2423
// If you want your app to work offline and load faster, you can change

ui/packages/app/src/pages/project/Project.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import React, { useContext } from "react";
1+
import { ApplicationsContext, ProjectsContext } from "@caraml-dev/ui-lib";
22
import {
33
EuiFlexGroup,
44
EuiFlexItem,
5-
EuiLoadingContent,
6-
EuiSpacer,
7-
EuiPageTemplate
5+
EuiPageTemplate,
6+
EuiSkeletonText,
7+
EuiSpacer
88
} from "@elastic/eui";
9-
import { ApplicationsContext, ProjectsContext } from "@caraml-dev/ui-lib";
10-
import { Instances } from "./components/Instances";
11-
import { ProjectSummary } from "./components/ProjectSummary";
12-
import { Resources } from "./components/Resources";
9+
import React, { useContext } from "react";
1310
import { useMerlinApi } from "../../hooks/useMerlinApi";
1411
import { useTuringApi } from "../../hooks/useTuringApi";
1512
import { ComingSoonPanel } from "./components/ComingSoonPanel";
13+
import { Instances } from "./components/Instances";
14+
import { ProjectSummary } from "./components/ProjectSummary";
15+
import { Resources } from "./components/Resources";
1616

1717
import imageCharts from "../../images/charts.svg";
1818
import "./components/ListGroup.scss";
@@ -87,7 +87,7 @@ const Project = () => {
8787
</EuiFlexGroup>
8888
</>
8989
) : (
90-
<EuiLoadingContent lines={5} />
90+
<EuiSkeletonText lines={5} />
9191
)}
9292
</EuiPageTemplate.Section>
9393
</EuiPageTemplate>

0 commit comments

Comments
 (0)