Skip to content

Commit 77c6686

Browse files
* Squashed commit of the following: commit e613216 Author: Boris Kovar <boris.kovar@m2ms.sk> Date: Wed Jul 31 13:57:02 2024 +0200 - implemented #1251 * #1482 added TagName and CentroidRes columns for expanded view of observation dialog * #1489 show warning toast message if is defined on target load --------- Co-authored-by: matej <matej.vavrek@m2ms.sk>
1 parent 261e109 commit 77c6686

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

js/components/preview/TASPreview.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React, { memo, useEffect } from 'react';
1+
import React, { memo, useContext, useEffect } from 'react';
22
import { useDispatch, useSelector } from 'react-redux';
33
import { useHistory, useRouteMatch } from 'react-router-dom';
44
import { URLS } from '../routes/constants';
55
import { setCurrentProject, setOpenPickProjectModal } from '../target/redux/actions';
66
import Preview from './Preview';
77
import { getProjectForProjectName, getProjectsForSelectedTarget } from './redux/dispatchActions';
88
import { extractProjectFromURLParam } from './utils';
9+
import { ToastContext } from '../toast';
10+
import { DJANGO_CONTEXT } from '../../utils/djangoContext';
911

1012
export const TASPreview = memo(props => {
1113
let match = useRouteMatch();
@@ -17,6 +19,8 @@ export const TASPreview = memo(props => {
1719
const targetList = useSelector(state => state.apiReducers.target_id_list);
1820
const projectsLoaded = useSelector(state => state.targetReducers.projectsLoaded);
1921

22+
const { toastWarning } = useContext(ToastContext);
23+
2024
useEffect(() => {
2125
let project = null;
2226
if (
@@ -49,5 +53,11 @@ export const TASPreview = memo(props => {
4953
}
5054
}, [dispatch, currentPorject, match, history, currentTarget, targetList, projectsLoaded]);
5155

56+
useEffect(() => {
57+
if (DJANGO_CONTEXT.target_warning_message && DJANGO_CONTEXT.target_warning_message.length > 0) {
58+
toastWarning(DJANGO_CONTEXT.target_warning_message);
59+
}
60+
}, [toastWarning]);
61+
5262
return <Preview isStateLoaded={false} hideProjects={true} {...props} />;
5363
});

0 commit comments

Comments
 (0)