From ea4e4157fd8e79e320bdeef5963103042286fdb1 Mon Sep 17 00:00:00 2001 From: TzeYiing Date: Tue, 29 Mar 2022 19:57:15 +0200 Subject: [PATCH] use Histogram button for toggling event chart --- .../interfaces/Settings/Logs/LogTable.tsx | 18 +++++++++++++----- .../Settings/Logs/LogsNavigation.tsx | 4 ++-- .../interfaces/Settings/Logs/LogsPreviewer.tsx | 9 ++++++--- .../Settings/Logs/PreviewFilterPanel.tsx | 15 --------------- studio/tests/pages/projects/LogTable.test.js | 10 +++++++++- .../tests/pages/projects/LogsPreviewer.test.js | 2 +- .../pages/projects/PreviewFilterPanel.test.js | 11 ----------- 7 files changed, 31 insertions(+), 38 deletions(-) diff --git a/studio/components/interfaces/Settings/Logs/LogTable.tsx b/studio/components/interfaces/Settings/Logs/LogTable.tsx index 454ec5fbbca..76a51f7c79a 100644 --- a/studio/components/interfaces/Settings/Logs/LogTable.tsx +++ b/studio/components/interfaces/Settings/Logs/LogTable.tsx @@ -1,6 +1,6 @@ import dayjs from 'dayjs' import { useEffect, useState, useMemo } from 'react' -import { Button, IconDownloadCloud, IconEye, Typography } from '@supabase/ui' +import { Button, IconDownloadCloud, IconEye, IconEyeOff, Typography } from '@supabase/ui' import DataGrid from '@supabase/react-data-grid' import LogSelection from './LogSelection' @@ -14,6 +14,8 @@ import DatabasePostgresColumnRender from './LogColumnRenderers/DatabasePostgresC interface Props { data?: Array queryType?: QueryType + onHistogramToggle?: () => void + isHistogramShowing?: boolean } type LogMap = { [id: string]: LogData } @@ -22,7 +24,7 @@ type LogMap = { [id: string]: LogData } * * When in custom data display mode, the side panel will not open when focusing on logs. */ -const LogTable = ({ data = [], queryType }: Props) => { +const LogTable = ({ data = [], queryType, onHistogramToggle, isHistogramShowing }: Props) => { const [focusedLog, setFocusedLog] = useState(null) const columnNames = Object.keys(data[0] || {}) const hasId = columnNames.includes('id') @@ -210,9 +212,15 @@ const LogTable = ({ data = [], queryType }: Props) => { )}
- + {onHistogramToggle && ( + + )} diff --git a/studio/components/interfaces/Settings/Logs/LogsNavigation.tsx b/studio/components/interfaces/Settings/Logs/LogsNavigation.tsx index 90fa8efb03f..cf57350913a 100644 --- a/studio/components/interfaces/Settings/Logs/LogsNavigation.tsx +++ b/studio/components/interfaces/Settings/Logs/LogsNavigation.tsx @@ -14,9 +14,9 @@ const LogsNavigation = () => { type="underlined" size="medium" activeId={!activeRoute ? indexRoute : activeRoute} - onChange={(e: string) => + onClick={(e: string) => { router.push(`/project/${ref}/logs-explorer/${e === indexRoute ? '' : e}`) - } + }} > diff --git a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx index a6abb86e153..55d7a3004b4 100644 --- a/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx +++ b/studio/components/interfaces/Settings/Logs/LogsPreviewer.tsx @@ -134,8 +134,6 @@ export const LogsPreviewer: React.FC = ({ projectRef, queryType, override return (
setShowChart(!showChart)} isLoading={isLoading} newCount={newCount} templates={TEMPLATES.filter( @@ -183,7 +181,12 @@ export const LogsPreviewer: React.FC = ({ projectRef, queryType, override
- + setShowChart(!showChart)} + />
-
- -