Skip to content

Commit 0b8ed1f

Browse files
authored
Merge pull request #1021 from Arnei/fix-active-wf-notification
Fix notification display in event metadata tab
2 parents 7f69bdb + 201faaf commit 0b8ed1f

20 files changed

Lines changed: 57 additions & 33 deletions

src/components/configuration/Themes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const Themes = () => {
114114

115115
<MainView open={displayNavigation}>
116116
{/* Include notifications component */}
117-
<Notifications />
117+
<Notifications context={"other"}/>
118118

119119
<div className="controls-container">
120120
{/* Include filters component */}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const GeneralPage = <T,>({
3535
<div className="full-col">
3636
<div className="form-container">
3737
<div className="row">
38-
<Notifications />
38+
<Notifications context={"other"}/>
3939
<label className="required" style={isEdit ? editStyle: undefined}>
4040
{t("CONFIGURATION.THEMES.DETAILS.GENERAL.NAME")}
4141
</label>

src/components/events/Events.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const Events = () => {
269269

270270
<MainView open={displayNavigation}>
271271
{/* Include notifications component */}
272-
<Notifications />
272+
<Notifications context={"other"}/>
273273

274274
<div className="controls-container">
275275
<div className="filters-container">

src/components/events/Series.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const Series = () => {
196196

197197
<MainView open={displayNavigation}>
198198
{/* Include notifications component */}
199-
<Notifications />
199+
<Notifications context={"other"}/>
200200

201201
<div className="controls-container">
202202
<div className="filters-container">

src/components/events/partials/ModalTabsAndPages/EventDetailsCommentsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const EventDetailsCommentsTab = ({
111111
return (
112112
<div className="modal-content">
113113
<div className="modal-body">
114-
<Notifications context="not-corner" />
114+
<Notifications context="not_corner" />
115115
<div className="full-col">
116116
<div className="obj comments">
117117
<header>{t(header)}</header>

src/components/events/partials/ModalTabsAndPages/EventDetailsPublicationTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const EventDetailsPublicationTab = ({
3030
<>
3131
<div className="modal-content">
3232
<div className="modal-body">
33-
<Notifications />
33+
<Notifications context={"other"}/>
3434
<div className="full-col">
3535
<div className="obj list-obj">
3636
<header>{t("EVENTS.EVENTS.DETAILS.PUBLICATIONS.CAPTION")}</header>

src/components/events/partials/modals/EventDetails.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ import {
4141
fetchEventStatistics,
4242
openModalTab,
4343
fetchEventDetailsTobira,
44+
fetchHasActiveTransactions,
4445
} from "../../../../slices/eventDetailsSlice";
45-
import { removeNotificationWizardForm } from "../../../../slices/notificationSlice";
46+
import { addNotification, removeNotificationByKey, removeNotificationWizardForm } from "../../../../slices/notificationSlice";
4647
import DetailsTobiraTab from "../ModalTabsAndPages/DetailsTobiraTab";
48+
import { NOTIFICATION_CONTEXT } from "../../../../configs/modalConfig";
49+
import { unwrapResult } from "@reduxjs/toolkit";
4750

4851
export enum EventDetailsPage {
4952
Metadata,
@@ -84,6 +87,32 @@ const EventDetails = ({
8487
dispatch(fetchSchedulingInfo(eventId));
8588
dispatch(fetchEventStatistics(eventId));
8689
dispatch(fetchAssetUploadOptions());
90+
91+
dispatch(fetchHasActiveTransactions(eventId)).then((fetchTransactionResult) => {
92+
const result = unwrapResult(fetchTransactionResult)
93+
if (result.active !== undefined && result.active) {
94+
dispatch(
95+
addNotification({
96+
type: "warning",
97+
key: "ACTIVE_TRANSACTION",
98+
duration: -1,
99+
parameter: undefined,
100+
context: NOTIFICATION_CONTEXT,
101+
noDuplicates: true
102+
})
103+
)
104+
}
105+
if (result.active !== undefined && !result.active) {
106+
dispatch(
107+
removeNotificationByKey({
108+
key: "ACTIVE_TRANSACTION",
109+
context: NOTIFICATION_CONTEXT
110+
})
111+
)
112+
}
113+
});
114+
115+
87116
dispatch(fetchEventDetailsTobira(eventId));
88117
// eslint-disable-next-line react-hooks/exhaustive-deps
89118
}, []);

src/components/recordings/Recordings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const Recordings = () => {
8080

8181
<MainView open={displayNavigation}>
8282
{/* Include notifications component */}
83-
<Notifications />
83+
<Notifications context={"other"}/>
8484

8585
<div className="controls-container">
8686
{/* Include filters component */}

src/components/shared/Notifications.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ import {
1313
import { useAppDispatch, useAppSelector } from "../../store";
1414
import { OurNotification, setHidden } from "../../slices/notificationSlice";
1515

16+
type Context = "not_corner" | "tobira" | "above_table" | "other"
17+
1618
/**
1719
* This component renders notifications about occurred errors, warnings and info
1820
*/
19-
const Notifications : React.FC<{ context?: string }> = ({ context }) => {
21+
const Notifications = ({
22+
context,
23+
}: {
24+
context: Context,
25+
}) => {
2026
const { t } = useTranslation();
2127
const dispatch = useAppDispatch();
2228

src/components/shared/modals/ResourceDetailsAccessPolicyTab.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ const ResourceDetailsAccessPolicyTab = ({
106106
key: "ACTIVE_TRANSACTION",
107107
duration: -1,
108108
parameter: undefined,
109-
context: NOTIFICATION_CONTEXT
109+
context: NOTIFICATION_CONTEXT,
110+
noDuplicates: true,
110111
}));
111112
}
112113
}

0 commit comments

Comments
 (0)