From d50d63ba7e331c7fd7eab50ff6e41f02ebc24966 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Tue, 12 Apr 2022 17:37:06 +0200 Subject: [PATCH] change(ui) - assist filter box --- .../BugFinder/SessionList/SessionList.js | 1 - .../WidgetPreview/WidgetPreview.tsx | 16 +++++------- .../WidgetSessions/WidgetSessions.tsx | 16 ++++++++---- .../LiveSessionSearch/LiveSessionSearch.tsx | 25 +++++++++++-------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/frontend/app/components/BugFinder/SessionList/SessionList.js b/frontend/app/components/BugFinder/SessionList/SessionList.js index 938f15b30..64bf722f4 100644 --- a/frontend/app/components/BugFinder/SessionList/SessionList.js +++ b/frontend/app/components/BugFinder/SessionList/SessionList.js @@ -74,7 +74,6 @@ export default class SessionList extends React.PureComponent { componentDidMount() { const { scrollY } = this.props; - console.log('scrollY', scrollY); window.scrollTo(0, scrollY); } diff --git a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx index 4ec8a63e2..24bfdcbd8 100644 --- a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx +++ b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx @@ -11,7 +11,8 @@ interface Props { } function WidgetPreview(props: Props) { const { className = '' } = props; - const { metricStore } = useStore(); + const { metricStore, dashboardStore } = useStore(); + const period = useObserver(() => dashboardStore.period); const metric: any = useObserver(() => metricStore.instance); const isTimeSeries = metric.metricType === 'timeseries'; const isTable = metric.metricType === 'table'; @@ -20,11 +21,6 @@ function WidgetPreview(props: Props) { metric.update({ [ name ]: value }); } - const onDateChange = (changedDates) => { - // setPeriod({ ...changedDates, rangeName: changedDates.rangeValue }) - metric.update({ ...changedDates, rangeName: changedDates.rangeValue }); - } - return useObserver(() => (
@@ -68,10 +64,10 @@ function WidgetPreview(props: Props) {
Time Range dashboardStore.setPeriod(period)} customRangeRight direction="left" /> diff --git a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx index 978fad1fb..0ceace3c2 100644 --- a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx +++ b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx @@ -3,20 +3,26 @@ import { NoContent } from 'UI'; import cn from 'classnames'; import { useStore } from 'App/mstore'; import SessionItem from 'Shared/SessionItem'; - +import { useObserver } from 'mobx-react-lite'; +import { DateTime } from 'luxon'; interface Props { className?: string; } function WidgetSessions(props: Props) { const { className = '' } = props; const { dashboardStore } = useStore(); + const period = useObserver(() => dashboardStore.period); const widget = dashboardStore.currentWidget; - return ( + const range = period.toTimestamps() + const startTime = DateTime.fromMillis(range.startTimestamp).toFormat('LLL dd, yyyy HH:mm a'); + const endTime = DateTime.fromMillis(range.endTimestamp).toFormat('LLL dd, yyyy HH:mm a'); + + return useObserver(() => (
-
+

Sessions

- {/*
Showing all sessions between {startTime} and {endTime}
*/} +
between {startTime} and {endTime}
@@ -31,7 +37,7 @@ function WidgetSessions(props: Props) {
- ); + )); } export default WidgetSessions; \ No newline at end of file diff --git a/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx b/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx index 5f6e5f7cc..cc3fef487 100644 --- a/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx +++ b/frontend/app/components/shared/LiveSessionSearch/LiveSessionSearch.tsx @@ -4,9 +4,9 @@ import { connect } from 'react-redux'; import { edit, addFilter, addFilterByKeyAndValue } from 'Duck/liveSearch'; import FilterSelection from 'Shared/Filters/FilterSelection'; import { IconButton } from 'UI'; -import { FilterKey } from 'App/types/filter/filterType'; interface Props { + list: any, appliedFilter: any; edit: typeof edit; addFilter: typeof addFilter; @@ -53,16 +53,18 @@ function LiveSessionSearch(props: Props) { }); } - return ( + return props.list.size > 0 ? (
-
- -
+ { hasEvents || hasFilters && ( +
+ +
+ )}
@@ -75,9 +77,10 @@ function LiveSessionSearch(props: Props) {
- ); + ) : <>; } export default connect(state => ({ appliedFilter: state.getIn([ 'liveSearch', 'instance' ]), + list: state.getIn(['sessions', 'liveSessions']), }), { edit, addFilter, addFilterByKeyAndValue })(LiveSessionSearch); \ No newline at end of file