From 7ab5043d16c7569857fa7b02491c133e0f1381a1 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Mon, 11 Mar 2024 17:43:02 +0100 Subject: [PATCH] change(ui): widget drilldown sessions to show metadata --- .../WidgetSessions/WidgetSessions.tsx | 65 ++++++++++--------- frontend/app/mstore/types/session.ts | 2 +- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx index bb4a023a7..43ae35420 100644 --- a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx +++ b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx @@ -11,12 +11,15 @@ import useIsMounted from 'App/hooks/useIsMounted'; import AnimatedSVG, { ICONS } from 'Shared/AnimatedSVG/AnimatedSVG'; import { numberWithCommas } from 'App/utils'; import { CLICKMAP } from 'App/constants/card'; +import { connect } from 'react-redux'; interface Props { className?: string; + metaList: any; } + function WidgetSessions(props: Props) { - const { className = '' } = props; + const { className = '', metaList } = props; const [activeSeries, setActiveSeries] = useState('all'); const [data, setData] = useState([]); const isMounted = useIsMounted(); @@ -35,7 +38,7 @@ function WidgetSessions(props: Props) { if (!data) return; const seriesOptions = data.map((item: any) => ({ label: item.seriesName, - value: item.seriesId, + value: item.seriesId })); setSeriesOptions([{ label: 'All', value: 'all' }, ...seriesOptions]); }, [data]); @@ -71,17 +74,17 @@ function WidgetSessions(props: Props) { operator: 'onSelector', isEvent: true, // @ts-ignore - filters: [], + filters: [] }; const timeRange = { rangeValue: dashboardStore.drillDownPeriod.rangeValue, startDate: dashboardStore.drillDownPeriod.start, - endDate: dashboardStore.drillDownPeriod.end, + endDate: dashboardStore.drillDownPeriod.end }; const customFilter = { ...filter, ...timeRange, - filters: [...sessionStore.userFilter.filters, clickFilter], + filters: [...sessionStore.userFilter.filters, clickFilter] }; debounceClickMapSearch(customFilter); } else { @@ -89,7 +92,7 @@ function WidgetSessions(props: Props) { ...filter, series: widget.series.map((s) => s.toJson()), page: metricStore.sessionsPage, - limit: metricStore.sessionsPageSize, + limit: metricStore.sessionsPageSize }); } }; @@ -102,46 +105,46 @@ function WidgetSessions(props: Props) { filter.filters, depsString, metricStore.clickMapSearch, - activeSeries, + activeSeries ]); useEffect(loadData, [metricStore.sessionsPage]); const clearFilters = () => { metricStore.updateKey('sessionsPage', 1); dashboardStore.resetDrillDownFilter(); - } + }; return (
-
-
-

{metricStore.clickMapSearch ? 'Clicks' : 'Sessions'}

-
+
+
+

{metricStore.clickMapSearch ? 'Clicks' : 'Sessions'}

+
{metricStore.clickMapLabel ? `on "${metricStore.clickMapLabel}" ` : null} - between {startTime} and{' '} - {endTime}{' '} + between {startTime} and{' '} + {endTime}{' '}
-
- {hasFilters && } +
+ {hasFilters && } {widget.metricType !== 'table' && widget.metricType !== CLICKMAP && ( -
- Filter by Series +
+ Filter by Series