diff --git a/openbas-front/src/admin/components/atomic_testings/atomic_testing/TargetResultsDetail.tsx b/openbas-front/src/admin/components/atomic_testings/atomic_testing/TargetResultsDetail.tsx index deeceb6bf6..cd30ef0b7e 100644 --- a/openbas-front/src/admin/components/atomic_testings/atomic_testing/TargetResultsDetail.tsx +++ b/openbas-front/src/admin/components/atomic_testings/atomic_testing/TargetResultsDetail.tsx @@ -14,6 +14,7 @@ import nodeTypes from './types/nodes'; import useAutoLayout, { type LayoutOptions } from '../../../../utils/flows/useAutoLayout'; import { InjectResultDtoContext, InjectResultDtoContextType } from '../InjectResultDtoContext'; import ItemResult from '../../../../components/ItemResult'; +import InjectIcon from '../../common/injects/InjectIcon'; interface Steptarget { label: string; @@ -49,6 +50,7 @@ interface Props { const TargetResultsDetailFlow: FunctionComponent = ({ injectId, + injectType, lastExecutionStartDate, lastExecutionEndDate, target, @@ -229,11 +231,18 @@ const TargetResultsDetailFlow: FunctionComponent = ({ result.inject_expectation_results.map((collector, index) => (
- {collector.sourceId} + {collector.sourceId != null + ? ({collector.sourceId}) : ( + ) + } {collector.sourceName} diff --git a/openbas-front/src/admin/components/common/articles/Articles.tsx b/openbas-front/src/admin/components/common/articles/Articles.tsx index ce8d8e9100..8736031ac4 100644 --- a/openbas-front/src/admin/components/common/articles/Articles.tsx +++ b/openbas-front/src/admin/components/common/articles/Articles.tsx @@ -23,6 +23,7 @@ import CreateArticle from './CreateArticle'; import type { ChannelsHelper } from '../../../../actions/channels/channel-helper'; import { ArticleContext, PermissionsContext } from '../Context'; import Empty from '../../../../components/Empty'; +import ChannelColor from '../../../../public/components/channels/ChannelColor'; const useStyles = makeStyles(() => ({ channel: { @@ -92,18 +93,6 @@ const Articles: FunctionComponent = ({ articles }) => { || channels.map((o) => o.id).includes(n.article_fullchannel.channel_id ?? ''), filtering.filterAndSort(fullArticles), ); - const channelColor = (type: string | undefined) => { - switch (type) { - case 'newspaper': - return '#3f51b5'; - case 'microblogging': - return '#00bcd4'; - case 'tv': - return '#ff9800'; - default: - return '#ef41e1'; - } - }; // Context const { previewArticleUrl } = useContext(ArticleContext); @@ -180,7 +169,7 @@ const Articles: FunctionComponent = ({ articles }) => { avatar={ = ({ articles }) => { } classes={{ root: classes.channel }} style={{ - color: channelColor( + color: ChannelColor( article.article_fullchannel?.channel_type, ), - borderColor: channelColor( + borderColor: ChannelColor( article.article_fullchannel?.channel_type, ), }} diff --git a/openbas-front/src/public/components/challenges/ChallengesPlayer.js b/openbas-front/src/public/components/challenges/ChallengesPlayer.js index a91dd02101..22391db7b0 100644 --- a/openbas-front/src/public/components/challenges/ChallengesPlayer.js +++ b/openbas-front/src/public/components/challenges/ChallengesPlayer.js @@ -260,7 +260,7 @@ const ChallengesPlayer = () => { color="primary" variant="outlined" component={Link} - to={`/admin/exercises/${exerciseId}/definition/challenges`} + to={`/admin/exercises/${exerciseId}/definition`} style={{ position: 'absolute', top: 20, left: 20 }} > {t('Back to administration')} diff --git a/openbas-front/src/public/components/channels/ChannelColor.tsx b/openbas-front/src/public/components/channels/ChannelColor.tsx new file mode 100644 index 0000000000..f60637c43c --- /dev/null +++ b/openbas-front/src/public/components/channels/ChannelColor.tsx @@ -0,0 +1,14 @@ +const ChannelColor = (type: string | undefined) => { + switch (type) { + case 'newspaper': + return '#3f51b5'; + case 'microblogging': + return '#00bcd4'; + case 'tv': + return '#ff9800'; + default: + return '#ef41e1'; + } +}; + +export default ChannelColor; diff --git a/openbas-front/src/public/components/channels/ChannelNewspaper.js b/openbas-front/src/public/components/channels/ChannelNewspaper.js index c056a1b1e5..12b0b89b1d 100644 --- a/openbas-front/src/public/components/channels/ChannelNewspaper.js +++ b/openbas-front/src/public/components/channels/ChannelNewspaper.js @@ -82,18 +82,18 @@ const ChannelNewspaper = ({ channelReader }) => {
)} {channel.channel_mode !== 'logo' && ( - - {channel.channel_name} - + + {channel.channel_name} + )} { color="primary" variant="outlined" component={Link} - to={`/admin/exercises/${exerciseId}/definition/channel`} + to={`/admin/exercises/${exerciseId}/definition`} style={{ position: 'absolute', top: 20, left: 20 }} > {t('Back to administration')} diff --git a/openbas-front/src/public/components/lessons/LessonsPlayer.js b/openbas-front/src/public/components/lessons/LessonsPlayer.js index d63386547c..8df9e495f7 100644 --- a/openbas-front/src/public/components/lessons/LessonsPlayer.js +++ b/openbas-front/src/public/components/lessons/LessonsPlayer.js @@ -148,7 +148,7 @@ const LessonsPlayer = () => { color="primary" variant="outlined" component={Link} - to={`/admin/exercises/${exerciseId}/results/lessons`} + to={`/admin/exercises/${exerciseId}/lessons`} style={{ position: 'absolute', top: 20, left: 20 }} > {t('Back to administration')} diff --git a/openbas-front/src/utils/hooks/useDataLoader.js b/openbas-front/src/utils/hooks/useDataLoader.js index 9a7141f5d7..bd58abf332 100644 --- a/openbas-front/src/utils/hooks/useDataLoader.js +++ b/openbas-front/src/utils/hooks/useDataLoader.js @@ -25,7 +25,9 @@ const useDataLoader = (loader = () => {}) => { const current = new Date().getTime(); if (current - lastPingDate > EVENT_PING_MAX_TIME) { clearInterval(autoReConnect); - sseClient.close(); + if (sseClient != null) { + sseClient.close(); + } sseConnect(); } }, EVENT_TRY_DELAY); @@ -56,7 +58,9 @@ const useDataLoader = (loader = () => {}) => { }); sseClient.onerror = () => { clearInterval(autoReConnect); - sseClient.close(); + if (sseClient != null) { + sseClient.close(); + } const timeFromLastPingDate = new Date().getTime() - lastPingDate; if (timeFromLastPingDate < ERROR_30S_MAX_TIME) { setTimeout(sseConnect, ERROR_500MS_DELAY);// Before 30s time to retry is 500ms