Skip to content

Commit 6e7086e

Browse files
authored
Merge pull request #9 from electrolux-oss/graphql
Migrate plugin to Graphql
2 parents 7ce8caf + 86a7ef6 commit 6e7086e

11 files changed

Lines changed: 3420 additions & 4647 deletions

File tree

.github/workflows/manual_deploy_to_npm.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
#############################################################################
1515
# common steps
1616
#############################################################################
17-
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
17+
- uses: actions/checkout@v7.0.0
1818

1919
- name: use node.js 24.x
20-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
20+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
2121
with:
22-
node-version: '24.x'
22+
node-version: "24.x"
2323
registry-url: https://registry.npmjs.org/ # Needed for auth
2424

2525
- name: yarn install
@@ -57,6 +57,10 @@ jobs:
5757
- name: publish
5858
run: |
5959
yarn config set -H 'npmAuthToken' "${{secrets.NPM_TOKEN}}"
60-
yarn workspaces foreach -v -A --no-private npm publish --access public --tolerate-republish
60+
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
61+
yarn workspaces foreach -v -A --no-private npm publish --access public --tolerate-republish
62+
else
63+
yarn workspaces foreach -v -A --no-private npm publish --access public --tolerate-republish --tag rc
64+
fi
6165
env:
6266
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/pr.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ on:
55
branches:
66
- main
77
paths-ignore:
8-
- '**/docs/**'
9-
- '**.md'
10-
- '.github/**'
8+
- "**/docs/**"
9+
- "**.md"
10+
- ".github/**"
1111
pull_request:
1212
branches:
1313
- main
1414
paths-ignore:
15-
- '**/docs/**'
16-
- '**.md'
17-
- '.github/**'
15+
- "**/docs/**"
16+
- "**.md"
17+
- ".github/**"
1818

1919
permissions:
2020
contents: read
@@ -31,10 +31,10 @@ jobs:
3131
# common steps
3232
#############################################################################
3333

34-
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
34+
- uses: actions/checkout@v7.0.0
3535

3636
- name: use node.js 24.x
37-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
37+
uses: actions/checkout@v7.0.0
3838
with:
3939
node-version: 24.x
4040

