Skip to content

Commit 9ea77b3

Browse files
Merge pull request #1298 from Arnei/metadata-saved-notification
Add "Metadata saved" notification
2 parents dfa50cf + 3decb73 commit 9ea77b3

3 files changed

Lines changed: 23 additions & 8 deletions

File tree

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import RenderDate from "../../../shared/RenderDate";
1818
import WizardNavigationButtons from "../../../shared/wizard/WizardNavigationButtons";
1919
import { ParseKeys } from "i18next";
2020
import ModalContentTable from "../../../shared/modals/ModalContentTable";
21+
import { addNotification } from "../../../../slices/notificationSlice";
22+
import { NOTIFICATION_CONTEXT } from "../../../../configs/modalConfig";
2123

2224
type InitialValues = {
2325
[key: string]: string | string[];
@@ -51,7 +53,24 @@ const DetailsMetadataTab = ({
5153
const user = useAppSelector(state => getUserInformation(state));
5254

5355
const handleSubmit = (values: { [key: string]: any }, catalog: MetadataCatalog) => {
54-
dispatch(updateResource({ id: resourceId, values, catalog }));
56+
dispatch(updateResource({ id: resourceId, values, catalog }))
57+
.unwrap()
58+
.then(() => {
59+
dispatch(addNotification({
60+
type: "info",
61+
key: "METADATA_SAVED",
62+
duration: 3,
63+
context: NOTIFICATION_CONTEXT,
64+
}));
65+
})
66+
.catch(() => {
67+
dispatch(addNotification({
68+
type: "warning",
69+
key: "METADATA_NOT_SAVED",
70+
duration: 3,
71+
context: NOTIFICATION_CONTEXT,
72+
}));
73+
});
5574
};
5675

5776
// set current values of metadata fields as initial values

src/i18n/org/opencastproject/adminui/languages/lang-en_US.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@
210210
"SERIES_THEME_REPROCESS_EXISTING_EVENTS": "The existing events in this series will need to be reprocessed",
211211
"SERIES_ACL_LOCKED": "Editing Access Policies is not allowed when operations are running on an event that is part of the series",
212212
"EVENT_ACL_MISSING_READWRITE_ROLE": "The Access Policy requires at least one role with Read and Write permissions.",
213+
"METADATA_SAVED": "The metadata has been saved.",
214+
"METADATA_NOT_SAVED": "The metadata has NOT been saved!",
213215
"THEME_NAME_EMPTY": "The name cannot be empty",
214216
"BUMPER_UPLOAD_ERROR": "Error while uploading media",
215217
"THEME_CREATED": "The theme has been created",

src/slices/eventDetailsSlice.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,13 +2465,7 @@ const eventDetailsSlice = createSlice({
24652465
state.errorStatisticsValue = action.error;
24662466
console.error(action.error);
24672467
})
2468-
.addCase(updateMetadata.rejected, (_state, action) => {
2469-
console.error(action.error);
2470-
})
2471-
.addCase(updateExtendedMetadata.rejected, (_state, action) => {
2472-
console.error(action.error);
2473-
})
2474-
.addCase(fetchHasActiveTransactions.rejected, (_state, action) => {
2468+
.addCase(fetchHasActiveTransactions.rejected, (state, action) => {
24752469
console.error(action.error);
24762470
})
24772471
.addCase(deleteComment.rejected, (_state, action) => {

0 commit comments

Comments
 (0)