Skip to content

Commit 0de1597

Browse files
committed
Merge branch 'main' into cant-go-back-from-processing
2 parents ec3fcd9 + a2ff44b commit 0de1597

103 files changed

Lines changed: 909 additions & 822 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/remove-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types:
66
- closed
77

8+
env:
9+
PR_NUMBER: ${{ github.event.pull_request.number }}
10+
811
jobs:
912
delete_directory:
1013
runs-on: ubuntu-latest

src/components/About.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,11 @@ const About = () => {
4747
{
4848
path: "/about/imprint",
4949
accessRole: "ROLE_UI_USERS_VIEW",
50-
loadFn: () => { },
5150
text: "ABOUT.IMPRINT"
5251
},
5352
{
5453
path: "/about/privacy",
5554
accessRole: "ROLE_UI_GROUPS_VIEW",
56-
loadFn: () => { },
5755
text: "ABOUT.PRIVACY"
5856
},
5957
]}

src/components/Header.tsx

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React, { useEffect, useRef, useState } from "react";
22
import { useTranslation } from "react-i18next";
3-
import { Link } from "react-router";
3+
import { useNavigate } from "react-router";
44
import i18n from "../i18n/i18n";
55
import languages from "../i18n/languages";
66
import opencastLogo from "../img/opencast-white.svg?url";
77
import { setSpecificServiceFilter } from "../slices/tableFilterSlice";
8-
import { loadServicesIntoTable } from "../thunks/tableThunks";
98
import { getErrorCount, getHealthStatus } from "../selectors/healthSelectors";
109
import {
1110
getOrgProperties,
@@ -73,14 +72,6 @@ const Header = () => {
7372
registrationModalRef.current?.open()
7473
};
7574

76-
const redirectToServices = async () => {
77-
// Load services into table
78-
await dispatch(loadServicesIntoTable());
79-
80-
// set the action filter value of services to true
81-
await dispatch(setSpecificServiceFilter({ filter: "actions", filterValue: "true" }));
82-
};
83-
8475
const showHotKeyCheatSheet = () => {
8576
hotKeyCheatSheetModalRef.current?.open()
8677
};
@@ -216,7 +207,6 @@ const Header = () => {
216207
{displayMenuNotify && (
217208
<MenuNotify
218209
healthStatus={healthStatus}
219-
redirectToServices={redirectToServices}
220210
/>
221211
)}
222212
</div>
@@ -302,20 +292,27 @@ const MenuLang = () => {
302292

303293
const MenuNotify = ({
304294
healthStatus,
305-
redirectToServices
306295
}: {
307296
healthStatus: HealthStatus[],
308-
redirectToServices: () => Promise<void>,
309297
}) => {
298+
const dispatch = useAppDispatch();
299+
const navigate = useNavigate();
300+
301+
const redirectToServices = async () => {
302+
// set the action filter value of services to true
303+
await dispatch(setSpecificServiceFilter({ filter: "actions", filterValue: "true" }));
304+
navigate("/systems/services");
305+
};
306+
310307
return (
311308
<ul className="dropdown-ul">
312309
{/* For each service in the serviceList (Background Services) one list item */}
313310
{healthStatus.map((service, key) => (
314311
<li key={key}>
315312
{!!service.status && (
316-
<Link
317-
to="/systems/services"
318-
onClick={async () => await redirectToServices()}
313+
<button
314+
className="button-like-anchor"
315+
onClick={() => redirectToServices()}
319316
>
320317
<span> {service.name} </span>
321318
{service.error ? (
@@ -327,7 +324,7 @@ const MenuNotify = ({
327324
{service.status}
328325
</span>
329326
)}
330-
</Link>
327+
</button>
331328
)}
332329
</li>
333330
))}

src/components/NavBar.tsx

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
import React, { useRef } from "react";
22
import { Link, useLocation } from "react-router";
33
import { hasAccess } from "../utils/utils";
4-
import { AppDispatch, useAppDispatch, useAppSelector } from "../store";
4+
import { useAppSelector } from "../store";
55
import { getUserInformation } from "../selectors/userInfoSelectors";
66
import cn from "classnames";
77
import { useTranslation } from "react-i18next";
88
import MainNav from "./shared/MainNav";
9-
import { setOffset } from "../slices/tableSlice";
109
import NewResourceModal, { NewResource } from "./shared/NewResourceModal";
1110
import { useHotkeys } from "react-hotkeys-hook";
1211
import { ModalHandle } from "./shared/modals/Modal";
12+
import { ParseKeys } from "i18next";
1313

1414
/**
1515
* Component that renders the nav bar
1616
*/
17-
type LinkType = {
18-
path: string
19-
accessRole: string
20-
loadFn: (dispatch: AppDispatch) => void
21-
text: string
22-
}
23-
2417
type CreateType = {
2518
accessRole: string
2619
onShowModal?: () => Promise<void>
2720
onHideModal?: () => void
28-
text: string
21+
text: ParseKeys
2922
isDisplay?: boolean
3023
resource: NewResource
3124
hotkeySequence?: string[]
32-
hotkeyDescription?: string
25+
hotkeyDescription?: ParseKeys
3326
}
3427

3528
const NavBar = ({
@@ -41,15 +34,17 @@ const NavBar = ({
4134
create,
4235
} : {
4336
children?: React.ReactNode
44-
navAriaLabel?: string
37+
navAriaLabel?: ParseKeys
4538
displayNavigation: boolean
4639
setNavigation: React.Dispatch<React.SetStateAction<boolean>>
47-
links: LinkType[]
40+
links: {
41+
path: string
42+
accessRole: string
43+
text: ParseKeys
44+
}[]
4845
create?: CreateType
4946
}) => {
50-
5147
const { t } = useTranslation();
52-
const dispatch = useAppDispatch();
5348
const location = useLocation();
5449

5550
const user = useAppSelector(state => getUserInformation(state));
@@ -73,7 +68,7 @@ const NavBar = ({
7368
useHotkeys(
7469
(create && create.hotkeySequence) ?? [],
7570
() => showNewResourceModal(),
76-
{ description: t((create && create.hotkeyDescription) ?? "") ?? undefined },
71+
{ description: create && create.hotkeyDescription ? t(create.hotkeyDescription) : undefined },
7772
[showNewResourceModal]
7873
);
7974

@@ -98,13 +93,6 @@ const NavBar = ({
9893
key={index}
9994
to={link.path}
10095
className={cn({ active: location.pathname === link.path || (location.pathname === "/" && link.path === "/events/events") })}
101-
onClick={() => {
102-
if (location.pathname !== link.path) {
103-
// Reset the current page to first page
104-
dispatch(setOffset(0));
105-
}
106-
link.loadFn(dispatch)
107-
}}
10896
>
10997
{t(link.text)}
11098
</Link>

src/components/configuration/Themes.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import MainView from "../MainView";
1313
import Footer from "../Footer";
1414
import { useAppDispatch, useAppSelector } from "../../store";
1515
import { fetchThemes } from "../../slices/themeSlice";
16+
import { resetTableProperties } from "../../slices/tableSlice";
1617

1718
/**
1819
* This component renders the table view of events
@@ -25,27 +26,37 @@ const Themes = () => {
2526

2627
const themes = useAppSelector(state => getTotalThemes(state));
2728

28-
const loadThemes = async () => {
29-
// Fetching themes from server
30-
await dispatch(fetchThemes());
29+
useEffect(() => {
30+
// State variable for interrupting the load function
31+
let allowLoadIntoTable = true;
3132

32-
// Load users into table
33-
dispatch(loadThemesIntoTable());
34-
};
33+
// Clear table of previous data
34+
dispatch(resetTableProperties());
3535

36-
useEffect(() => {
3736
dispatch(fetchFilters("themes"));
3837

3938
// Reset text filter
4039
dispatch(editTextFilter(""));
4140

4241
// Load themes on mount
42+
const loadThemes = async () => {
43+
// Fetching themes from server
44+
await dispatch(fetchThemes());
45+
46+
// Load users into table
47+
if (allowLoadIntoTable) {
48+
dispatch(loadThemesIntoTable());
49+
}
50+
};
4351
loadThemes();
4452

4553
// Fetch themes every minute
4654
let fetchThemesInterval = setInterval(loadThemes, 5000);
4755

48-
return () => clearInterval(fetchThemesInterval);
56+
return () => {
57+
allowLoadIntoTable = false;
58+
clearInterval(fetchThemesInterval);
59+
}
4960
// eslint-disable-next-line react-hooks/exhaustive-deps
5061
}, []);
5162

@@ -59,7 +70,6 @@ const Themes = () => {
5970
{
6071
path: "/configuration/themes",
6172
accessRole: "ROLE_UI_THEMES_VIEW",
62-
loadFn: loadThemes,
6373
text: "CONFIGURATION.NAVIGATION.THEMES"
6474
},
6575
]}

src/components/configuration/partials/wizard/NewThemeWizard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { usePageFunctions } from "../../../../hooks/wizardHooks";
1111
import { NewThemeSchema } from "../../../../utils/validate";
1212
import { useAppDispatch } from "../../../../store";
1313
import { postNewTheme, ThemeDetailsInitialValues } from "../../../../slices/themeSlice";
14+
import { ParseKeys } from "i18next";
1415

1516
/**
1617
* This component manages the pages of the new theme wizard and the submission of values
@@ -34,7 +35,10 @@ const NewThemeWizard: React.FC<{
3435
} = usePageFunctions(0, initialValues);
3536

3637
// Caption of steps used by Stepper
37-
const steps = [
38+
const steps: {
39+
name: string
40+
translation: ParseKeys
41+
}[] = [
3842
{
3943
name: "generalForm",
4044
translation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",

src/components/configuration/partials/wizard/ThemeDetails.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useAppDispatch, useAppSelector } from "../../../../store";
1515
import { updateThemeDetails } from "../../../../slices/themeDetailsSlice";
1616
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
1717
import { ThemeDetailsInitialValues } from "../../../../slices/themeSlice";
18+
import { ParseKeys } from "i18next";
1819

1920
/**
2021
* This component manages the pages of the theme details
@@ -41,7 +42,12 @@ const ThemeDetails = ({
4142
};
4243

4344
// information about tabs
44-
const tabs = [
45+
const tabs: {
46+
name: string
47+
tabTranslation: ParseKeys
48+
translation: ParseKeys
49+
accessRole: string
50+
}[] = [
4551
{
4652
name: "generalForm",
4753
tabTranslation: "CONFIGURATION.THEMES.DETAILS.GENERAL.CAPTION",

src/components/events/Events.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ import {
3636
} from "../../slices/eventSlice";
3737
import EventDetailsModal from "./partials/modals/EventDetailsModal";
3838
import { showModal } from "../../selectors/eventDetailsSelectors";
39-
import { eventsLinks, loadEvents } from "./partials/EventsNavigation";
39+
import { eventsLinks } from "./partials/EventsNavigation";
4040
import { Modal, ModalHandle } from "../shared/modals/Modal";
41+
import { resetTableProperties } from "../../slices/tableSlice";
4142

4243
// References for detecting a click outside of the container of the dropdown menu
4344
const containerAction = React.createRef<HTMLDivElement>();
@@ -67,6 +68,12 @@ const Events = () => {
6768
let location = useLocation();
6869

6970
useEffect(() => {
71+
// State variable for interrupting the load function
72+
let allowLoadIntoTable = true;
73+
74+
// Clear redux of previous table data
75+
dispatch(resetTableProperties());
76+
7077
dispatch(fetchFilters("events"))
7178

7279
// Reset text filter
@@ -76,7 +83,17 @@ const Events = () => {
7683
dispatch(setShowActions(false));
7784

7885
// Load events on mount
79-
loadEvents(dispatch);
86+
const loadEvents = async () => {
87+
// Fetching events from server
88+
await dispatch(fetchEvents());
89+
90+
// Load events into table
91+
if (allowLoadIntoTable) {
92+
dispatch(loadEventsIntoTable());
93+
}
94+
}
95+
// call the function
96+
loadEvents();
8097

8198
// Function for handling clicks outside of an open dropdown menu
8299
const handleClickOutside = (e: MouseEvent) => {
@@ -89,12 +106,13 @@ const Events = () => {
89106
};
90107

91108
// Fetch events every five seconds
92-
let fetchEventsInterval = setInterval(() => loadEvents(dispatch), 5000);
109+
let fetchEventsInterval = setInterval(() => loadEvents(), 5000);
93110

94111
// Event listener for handle a click outside of dropdown menu
95112
window.addEventListener("mousedown", handleClickOutside);
96113

97114
return () => {
115+
allowLoadIntoTable = false;
98116
window.removeEventListener("mousedown", handleClickOutside);
99117
clearInterval(fetchEventsInterval);
100118
};

0 commit comments

Comments
 (0)