backstage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "1.50.4"
2+
"version": "1.52.1"
33
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"plugins/*"
3434
],
3535
"devDependencies": {
36-
"@backstage/cli": "^0.36.1",
37-
"@backstage/cli-defaults": "^0.1.1",
36+
"@backstage/cli": "^0.36.3",
37+
"@backstage/cli-defaults": "^0.1.3",
3838
"@jest/environment-jsdom-abstract": "^30.0.0",
3939
"@types/jest": "^30.0.0",
4040
"jest": "^30.2.0",

packages/app/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
"lint": "backstage-cli package lint"
1515
},
1616
"dependencies": {
17-
"@backstage/cli": "^0.36.1",
18-
"@backstage/core-components": "^0.18.9",
19-
"@backstage/core-plugin-api": "^1.12.5",
20-
"@backstage/frontend-defaults": "^0.5.1",
21-
"@backstage/frontend-plugin-api": "^0.16.2",
22-
"@backstage/plugin-app-react": "^0.2.2",
23-
"@backstage/plugin-auth": "^0.1.7",
24-
"@backstage/plugin-catalog": "^2.0.4",
25-
"@backstage/plugin-user-settings": "^0.9.2",
26-
"@backstage/ui": "^0.14.3",
17+
"@backstage/cli": "^0.36.3",
18+
"@backstage/core-components": "^0.18.11",
19+
"@backstage/core-plugin-api": "^1.12.7",
20+
"@backstage/frontend-defaults": "^0.5.3",
21+
"@backstage/frontend-plugin-api": "^0.17.2",
22+
"@backstage/plugin-app-react": "^0.2.4",
23+
"@backstage/plugin-auth": "^0.1.9",
24+
"@backstage/plugin-catalog": "^2.0.6",
25+
"@backstage/plugin-user-settings": "^0.9.4",
26+
"@backstage/ui": "^0.16.0",
2727
"@electrolux-oss/infrakitchen-plugin-for-backstage": "workspace:^",
2828
"@material-ui/core": "^4.12.2",
2929
"@material-ui/icons": "^4.9.1",

packages/app/src/modules/nav/SidebarLogo.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import {
2-
Link,
3-
sidebarConfig,
4-
useSidebarOpenState,
5-
} from '@backstage/core-components';
1+
import { sidebarConfig, useSidebarOpenState } from '@backstage/core-components';
2+
import { Link as RouterLink } from 'react-router-dom';
63
import { makeStyles } from '@material-ui/core';
74
import { LogoFull } from './LogoFull';
85
import { LogoIcon } from './LogoIcon';
@@ -28,14 +25,13 @@ export const SidebarLogo = () => {
2825

2926
return (
3027
<div className={classes.root}>
31-
<Link
28+
<RouterLink
3229
to="/infrakitchen/resources"
33-
underline="none"
3430
className={classes.link}
3531
aria-label="Home"
3632
>
3733
{isOpen ? <LogoFull /> : <LogoIcon />}
38-
</Link>
34+
</RouterLink>
3935
</div>
4036
);
4137
};

packages/backend/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,22 @@
1515
"build-image": "docker build ../.. -f Dockerfile --tag backstage"
1616
},
1717
"dependencies": {
18-
"@backstage/backend-defaults": "^0.17.0",
19-
"@backstage/config": "^1.3.7",
20-
"@backstage/plugin-app-backend": "^0.5.13",
21-
"@backstage/plugin-auth-backend": "^0.28.0",
22-
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.18",
23-
"@backstage/plugin-auth-node": "^0.7.0",
24-
"@backstage/plugin-catalog-backend": "^3.6.1",
25-
"@backstage/plugin-catalog-backend-module-logs": "^0.1.21",
26-
"@backstage/plugin-proxy-backend": "^0.6.12",
18+
"@backstage/backend-defaults": "^0.17.4",
19+
"@backstage/config": "^1.3.8",
20+
"@backstage/plugin-app-backend": "^0.5.15",
21+
"@backstage/plugin-auth-backend": "^0.29.1",
22+
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.20",
23+
"@backstage/plugin-auth-node": "^0.7.2",
24+
"@backstage/plugin-catalog-backend": "^3.8.0",
25+
"@backstage/plugin-catalog-backend-module-logs": "^0.1.23",
26+
"@backstage/plugin-proxy-backend": "^0.6.14",
2727
"app": "link:../app",
2828
"better-sqlite3": "^12.0.0",
2929
"node-gyp": "^10.0.0",
3030
"pg": "^8.11.3"
3131
},
3232
"devDependencies": {
33-
"@backstage/cli": "^0.36.1"
33+
"@backstage/cli": "^0.36.3"
3434
},
3535
"files": [
3636
"dist"

plugins/infrakitchen/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@electrolux-oss/infrakitchen-plugin-for-backstage",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"backstage": {
55
"role": "frontend-plugin",
66
"pluginId": "infrakitchen",
@@ -34,14 +34,14 @@
3434
"start": "backstage-cli package start"
3535
},
3636
"dependencies": {
37-
"@backstage/core-components": "^0.18.9",
38-
"@backstage/core-plugin-api": "^1.12.5",
39-
"@backstage/frontend-plugin-api": "^0.16.2",
40-
"@backstage/ui": "^0.14.3",
37+
"@backstage/core-components": "^0.18.11",
38+
"@backstage/core-plugin-api": "^1.12.7",
39+
"@backstage/frontend-plugin-api": "^0.17.2",
40+
"@backstage/ui": "^0.16.0",
4141
"@codemirror/lang-json": "^6.0.2",
4242
"@codemirror/state": "^6.5.4",
4343
"@codemirror/view": "^6.39.16",
44-
"@electrolux-oss/infrakitchen": "0.3.2",
44+
"@electrolux-oss/infrakitchen": "0.4.0",
4545
"@emotion/react": "^11.14.0",
4646
"@emotion/styled": "^11.14.1",
4747
"@fontsource/space-grotesk": "^5.2.10",
@@ -58,9 +58,9 @@
5858
"react-use": "^17.6.0"
5959
},
6060
"devDependencies": {
61-
"@backstage/cli": "^0.36.1",
62-
"@backstage/dev-utils": "^1.1.22",
63-
"@backstage/frontend-dev-utils": "^0.1.1",
61+
"@backstage/cli": "^0.36.3",
62+
"@backstage/dev-utils": "^1.1.24",
63+
"@backstage/frontend-dev-utils": "^0.1.3",
6464
"react": "^18.3.1"
6565
},
6666
"peerDependencies": {

plugins/infrakitchen/src/components/Infrakitchen/App.tsx

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useMemo } from 'react';
1+
import { FC, Suspense, useMemo } from 'react';
22
import { Routes, Route, useLocation } from 'react-router-dom';
33
import { Header, Container } from '@backstage/ui';
44
import {
@@ -12,7 +12,6 @@ import {
1212
useFilteredProtectedRoutes,
1313
usePermissionProvider,
1414
GradientCircularProgress,
15-
FavoritesProvider,
1615
} from '@electrolux-oss/infrakitchen';
1716

1817
import { useApi, useRouteRef } from '@backstage/frontend-plugin-api';
@@ -22,33 +21,43 @@ import { InfraKitchenColorOverrideProvider } from './InfraKitchenColorOverridePr
2221

2322
const PermissionFilteredRouter = () => {
2423
const accessibleRoutes = useFilteredProtectedRoutes();
25-
const { permissions } = usePermissionProvider();
26-
27-
// If no permissions are defined yet, don't render any routes
28-
if (Object.keys(permissions).length === 0) {
29-
return null;
30-
}
3124

3225
return (
3326
<>
3427
<RouterSnackbarWrapper />
35-
<Routes>
36-
{accessibleRoutes.map((route, index) => (
37-
<Route
38-
key={route.path || index}
39-
path={route.path}
40-
element={route.Component ? <route.Component /> : route.element}
41-
/>
42-
))}
43-
</Routes>
28+
<Suspense fallback={<GradientCircularProgress />}>
29+
<Routes>
30+
{accessibleRoutes.map((route, index) => {
31+
const element = route.Component ? (
32+
<route.Component />
33+
) : (
34+
route.element
35+
);
36+
37+
if (route.path === '/') {
38+
return (
39+
<Route key={route.path || index} index element={element} />
40+
);
41+
}
42+
43+
return (
44+
<Route
45+
key={route.path || index}
46+
path={route.path?.replace(/^\//, '')}
47+
element={element}
48+
/>
49+
);
50+
})}
51+
</Routes>
52+
</Suspense>
4453
</>
4554
);
4655
};
4756

4857
const allTabs = [
4958
{
50-
id: 'getting-started',
51-
label: 'Getting Started',
59+
id: 'dashboard',
60+
label: 'Dashboard',
5261
path: '/',
5362
permissionKey: '',
5463
},
@@ -118,7 +127,7 @@ const allTabs = [
118127

119128
const InfrakitchenApp: FC = () => {
120129
const location = useLocation();
121-
const { permissions, loading } = usePermissionProvider();
130+
const { permissions } = usePermissionProvider();
122131

123132
// Filter tabs based on user permissions
124133
const tabs = useMemo(() => {
@@ -159,10 +168,6 @@ const InfrakitchenApp: FC = () => {
159168
[tabs, basePath],
160169
);
161170

162-
if (loading) {
163-
return <GradientCircularProgress />;
164-
}
165-
166171
return (
167172
<>
168173
<Header
@@ -190,13 +195,11 @@ export const AppWrapper = () => {
190195
webSocketEnabled={false}
191196
>
192197
<PermissionProvider>
193-
<FavoritesProvider>
194-
<EventProvider>
195-
<NotificationProvider>
196-
<InfrakitchenApp />
197-
</NotificationProvider>
198-
</EventProvider>
199-
</FavoritesProvider>
198+
<EventProvider>
199+
<NotificationProvider>
200+
<InfrakitchenApp />
201+
</NotificationProvider>
202+
</EventProvider>
200203
</PermissionProvider>
201204
</ConfigProvider>
202205
</LocalStorageProvider>

0 commit comments

Comments
 (0)