Skip to content

Commit 9601c5d

Browse files
committed
fix: remove the second definition of the application provider
1 parent f6dfa3f commit 9601c5d

File tree

15 files changed

+98
-76
lines changed

15 files changed

+98
-76
lines changed

.github/workflows/diracx-web-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Clone source
2626
run: |
2727
cd ..
28-
git clone https://github.com/aldbr/diracx-charts.git -b main_FIX_diracx-web-install-resources
28+
git clone https://github.com/DIRACGrid/diracx-charts.git
2929
3030
- name: Start demo
3131
run: |

.github/workflows/gubbins-test.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
# standalone setup. #
5454
prepare-gubbins-backend:
5555
runs-on: ubuntu-latest
56-
if: github.event_name == 'push' #${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
56+
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
5757
defaults:
5858
run:
5959
# We need extglob for REFERENCE_BRANCH substitution
@@ -152,7 +152,7 @@ jobs:
152152

153153
prepare-gubbins-frontend-as-a-standalone:
154154
runs-on: ubuntu-latest
155-
if: github.event_name == 'push' #${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
155+
if: ${{ github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web' }}
156156
steps:
157157
- uses: actions/checkout@v4
158158

@@ -246,14 +246,14 @@ jobs:
246246
run-demo:
247247
runs-on: ubuntu-latest
248248
needs: [prepare-gubbins-frontend-as-a-standalone, prepare-gubbins-backend]
249-
if: github.event_name == 'push' #github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
249+
if: github.event_name != 'push' || github.repository == 'DIRACGrid/diracx-web'
250250
steps:
251251
- uses: actions/checkout@v4
252252

253253
- name: Clone source
254254
run: |
255255
cd ..
256-
git clone https://github.com/TheauW/diracx-charts.git -b twartel-fix-ci
256+
git clone https://github.com/DIRACGrid/diracx-charts.git
257257
258258
# ========================================================================#
259259
# WARNING: In your CI/CD pipeline, you should remove the following steps #
@@ -330,3 +330,10 @@ jobs:
330330
browser: chrome
331331
config: baseUrl=${{ env.DIRACX_URL }}
332332
project: /tmp/gubbins-web
333+
334+
- name: Upload Cypress screenshots
335+
if: failure()
336+
uses: actions/upload-artifact@v4
337+
with:
338+
name: cypress-screenshots
339+
path: /tmp/gubbins-web/cypress/screenshots

docs/developer/create_application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The applicatins created here will be available for DiracX-Web and for all the ex
66

77
### Declare the application
88

9-
In the file `packages/diracx-web-components/src/components/ApplicationList.ts` you can extend the `applicationList` with your new app.
9+
In the file `packages/diracx-web-components/src/components/applicationList.ts` you can extend the `applicationList` with your new app.
1010

1111
You must provide:
1212
- A clear and explicit name
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { DashboardGroup } from "../types/DashboardGroup";
2+
3+
export const defaultDashboard: DashboardGroup[] = [
4+
{
5+
title: "My dashboard",
6+
extended: true,
7+
items: [
8+
{
9+
title: "My Jobs",
10+
type: "Job Monitor",
11+
id: "JobMonitor0",
12+
},
13+
],
14+
},
15+
];

packages/diracx-web-components/src/components/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Application list
2-
export { applicationList } from "./ApplicationList";
2+
export { applicationList } from "./applicationList";
33

44
// Dashboard Layout
55
export * from "./DashboardLayout";

packages/diracx-web-components/src/contexts/ApplicationsProvider.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"use client";
22

33
import React, { createContext, useEffect, useState } from "react";
4-
import { applicationList } from "../components/ApplicationList";
4+
import { applicationList } from "../components/applicationList";
5+
import { defaultDashboard } from "../components/defaultDashboard";
56
import { DashboardGroup } from "../types/DashboardGroup";
67
import ApplicationMetadata from "../types/ApplicationMetadata";
78

@@ -33,7 +34,7 @@ interface ApplicationsProviderProps {
3334
export const ApplicationsProvider = ({
3435
children,
3536
appList = applicationList,
36-
defaultUserDashboard,
37+
defaultUserDashboard = defaultDashboard,
3738
}: ApplicationsProviderProps) => {
3839
const loadedDashboard = sessionStorage.getItem("savedDashboard");
3940
const parsedDashboard: DashboardGroup[] = loadedDashboard
@@ -51,21 +52,7 @@ export const ApplicationsProvider = ({
5152
useEffect(() => {
5253
if (userDashboard.length !== 0) return;
5354

54-
setUserDashboard(
55-
defaultUserDashboard || [
56-
{
57-
title: "My dashboard",
58-
extended: true,
59-
items: [
60-
{
61-
title: "My Jobs",
62-
type: "Job Monitor",
63-
id: "JobMonitor0",
64-
},
65-
],
66-
},
67-
],
68-
);
55+
setUserDashboard(defaultUserDashboard);
6956
}, [appList, defaultUserDashboard]);
7057

7158
// Save the dashboard in session storage

packages/diracx-web-components/src/contexts/DiracXWebProviders.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"use client";
22

3+
import type { ApplicationMetadata, DashboardGroup } from "../types";
4+
5+
import { OIDCSecure } from "../components";
36
import {
47
OIDCConfigurationProvider,
58
ThemeProvider,
@@ -12,13 +15,17 @@ interface DiracXWebProvidersProps {
1215
getPath: () => string;
1316
setPath: (path: string) => void;
1417
getSearchParams: () => URLSearchParams;
18+
appList?: ApplicationMetadata[];
19+
defaultUserDashboard?: DashboardGroup[];
1520
}
1621

1722
export function DiracXWebProviders({
1823
children,
1924
getPath,
2025
setPath,
2126
getSearchParams,
27+
appList,
28+
defaultUserDashboard,
2229
}: DiracXWebProvidersProps) {
2330
return (
2431
<OIDCConfigurationProvider>
@@ -27,8 +34,13 @@ export function DiracXWebProviders({
2734
setPath={setPath}
2835
getSearchParams={getSearchParams}
2936
>
30-
<ApplicationsProvider>
31-
<ThemeProvider>{children}</ThemeProvider>
37+
<ApplicationsProvider
38+
appList={appList}
39+
defaultUserDashboard={defaultUserDashboard}
40+
>
41+
<ThemeProvider>
42+
<OIDCSecure>{children}</OIDCSecure>
43+
</ThemeProvider>
3244
</ApplicationsProvider>
3345
</NavigationProvider>
3446
</OIDCConfigurationProvider>

packages/diracx-web-components/stories/Dashboard.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react";
33
import { Box } from "@mui/material";
44
import { ApplicationsContext } from "../src/contexts/ApplicationsProvider";
55
import { NavigationProvider } from "../src/contexts/NavigationProvider";
6-
import { applicationList } from "../src/components/ApplicationList";
6+
import { applicationList } from "../src/components/applicationList";
77
import { DashboardGroup } from "../src/types/DashboardGroup";
88
import Dashboard from "../src/components/DashboardLayout/Dashboard";
99
import { ThemeProvider } from "../src/contexts/ThemeProvider";

packages/diracx-web/src/app/(dashboard)/layout.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from "react";
33
import { Box } from "@mui/material";
44
import { DiracXWebProviders } from "@dirac-grid/diracx-web-components/contexts";
55
import {
6-
OIDCSecure,
76
Dashboard,
87
} from "@dirac-grid/diracx-web-components/components";
98
import { usePathname, useRouter, useSearchParams } from "next/navigation";
@@ -25,22 +24,20 @@ export default function DashboardLayout({
2524
}}
2625
getSearchParams={() => searchParams}
2726
>
28-
<OIDCSecure>
29-
<Dashboard>
30-
<Box
31-
sx={{
32-
ml: "1%",
33-
mr: "1%",
34-
display: "flex",
35-
flexDirection: "column",
36-
flexGrow: 1,
37-
overflow: "hidden",
38-
}}
39-
>
40-
{children}
41-
</Box>
42-
</Dashboard>
43-
</OIDCSecure>
27+
<Dashboard>
28+
<Box
29+
sx={{
30+
ml: "1%",
31+
mr: "1%",
32+
display: "flex",
33+
flexDirection: "column",
34+
flexGrow: 1,
35+
overflow: "hidden",
36+
}}
37+
>
38+
{children}
39+
</Box>
40+
</Dashboard>
4441
</DiracXWebProviders>
4542
</section>
4643
);

0 commit comments

Comments
 (0)