diff --git a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx index 8279336eea..95e535dad7 100644 --- a/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx +++ b/frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx @@ -75,7 +75,6 @@ function HostMetricsLogs({ timeRange, filters }: Props): JSX.Element { const getItemContent = useCallback( (_: number, logToRender: ILog): JSX.Element => (
( + (state) => state.globalTime, + ); const { notifications } = useNotifications(); @@ -119,6 +133,21 @@ function LogDetail({ }); }; + // Go to logs explorer page with the log data + const handleOpenInExplorer = (): void => { + urlQuery.set(QueryParams.activeLogId, `"${log?.id}"`); + urlQuery.set(QueryParams.startTime, minTime?.toString() || ''); + urlQuery.set(QueryParams.endTime, maxTime?.toString() || ''); + safeNavigate(`${ROUTES.LOGS_EXPLORER}?${urlQuery.toString()}`); + }; + + // Only show when opened from infra monitoring page + const showOpenInExplorerBtn = useMemo( + () => location.pathname?.includes('/infrastructure-monitoring'), + // eslint-disable-next-line react-hooks/exhaustive-deps + [], + ); + if (!log) { // eslint-disable-next-line react/jsx-no-useless-fragment return <>; @@ -131,10 +160,23 @@ function LogDetail({ width="60%" maskStyle={{ background: 'none' }} title={ - <> - - Log details - +
+
+ + Log details +
+ {showOpenInExplorerBtn && ( +
+ +
+ )} +
} placement="right" // closable diff --git a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx index 919559c795..1bb45b251f 100644 --- a/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx +++ b/frontend/src/container/InfraMonitoringK8s/EntityDetailsUtils/EntityLogs/EntityLogs.tsx @@ -65,7 +65,6 @@ function EntityLogs({ const getItemContent = useCallback( (_: number, logToRender: ILog): JSX.Element => ( ({ softMin: null, minTimeScale: timeRange.startTime, maxTimeScale: timeRange.endTime, + enableZoom: true, }); }), [ @@ -162,7 +163,7 @@ function EntityMetrics({
uPlot.Series[]; isLogScale?: boolean; colorMapping?: Record; + enableZoom?: boolean; } /** the function converts series A , series B , series C to @@ -168,6 +169,7 @@ export const getUPlotChartOptions = ({ customSeries, isLogScale, colorMapping, + enableZoom, }: GetUPlotChartOptions): uPlot.Options => { const timeScaleProps = getXAxisScale(minTimeScale, maxTimeScale); @@ -205,7 +207,25 @@ export const getUPlotChartOptions = ({ `${u.series[seriesIdx].points.stroke(u, seriesIdx)}90`, fill: (): string => '#fff', }, + ...(enableZoom + ? { + drag: { + x: true, + y: true, + }, + focus: { + prox: 30, + }, + } + : {}), }, + ...(enableZoom + ? { + select: { + show: true, + }, + } + : {}), tzDate, padding: [16, 16, 8, 8], bands,