Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

Commit 83de3be

Browse files
authored
React18 (#872)
1 parent 13ac1be commit 83de3be

33 files changed

+1956
-6212
lines changed

Diff for: pkg/dashboard/server/gitContents.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ func branches(w http.ResponseWriter, r *http.Request) {
4141
gitRepoCache, _ := ctx.Value("gitRepoCache").(*nativeGit.RepoCache)
4242

4343
var refIter storer.ReferenceIter
44+
var innerErr error
4445
branches := []string{}
45-
gitRepoCache.PerformAction(repoName, func(repo *git.Repository) error {
46-
refIter, _ = repo.References()
47-
return nil
46+
err := gitRepoCache.PerformAction(repoName, func(repo *git.Repository) error {
47+
refIter, innerErr = repo.References()
48+
return innerErr
4849
})
50+
if err != nil {
51+
logrus.Errorf("cannot get refs: %s", err)
52+
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
53+
return
54+
}
4955
refIter.ForEach(func(r *plumbing.Reference) error {
5056
if r.Name().IsRemote() {
5157
branch := r.Name().Short()

Diff for: web/eslint.config.mjs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import js from "@eslint/js";
2+
3+
export default [
4+
js.configs.recommended,
5+
{
6+
rules: {
7+
"no-unused-vars": "warn",
8+
"no-undef": "warn"
9+
}
10+
}
11+
];

Diff for: web/package-lock.json

+1,343-5,551
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: web/package.json

+20-21
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@headlessui/react": "^1.7.18",
6+
"@headlessui/react": "^2.1.8",
77
"@heroicons/react": "^2.1.1",
8-
"@testing-library/jest-dom": "^5.17.0",
9-
"@testing-library/react": "^11.2.6",
10-
"@testing-library/user-event": "^12.8.3",
11-
"@types/jest": "^26.0.23",
12-
"@types/react": "^17.0.75",
13-
"@types/react-dom": "^17.0.23",
8+
"@testing-library/jest-dom": "^6.5.0",
9+
"@testing-library/react": "^16.0.1",
10+
"@testing-library/user-event": "^14.5.2",
11+
"@types/jest": "^29.5.13",
12+
"@types/react": "^18.3.9",
13+
"@types/react-dom": "^18.3.0",
1414
"axios": "^1.7.7",
15-
"date-fns": "^3.6.0",
16-
"diff": "^5.2.0",
15+
"date-fns": "^4.1.0",
16+
"diff": "^7.0.0",
1717
"helm-react-ui": "github:gimlet-io/helm-react-ui#master",
1818
"immer": "^10.1.1",
1919
"js-yaml": "^4.1.0",
2020
"jsonpath": "^1.1.1",
2121
"nanoid": "^5.0.7",
22-
"posthog-js": "^1.161.2",
23-
"react": "^16.5.2",
22+
"posthog-js": "^1.165.0",
23+
"react": "^18.3.1",
2424
"react-confetti": "^6.1.0",
2525
"react-diff-viewer-continued": "^3.4.0",
26-
"react-dom": "^16.5.2",
26+
"react-dom": "^18.3.1",
2727
"react-emoji-render": "^2.0.1",
2828
"react-infinite-scroll-component": "^6.1.0",
29-
"react-router-dom": "^5.3.4",
29+
"react-router-dom": "^6.26.2",
3030
"redux": "^5.0.1",
3131
"remarkable": "^2.0.1",
3232
"typescript": "^5.6.2",
@@ -62,18 +62,17 @@
6262
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
6363
"@tailwindcss/forms": "^0.5.9",
6464
"@tailwindcss/typography": "^0.5.15",
65-
"@types/node": "^22.5.4",
65+
"@types/node": "^22.7.0",
6666
"@vitejs/plugin-react": "^4.2.1",
6767
"@vitejs/plugin-react-swc": "^3.6.0",
68-
"@vitest/coverage-v8": "^2.0.5",
68+
"@vitest/coverage-v8": "^2.1.1",
6969
"autoprefixer": "^10.4.7",
70-
"eslint": "^8.57.0",
71-
"eslint-config-react-app": "^7.0.1",
72-
"postcss": "^8.4.31",
73-
"tailwindcss": "^3.4.1",
74-
"vite": "^5.4.3",
70+
"eslint": "^9.11.1",
71+
"postcss": "^8.4.47",
72+
"tailwindcss": "^3.4.13",
73+
"vite": "^5.4.8",
7574
"vite-plugin-eslint": "^1.8.1",
76-
"vitest": "^2.0.5"
75+
"vitest": "^2.1.1"
7776
},
7877
"proxy": "http://127.0.0.1:9000"
7978
}

Diff for: web/src/apiBackend.js

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
import { Component } from 'react';
1+
import { useEffect } from 'react';
22
import {
33
ACTION_TYPE_ENVS,
44
ACTION_FLUX_EVENTS_RECEIVED,
55
ACTION_TYPE_USERS,
66
ACTION_TYPE_APPLICATION,
77
ACTION_TYPE_ALERTS,
88
} from "./redux/redux";
9+
import { useLocation } from 'react-router-dom';
910

10-
export default class APIBackend extends Component {
11+
export default function APIBackend(props) {
12+
const { gimletClient, store } = props
13+
const location = useLocation()
1114

12-
componentDidMount() {
13-
if (this.props.location.pathname.startsWith('/login')) {
15+
useEffect(() => {
16+
if (location.pathname.startsWith('/login')) {
1417
return;
1518
}
1619

17-
this.props.gimletClient.getUsers()
18-
.then(data => this.props.store.dispatch({ type: ACTION_TYPE_USERS, payload: data }), () => {/* Generic error handler deals with it */
20+
gimletClient.getUsers()
21+
.then(data => store.dispatch({ type: ACTION_TYPE_USERS, payload: data }), () => {/* Generic error handler deals with it */
1922
});
20-
this.props.gimletClient.getApp()
21-
.then(data => this.props.store.dispatch({ type: ACTION_TYPE_APPLICATION, payload: data }), () => {/* Generic error handler deals with it */
23+
gimletClient.getApp()
24+
.then(data => store.dispatch({ type: ACTION_TYPE_APPLICATION, payload: data }), () => {/* Generic error handler deals with it */
2225
});
23-
this.props.gimletClient.getEnvs()
24-
.then(data => this.props.store.dispatch({ type: ACTION_TYPE_ENVS, payload: data }), () => {/* Generic error handler deals with it */
26+
gimletClient.getEnvs()
27+
.then(data => store.dispatch({ type: ACTION_TYPE_ENVS, payload: data }), () => {/* Generic error handler deals with it */
2528
});
26-
this.props.gimletClient.getFluxEvents()
27-
.then(data => this.props.store.dispatch({ type: ACTION_FLUX_EVENTS_RECEIVED, payload: data }), () => {/* Generic error handler deals with it */
29+
gimletClient.getFluxEvents()
30+
.then(data => store.dispatch({ type: ACTION_FLUX_EVENTS_RECEIVED, payload: data }), () => {/* Generic error handler deals with it */
2831
});
29-
this.props.gimletClient.getAlerts()
30-
.then(data => this.props.store.dispatch({ type: ACTION_TYPE_ALERTS, payload: data }), () => {/* Generic error handler deals with it */
32+
gimletClient.getAlerts()
33+
.then(data => store.dispatch({ type: ACTION_TYPE_ALERTS, payload: data }), () => {/* Generic error handler deals with it */
3134
});
32-
}
35+
})
3336

34-
render() {
35-
return null;
36-
}
37+
return null;
3738
}

0 commit comments

Comments
 (0)