From 9ff3b2f017173e4cc38c7f408bb634bd5db6cc6d Mon Sep 17 00:00:00 2001 From: sylenien Date: Mon, 26 Dec 2022 15:14:21 +0100 Subject: [PATCH] change(ui): fix labels, small refactoring --- .../components/WidgetPreview/WidgetPreview.tsx | 17 +++-------------- .../WidgetSessions/WidgetSessions.tsx | 4 +--- frontend/app/duck/user.js | 5 ----- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx index 8ed5df9f4..3bbc1c022 100644 --- a/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx +++ b/frontend/app/components/Dashboard/components/WidgetPreview/WidgetPreview.tsx @@ -22,23 +22,12 @@ function WidgetPreview(props: Props) { const metric: any = metricStore.instance; const isTimeSeries = metric.metricType === TIMESERIES; const isTable = metric.metricType === TABLE; - const drillDownFilter = dashboardStore.drillDownFilter; const disableVisualization = metric.metricOf === FilterKey.SESSIONS || metric.metricOf === FilterKey.ERRORS; - // const period = dashboardStore.drillDownPeriod; - const chagneViewType = (e, { name, value }: any) => { + const changeViewType = (_, { name, value }: any) => { metric.update({ [ name ]: value }); } - // const onChangePeriod = (period: any) => { - // dashboardStore.setDrillDownPeriod(period); - // const periodTimestamps = period.toTimestamps(); - // drillDownFilter.merge({ - // startTimestamp: periodTimestamps.startTimestamp, - // endTimestamp: periodTimestamps.endTimestamp, - // }) - // } - const canAddToDashboard = metric.exists() && dashboards.length > 0; return ( @@ -57,7 +46,7 @@ function WidgetPreview(props: Props) { className="my-3" primary icons={true} - onSelect={ chagneViewType } + onSelect={ changeViewType } value={{ value: metric.viewType }} list={ [ { value: 'lineChart', name: 'Chart', icon: 'graph-up-arrow' }, @@ -75,7 +64,7 @@ function WidgetPreview(props: Props) { className="my-3" primary={true} icons={true} - onSelect={ chagneViewType } + onSelect={ changeViewType } value={{ value: metric.viewType }} list={[ { value: 'table', name: 'Table', icon: 'table' }, diff --git a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx index 316bb55e9..ebb07b49c 100644 --- a/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx +++ b/frontend/app/components/Dashboard/components/WidgetSessions/WidgetSessions.tsx @@ -90,15 +90,13 @@ function WidgetSessions(props: Props) { } }, [filter.startTimestamp, filter.endTimestamp, filter.filters, depsString, metricStore.sessionsPage, metricStore.clickMapSearch]); - - return (

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

- {metricStore.clickMapLabel ? `"${metricStore.clickMapLabel}" ` : null} + {metricStore.clickMapLabel ? `on "${metricStore.clickMapLabel}" ` : null} between {startTime} and{' '} {endTime}{' '}
diff --git a/frontend/app/duck/user.js b/frontend/app/duck/user.js index 1420cae45..b5c076088 100644 --- a/frontend/app/duck/user.js +++ b/frontend/app/duck/user.js @@ -21,7 +21,6 @@ const PUSH_NEW_SITE = 'user/PUSH_NEW_SITE'; const SET_ONBOARDING = 'user/SET_ONBOARDING'; const initialState = Map({ - // client: Client(), account: Account(), siteId: null, passwordRequestError: false, @@ -121,10 +120,6 @@ export const fetchUserInfo = () => dispatch => Promise.all([ types: FETCH_ACCOUNT.toArray(), call: client => client.get('/account'), }), - // dispatch({ - // types: FETCH_CLIENT.toArray(), - // call: client => client.get('/client'), - // }), ]); export function logout() {