From 3bc527aeeec9911fa31f255b3338abde6ed28a51 Mon Sep 17 00:00:00 2001 From: Mateusz Wisniewski Date: Tue, 19 Mar 2024 14:42:28 +0100 Subject: [PATCH] fix: navigate to logs of pod (#2833) * fix: navigate to pod logs * fix: lint --- src/resources/Pods/ContainersData.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/resources/Pods/ContainersData.js b/src/resources/Pods/ContainersData.js index 8754d33fb4..d587d70871 100644 --- a/src/resources/Pods/ContainersData.js +++ b/src/resources/Pods/ContainersData.js @@ -1,4 +1,3 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; @@ -8,6 +7,8 @@ import { LayoutPanelRow } from 'shared/components/LayoutPanelRow/LayoutPanelRow' import { ContainerStatus } from './ContainerStatus'; import { getPorts } from 'shared/components/GetContainersPorts'; import { UI5Panel } from 'shared/components/UI5Panel/UI5Panel'; +import { useSetRecoilState } from 'recoil'; +import { columnLayoutState } from 'state/columnLayoutAtom'; ContainersData.propTypes = { containers: PropTypes.arrayOf(PropTypes.object).isRequired, @@ -16,6 +17,7 @@ ContainersData.propTypes = { export default function ContainersData({ type, containers, statuses }) { const { t } = useTranslation(); const navigate = useNavigate(); + const setLayout = useSetRecoilState(columnLayoutState); const ContainerComponent = ({ container, status }) => ( { - navigate(`containers/${container.name}`, { replace: true }); + setLayout({ + midColumn: null, + endColumn: null, + layout: 'OneColumn', + }); + navigate( + `${window.location.pathname.replace( + window.location.search, + '', + )}/containers/${container.name}`, + ); }} > {t('pods.buttons.view-logs')}