From 8d54e3b766466c0991ef75688a6775aa557069d5 Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Fri, 13 Sep 2024 13:41:55 +0530 Subject: [PATCH 01/66] fix: dashboard list page showing older data (#5961) --- .../src/container/ListOfDashboard/DashboardsList.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/container/ListOfDashboard/DashboardsList.tsx b/frontend/src/container/ListOfDashboard/DashboardsList.tsx index 421c7e31c4..c131119a6c 100644 --- a/frontend/src/container/ListOfDashboard/DashboardsList.tsx +++ b/frontend/src/container/ListOfDashboard/DashboardsList.tsx @@ -91,6 +91,7 @@ function DashboardsList(): JSX.Element { const { data: dashboardListResponse, isLoading: isDashboardListLoading, + isRefetching: isDashboardListRefetching, error: dashboardFetchError, refetch: refetchDashboardList, } = useGetAllDashboard(); @@ -703,7 +704,9 @@ function DashboardsList(): JSX.Element { - {isDashboardListLoading || isFilteringDashboards ? ( + {isDashboardListLoading || + isFilteringDashboards || + isDashboardListRefetching ? (
@@ -902,7 +905,11 @@ function DashboardsList(): JSX.Element { columns={columns} dataSource={data} showSorterTooltip - loading={isDashboardListLoading || isFilteringDashboards} + loading={ + isDashboardListLoading || + isFilteringDashboards || + isDashboardListRefetching + } showHeader={false} pagination={paginationConfig} /> From 6661aa76864da1be5edb535a1ec0deeaad147d4b Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Fri, 13 Sep 2024 13:43:40 +0530 Subject: [PATCH 02/66] chore: update the filter in / filter out operators (#5923) * chore: update the filter in / filter out operators * fix: handle cases for old logs explorer --- frontend/src/components/Logs/AddToQueryHOC.tsx | 2 +- .../src/container/LogDetailedView/TableView.tsx | 4 ++-- .../TableView/TableViewActions.tsx | 8 ++++++-- frontend/src/container/LogDetailedView/index.tsx | 7 +++++-- frontend/src/hooks/logs/useActiveLog.ts | 15 +++++++++++++-- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Logs/AddToQueryHOC.tsx b/frontend/src/components/Logs/AddToQueryHOC.tsx index df222b7552..d7e2c7156e 100644 --- a/frontend/src/components/Logs/AddToQueryHOC.tsx +++ b/frontend/src/components/Logs/AddToQueryHOC.tsx @@ -15,7 +15,7 @@ function AddToQueryHOC({ }: AddToQueryHOCProps): JSX.Element { const handleQueryAdd = (event: MouseEvent): void => { event.stopPropagation(); - onAddToQuery(fieldKey, fieldValue, OPERATORS.IN); + onAddToQuery(fieldKey, fieldValue, OPERATORS['=']); }; const popOverContent = useMemo(() => Add to query: {fieldKey}, [ diff --git a/frontend/src/container/LogDetailedView/TableView.tsx b/frontend/src/container/LogDetailedView/TableView.tsx index 591109ac3c..45e8417659 100644 --- a/frontend/src/container/LogDetailedView/TableView.tsx +++ b/frontend/src/container/LogDetailedView/TableView.tsx @@ -122,10 +122,10 @@ function TableView({ fieldValue: string, ) => (): void => { handleClick(operator, fieldKey, fieldValue); - if (operator === OPERATORS.IN) { + if (operator === OPERATORS['=']) { setIsFilterInLoading(true); } - if (operator === OPERATORS.NIN) { + if (operator === OPERATORS['!=']) { setIsFilterOutLoading(true); } }; diff --git a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx index 74b30bf6de..57ceea5072 100644 --- a/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx +++ b/frontend/src/container/LogDetailedView/TableView/TableViewActions.tsx @@ -139,7 +139,7 @@ export function TableViewActions( ) } - onClick={onClickHandler(OPERATORS.IN, fieldFilterKey, fieldData.value)} + onClick={onClickHandler(OPERATORS['='], fieldFilterKey, fieldData.value)} /> @@ -152,7 +152,11 @@ export function TableViewActions( ) } - onClick={onClickHandler(OPERATORS.NIN, fieldFilterKey, fieldData.value)} + onClick={onClickHandler( + OPERATORS['!='], + fieldFilterKey, + fieldData.value, + )} /> {!isOldLogsExplorerOrLiveLogsPage && ( diff --git a/frontend/src/container/LogDetailedView/index.tsx b/frontend/src/container/LogDetailedView/index.tsx index 4ff7ab6a99..1b2ecddc08 100644 --- a/frontend/src/container/LogDetailedView/index.tsx +++ b/frontend/src/container/LogDetailedView/index.tsx @@ -1,6 +1,7 @@ import LogDetail from 'components/LogDetail'; import { VIEW_TYPES } from 'components/LogDetail/constants'; import ROUTES from 'constants/routes'; +import { getOldLogsOperatorFromNew } from 'hooks/logs/useActiveLog'; import { getGeneratedFilterQueryString } from 'lib/getGeneratedFilterQueryString'; import getStep from 'lib/getStep'; import { getIdConditions } from 'pages/Logs/utils'; @@ -57,10 +58,11 @@ function LogDetailedView({ const handleAddToQuery = useCallback( (fieldKey: string, fieldValue: string, operator: string) => { + const newOperator = getOldLogsOperatorFromNew(operator); const updatedQueryString = getGeneratedFilterQueryString( fieldKey, fieldValue, - operator, + newOperator, queryString, ); @@ -71,10 +73,11 @@ function LogDetailedView({ const handleClickActionItem = useCallback( (fieldKey: string, fieldValue: string, operator: string): void => { + const newOperator = getOldLogsOperatorFromNew(operator); const updatedQueryString = getGeneratedFilterQueryString( fieldKey, fieldValue, - operator, + newOperator, queryString, ); diff --git a/frontend/src/hooks/logs/useActiveLog.ts b/frontend/src/hooks/logs/useActiveLog.ts index 0a968c4650..d7cc498f9f 100644 --- a/frontend/src/hooks/logs/useActiveLog.ts +++ b/frontend/src/hooks/logs/useActiveLog.ts @@ -1,6 +1,6 @@ import { getAggregateKeys } from 'api/queryBuilder/getAttributeKeys'; import { SOMETHING_WENT_WRONG } from 'constants/api'; -import { QueryBuilderKeys } from 'constants/queryBuilder'; +import { OPERATORS, QueryBuilderKeys } from 'constants/queryBuilder'; import ROUTES from 'constants/routes'; import { getOperatorValue } from 'container/QueryBuilder/filters/QueryBuilderSearch/utils'; import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder'; @@ -24,6 +24,16 @@ import { v4 as uuid } from 'uuid'; import { UseActiveLog } from './types'; +export function getOldLogsOperatorFromNew(operator: string): string { + switch (operator) { + case OPERATORS['=']: + return OPERATORS.IN; + case OPERATORS['!=']: + return OPERATORS.NIN; + default: + return operator; + } +} export const useActiveLog = (): UseActiveLog => { const dispatch = useDispatch(); @@ -178,10 +188,11 @@ export const useActiveLog = (): UseActiveLog => { ); const onAddToQueryLogs = useCallback( (fieldKey: string, fieldValue: string, operator: string) => { + const newOperator = getOldLogsOperatorFromNew(operator); const updatedQueryString = getGeneratedFilterQueryString( fieldKey, fieldValue, - operator, + newOperator, queryString, ); From 43577c7ead5ee1b7a1586ec39c66f5850e17389e Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Fri, 13 Sep 2024 13:47:08 +0530 Subject: [PATCH 03/66] feat: group by severity logs explorer page by default (#5772) * feat: initial setup for group by severity logs explorer page * chore: reduce the height of the histogram * chore: pr cleanup * chore: minor color update * chore: clean the PR * chore: clean the PR * chore: better base handling * fix: append query names to the legends in case of multiple queries * feat: make the changes only for list view and add back legends --- frontend/src/components/Graph/utils.ts | 5 ++- .../LogsExplorerChart.interfaces.ts | 1 + .../src/container/LogsExplorerChart/index.tsx | 13 +++++-- .../src/container/LogsExplorerChart/utils.ts | 36 +++++++++++++++++++ .../LogsExplorerViews.styles.scss | 7 ++++ .../src/container/LogsExplorerViews/index.tsx | 12 +++++++ 6 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 frontend/src/container/LogsExplorerChart/utils.ts diff --git a/frontend/src/components/Graph/utils.ts b/frontend/src/components/Graph/utils.ts index db30b6a8ce..f002d1402f 100644 --- a/frontend/src/components/Graph/utils.ts +++ b/frontend/src/components/Graph/utils.ts @@ -139,6 +139,7 @@ export const getGraphOptions = ( }, scales: { x: { + stacked: isStacked, grid: { display: true, color: getGridColor(), @@ -165,6 +166,7 @@ export const getGraphOptions = ( ticks: { color: getAxisLabelColor(currentTheme) }, }, y: { + stacked: isStacked, display: true, grid: { display: true, @@ -178,9 +180,6 @@ export const getGraphOptions = ( }, }, }, - stacked: { - display: isStacked === undefined ? false : 'auto', - }, }, elements: { line: { diff --git a/frontend/src/container/LogsExplorerChart/LogsExplorerChart.interfaces.ts b/frontend/src/container/LogsExplorerChart/LogsExplorerChart.interfaces.ts index a19a41d778..ee447242eb 100644 --- a/frontend/src/container/LogsExplorerChart/LogsExplorerChart.interfaces.ts +++ b/frontend/src/container/LogsExplorerChart/LogsExplorerChart.interfaces.ts @@ -3,6 +3,7 @@ import { QueryData } from 'types/api/widgets/getQuery'; export type LogsExplorerChartProps = { data: QueryData[]; isLoading: boolean; + isLogsExplorerViews?: boolean; isLabelEnabled?: boolean; className?: string; }; diff --git a/frontend/src/container/LogsExplorerChart/index.tsx b/frontend/src/container/LogsExplorerChart/index.tsx index 7f4d648529..7ac1934bb7 100644 --- a/frontend/src/container/LogsExplorerChart/index.tsx +++ b/frontend/src/container/LogsExplorerChart/index.tsx @@ -16,12 +16,14 @@ import { UpdateTimeInterval } from 'store/actions'; import { LogsExplorerChartProps } from './LogsExplorerChart.interfaces'; import { CardStyled } from './LogsExplorerChart.styled'; +import { getColorsForSeverityLabels } from './utils'; function LogsExplorerChart({ data, isLoading, isLabelEnabled = true, className, + isLogsExplorerViews = false, }: LogsExplorerChartProps): JSX.Element { const dispatch = useDispatch(); const urlQuery = useUrlQuery(); @@ -29,15 +31,19 @@ function LogsExplorerChart({ const handleCreateDatasets: Required['createDataset'] = useCallback( (element, index, allLabels) => ({ data: element, - backgroundColor: colors[index % colors.length] || themeColors.red, - borderColor: colors[index % colors.length] || themeColors.red, + backgroundColor: isLogsExplorerViews + ? getColorsForSeverityLabels(allLabels[index], index) + : colors[index % colors.length] || themeColors.red, + borderColor: isLogsExplorerViews + ? getColorsForSeverityLabels(allLabels[index], index) + : colors[index % colors.length] || themeColors.red, ...(isLabelEnabled ? { label: allLabels[index], } : {}), }), - [isLabelEnabled], + [isLabelEnabled, isLogsExplorerViews], ); const onDragSelect = useCallback( @@ -112,6 +118,7 @@ function LogsExplorerChart({ )} From 3fdfb51e0243d4c3587204c65152d71b9b2ea0df Mon Sep 17 00:00:00 2001 From: Vikrant Gupta Date: Fri, 13 Sep 2024 13:55:45 +0530 Subject: [PATCH 04/66] chore: deprecate clarity from frontend (#5962) --- .github/workflows/build.yaml | 7 +++---- .github/workflows/push.yaml | 2 -- frontend/src/AppRoutes/index.tsx | 1 - frontend/src/index.html.ejs | 19 ------------------- frontend/src/typings/window.ts | 3 --- frontend/webpack.config.js | 2 -- frontend/webpack.config.prod.js | 2 -- 7 files changed, 3 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ba92f9f28f..8b3e35b53f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,9 +11,9 @@ jobs: check-no-ee-references: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Run check - run: make check-no-ee-references + - uses: actions/checkout@v4 + - name: Run check + run: make check-no-ee-references build-frontend: runs-on: ubuntu-latest @@ -43,7 +43,6 @@ jobs: run: | echo 'INTERCOM_APP_ID="${{ secrets.INTERCOM_APP_ID }}"' > frontend/.env echo 'SEGMENT_ID="${{ secrets.SEGMENT_ID }}"' >> frontend/.env - echo 'CLARITY_PROJECT_ID="${{ secrets.CLARITY_PROJECT_ID }}"' >> frontend/.env - name: Install dependencies run: cd frontend && yarn install - name: Run ESLint diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 7808f9d18e..a440d2a5c7 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -9,7 +9,6 @@ on: - v* jobs: - image-build-and-push-query-service: runs-on: ubuntu-latest steps: @@ -151,7 +150,6 @@ jobs: run: | echo 'INTERCOM_APP_ID="${{ secrets.INTERCOM_APP_ID }}"' > frontend/.env echo 'SEGMENT_ID="${{ secrets.SEGMENT_ID }}"' >> frontend/.env - echo 'CLARITY_PROJECT_ID="${{ secrets.CLARITY_PROJECT_ID }}"' >> frontend/.env echo 'SENTRY_AUTH_TOKEN="${{ secrets.SENTRY_AUTH_TOKEN }}"' >> frontend/.env echo 'SENTRY_ORG="${{ secrets.SENTRY_ORG }}"' >> frontend/.env echo 'SENTRY_PROJECT_ID="${{ secrets.SENTRY_PROJECT_ID }}"' >> frontend/.env diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx index b900255172..8400afbde3 100644 --- a/frontend/src/AppRoutes/index.tsx +++ b/frontend/src/AppRoutes/index.tsx @@ -137,7 +137,6 @@ function App(): JSX.Element { window.analytics.identify(email, sanitizedIdentifyPayload); window.analytics.group(domain, groupTraits); - window.clarity('identify', email, name); posthog?.identify(email, { email, diff --git a/frontend/src/index.html.ejs b/frontend/src/index.html.ejs index 8a4e407ec5..f77e50f2b2 100644 --- a/frontend/src/index.html.ejs +++ b/frontend/src/index.html.ejs @@ -114,25 +114,6 @@ })(); - -