Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add context logging for chart cell & list page #1496

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions querybook/webapp/components/Board/BoardWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react';

import { ComponentType } from 'const/analytics';
import { useBoardPath } from 'hooks/ui/useBoardPath';
import { useTrackView } from 'hooks/useTrackView';

import { Board } from './Board';

export const BoardWrapper: React.FunctionComponent = () => {
useTrackView(ComponentType.LIST_PAGE);
const boardPath = useBoardPath();
const boardId = boardPath[boardPath.length - 1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import React from 'react';

import { QueryExecutionPicker } from 'components/ExecutionPicker/QueryExecutionPicker';
import { StatementExecutionPicker } from 'components/ExecutionPicker/StatementExecutionPicker';
import { ComponentType, ElementType } from 'const/analytics';
import { IDataChartCellMeta } from 'const/datadoc';
import { useChartSource } from 'hooks/chart/useChartSource';
import { trackClick } from 'lib/analytics';
import { transformData } from 'lib/chart/chart-data-transformation';
import { getDataTransformationOptions } from 'lib/chart/chart-meta-processing';
import { QueryExecutionResource } from 'resource/queryExecution';
Expand Down Expand Up @@ -228,7 +230,13 @@ export const DataDocChartCell = React.memo<IProps>(
<div className="flex-row">
<TextButton
title="Config Chart"
onClick={() => setShowChartComposer(true)}
onClick={() => {
trackClick({
component: ComponentType.DATADOC_CHART_CELL,
element: ElementType.CHART_CONFIG_BUTTON,
});
setShowChartComposer(true);
}}
size="small"
className="mr8"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Select from 'react-select';
import { QueryExecutionPicker } from 'components/ExecutionPicker/QueryExecutionPicker';
import { StatementExecutionPicker } from 'components/ExecutionPicker/StatementExecutionPicker';
import { StatementResultTable } from 'components/StatementResultTable/StatementResultTable';
import { ComponentType, ElementType } from 'const/analytics';
import { ColorPalette } from 'const/chartColors';
import { IDataChartCellMeta } from 'const/datadoc';
import {
Expand All @@ -29,6 +30,7 @@ import {
} from 'const/dataDocChart';
import { StatementExecutionResultSizes } from 'const/queryResultLimit';
import { useChartSource } from 'hooks/chart/useChartSource';
import { trackClick } from 'lib/analytics';
import { transformData } from 'lib/chart/chart-data-transformation';
import { mapMetaToFormVals } from 'lib/chart/chart-meta-processing';
import {
Expand Down Expand Up @@ -1046,7 +1048,13 @@ const DataDocChartComposerComponent: React.FunctionComponent<
{isEditable ? (
<div className="DataDocChartComposer-button">
<SoftButton
onClick={() => handleSubmit()}
onClick={() => {
trackClick({
component: ComponentType.DATADOC_CHART_CELL,
element: ElementType.CHART_SAVE_BUTTON,
});
handleSubmit();
}}
title="Save"
fullWidth
pushable={false}
Expand Down
6 changes: 6 additions & 0 deletions querybook/webapp/const/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ export enum ComponentType {
DATADOC_PAGE = 'DATADOC_PAGE',
ADHOC_QUERY = 'ADHOC_QUERY',
DATADOC_QUERY_CELL = 'DATADOC_QUERY_CELL',
DATADOC_CHART_CELL = 'DATADOC_CHART_CELL',
RIGHT_SIDEBAR = 'RIGHT_SIDEBAR',
TABLE_DETAIL_VIEW = 'TABLE_DETAIL_VIEW',
TABLE_NAVIGATOR_SEARCH = 'TABLE_NAVIGATOR_SEARCH',
AI_ASSISTANT = 'AI_ASSISTANT',
SURVEY = 'SURVEY',
LIST_PAGE = 'LIST_PAGE',
}

export enum ElementType {
Expand Down Expand Up @@ -88,6 +90,10 @@ export enum ElementType {
RESULT_EXPORT_BUTTON = 'RESULT_EXPORT_BUTTON',
INSERT_SNIPPET_BUTTON = 'INSERT_SNIPPET_BUTTON',

// Chart Cell
CHART_CONFIG_BUTTON = 'CHART_CONFIG_BUTTON',
CHART_SAVE_BUTTON = 'CHART_SAVE_BUTTON',

// Table detail view
OVERVIEW_TABLE_TAB = 'OVERVIEW_TABLE_TAB',
COLUMNS_TABLE_TAB = 'COLUMNS_TABLE_TAB',
Expand Down
Loading