From cec17213b6597d90da673263b6f6c27c9a84e705 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 09:55:38 -0600 Subject: [PATCH 01/14] Update tests and depecreated components --- .../queryBuilder/AggregateEditor.test.tsx | 8 +-- .../queryBuilder/AggregateEditor.tsx | 6 +- .../queryBuilder/ColumnsEditor.test.tsx | 8 +-- .../queryBuilder/DatabaseTableSelect.test.tsx | 12 ++-- .../queryBuilder/DatabaseTableSelect.tsx | 34 +++++----- .../queryBuilder/DurationUnitSelect.tsx | 9 ++- .../queryBuilder/FilterEditor.test.tsx | 8 +-- src/components/queryBuilder/FilterEditor.tsx | 62 +++++++++++-------- .../queryBuilder/GroupByEditor.test.tsx | 4 +- .../queryBuilder/LimitEditor.test.tsx | 4 +- .../queryBuilder/ModeSwitch.test.tsx | 8 +-- .../queryBuilder/OrderByEditor.test.tsx | 14 ++--- src/components/queryBuilder/OrderByEditor.tsx | 48 +++++++------- .../queryBuilder/OtelVersionSelect.test.tsx | 12 ++-- .../queryBuilder/OtelVersionSelect.tsx | 7 +-- src/components/queryBuilder/QueryBuilder.tsx | 10 +-- .../queryBuilder/QueryTypeSwitcher.test.tsx | 4 +- .../queryBuilder/views/LogsQueryBuilder.tsx | 6 +- src/data/CHDatasource.test.ts | 2 +- src/data/CHDatasource.ts | 4 +- src/data/adHocFilter.ts | 2 +- src/data/logs.ts | 12 ++-- src/data/utils.ts | 4 +- 23 files changed, 148 insertions(+), 140 deletions(-) diff --git a/src/components/queryBuilder/AggregateEditor.test.tsx b/src/components/queryBuilder/AggregateEditor.test.tsx index d88356bc..fe5e4069 100644 --- a/src/components/queryBuilder/AggregateEditor.test.tsx +++ b/src/components/queryBuilder/AggregateEditor.test.tsx @@ -30,8 +30,8 @@ describe('AggregateEditor', () => { const addButton = result.getByTestId(selectors.components.QueryBuilder.AggregateEditor.addButton); expect(addButton).toBeInTheDocument(); await userEvent.click(addButton); - expect(onAggregatesChange).toBeCalledTimes(1); - expect(onAggregatesChange).toBeCalledWith([expect.anything()]); + expect(onAggregatesChange).toHaveBeenCalledTimes(1); + expect(onAggregatesChange).toHaveBeenCalledWith([expect.anything()]); }); it('should call onAggregatesChange when remove aggregate button is clicked', async () => { @@ -45,7 +45,7 @@ describe('AggregateEditor', () => { const removeButton = result.getByTestId(selectors.components.QueryBuilder.AggregateEditor.itemRemoveButton); expect(removeButton).toBeInTheDocument(); await userEvent.click(removeButton); - expect(onAggregatesChange).toBeCalledWith([]); + expect(onAggregatesChange).toHaveBeenCalledWith([]); }); it('should call onAggregatesChange when aggregate is updated', async () => { @@ -62,6 +62,6 @@ describe('AggregateEditor', () => { fireEvent.keyDown(aggregateSelect, { key: 'ArrowDown' }); fireEvent.keyDown(aggregateSelect, { key: 'ArrowDown' }); fireEvent.keyDown(aggregateSelect, { key: 'Enter' }); - expect(onAggregatesChange).toBeCalledWith([expectedAggregate]); + expect(onAggregatesChange).toHaveBeenCalledWith([expectedAggregate]); }); }); diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index 0e57ba3f..846632ff 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { SelectableValue } from '@grafana/data'; -import { InlineFormLabel, Select, Button, Input, HorizontalGroup } from '@grafana/ui'; +import { InlineFormLabel, Select, Button, Input, Stack } from '@grafana/ui'; import { AggregateColumn, AggregateType, TableColumn } from 'types/queryBuilder'; import labels from 'labels'; import { selectors } from 'selectors'; @@ -43,7 +43,7 @@ const Aggregate = (props: AggregateProps) => { } return ( - + onDatabaseChange(e.value!)} - menuPlacement={'bottom'} - allowCustomValue - > +
+ onDatabaseChange(e.value!)} + createCustomValue={true} + > +
); }; @@ -82,14 +82,14 @@ export const TableSelect = (props: TableSelectProps) => { {label} - +
+ onTableChange(e.value!)} + createCustomValue={true} + > +
); }; diff --git a/src/components/queryBuilder/DurationUnitSelect.tsx b/src/components/queryBuilder/DurationUnitSelect.tsx index 7b7b684a..57fbdee7 100644 --- a/src/components/queryBuilder/DurationUnitSelect.tsx +++ b/src/components/queryBuilder/DurationUnitSelect.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { TimeUnit } from 'types/queryBuilder'; import allLabels from 'labels'; -import { InlineFormLabel, Select } from '@grafana/ui'; +import { InlineFormLabel, Combobox, ComboboxOption } from '@grafana/ui'; import { SelectableValue } from '@grafana/data'; import { styles } from 'styles'; @@ -12,7 +12,7 @@ interface DurationUnitSelectProps { inline?: boolean; } -const durationUnitOptions: ReadonlyArray> = [ +const durationUnitOptions: ReadonlyArray> = [ { label: TimeUnit.Seconds, value: TimeUnit.Seconds }, { label: TimeUnit.Milliseconds, value: TimeUnit.Milliseconds }, { label: TimeUnit.Microseconds, value: TimeUnit.Microseconds }, @@ -32,13 +32,12 @@ export const DurationUnitSelect = (props: DurationUnitSelectProps) => { > {label} - + disabled={disabled} - options={durationUnitOptions as Array>} + options={durationUnitOptions as Array>} value={unit} onChange={(v) => onChange(v.value!)} width={inline ? 25 : 30} - menuPlacement={'bottom'} /> ); diff --git a/src/components/queryBuilder/FilterEditor.test.tsx b/src/components/queryBuilder/FilterEditor.test.tsx index 0e7db95b..cb34bde6 100644 --- a/src/components/queryBuilder/FilterEditor.test.tsx +++ b/src/components/queryBuilder/FilterEditor.test.tsx @@ -31,9 +31,9 @@ describe('FilterEditor', () => { expect(result.container.firstChild).not.toBeNull(); expect(result.getAllByText(selectors.components.QueryEditor.QueryBuilder.WHERE.label).length).toBe(1); expect(result.getByTestId('query-builder-filters-add-button')).toBeInTheDocument(); - expect(onFiltersChange).toBeCalledTimes(0); + expect(onFiltersChange).toHaveBeenCalledTimes(0); await userEvent.click(result.getByTestId('query-builder-filters-add-button')); - expect(onFiltersChange).toBeCalledTimes(1); + expect(onFiltersChange).toHaveBeenCalledTimes(1); expect(onFiltersChange).toHaveBeenCalledWith([defaultNewFilter]); }); it('should render buttons and labels correctly', async () => { @@ -105,10 +105,10 @@ describe('FilterEditor', () => { expect(result.getAllByTestId('query-builder-filters-inline-add-button').length).toBe(1); expect(result.getAllByTestId('query-builder-filters-remove-button').length).toBe(filters.length); await userEvent.click(result.getByTestId('query-builder-filters-inline-add-button')); - expect(onFiltersChange).toBeCalledTimes(1); + expect(onFiltersChange).toHaveBeenCalledTimes(1); expect(onFiltersChange).toHaveBeenNthCalledWith(1, [...filters, defaultNewFilter]); await userEvent.click(result.getAllByTestId('query-builder-filters-remove-button')[0]); - expect(onFiltersChange).toBeCalledTimes(2); + expect(onFiltersChange).toHaveBeenCalledTimes(2); expect(onFiltersChange).toHaveBeenNthCalledWith(2, [filters[1]]); }); }); diff --git a/src/components/queryBuilder/FilterEditor.tsx b/src/components/queryBuilder/FilterEditor.tsx index ae6300e3..4893b9b5 100644 --- a/src/components/queryBuilder/FilterEditor.tsx +++ b/src/components/queryBuilder/FilterEditor.tsx @@ -1,6 +1,16 @@ import React, { useState } from 'react'; import { SelectableValue } from '@grafana/data'; -import { Button, HorizontalGroup, InlineFormLabel, Input, MultiSelect, RadioButtonGroup, Select } from '@grafana/ui'; +import { + Button, + Stack, + InlineFormLabel, + Input, + MultiSelect, + RadioButtonGroup, + Combobox, + ComboboxOption, + Select, +} from '@grafana/ui'; import { Filter, FilterOperator, TableColumn, NullFilter } from 'types/queryBuilder'; import * as utils from 'components/queryBuilder/utils'; import labels from 'labels'; @@ -16,7 +26,7 @@ const conditions: Array> = [ { value: 'AND', label: 'AND' }, { value: 'OR', label: 'OR' }, ]; -const filterOperators: Array> = [ +const filterOperators: Array> = [ { value: FilterOperator.WithInGrafanaTimeRange, label: 'Within dashboard time range' }, { value: FilterOperator.OutsideGrafanaTimeRange, label: 'Outside dashboard time range' }, { value: FilterOperator.IsAnything, label: 'IS ANYTHING' }, @@ -35,7 +45,7 @@ const filterOperators: Array> = [ { value: FilterOperator.IsNull, label: 'IS NULL' }, { value: FilterOperator.IsNotNull, label: 'IS NOT NULL' }, ]; -const standardTimeOptions: Array> = [ +const standardTimeOptions: Array> = [ { value: 'today()', label: 'TODAY' }, { value: 'yesterday()', label: 'YESTERDAY' }, { value: 'now()', label: 'NOW' }, @@ -137,12 +147,12 @@ export const FilterValueEditor = (props: { return (
- onStringFilterValueChange(e.value!)} options={getOptions()} /> + onStringFilterValueChange(e.value!)} options={getOptions()} />
); } @@ -227,7 +237,7 @@ export const FilterEditor = (props: { } return values; }; - const getFilterOperatorsByType = (type = 'string'): Array> => { + const getFilterOperatorsByType = (type = 'string'): Array> => { if (utils.isBooleanType(type)) { return filterOperators.filter((f) => [FilterOperator.Equals, FilterOperator.NotEquals].includes(f.value!)); } else if (utils.isNumberType(type)) { @@ -360,7 +370,7 @@ export const FilterEditor = (props: { }; return ( - + {index !== 0 && ( onFilterConditionChange(e!)} /> )} @@ -379,25 +389,25 @@ export const FilterEditor = (props: { menuPlacement={'bottom'} /> {(isMapType || isJSONType) && ( - onFilterOperatorChange(e.value!)} - menuPlacement={'bottom'} - /> + From 31ead8d6d56cf316f3122dd4b86a03bc534b9852 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 10:26:15 -0600 Subject: [PATCH 03/14] Remove unused vars and hide overflow on sidebar --- src/components/queryBuilder/AggregateEditor.tsx | 1 - src/components/queryBuilder/ColumnSelect.tsx | 2 -- src/components/queryBuilder/DurationUnitSelect.tsx | 1 - src/components/queryBuilder/FilterEditor.tsx | 2 -- src/components/queryBuilder/OrderByEditor.tsx | 1 - src/components/queryBuilder/OtelVersionSelect.tsx | 1 - src/views/config-v2/CHConfigEditor.tsx | 2 +- src/views/config-v2/constants.ts | 2 +- 8 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index 2f423692..ff22e2aa 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; -import { SelectableValue } from '@grafana/data'; import { InlineFormLabel, Combobox, Button, Input, Stack, ComboboxOption } from '@grafana/ui'; import { AggregateColumn, AggregateType, TableColumn } from 'types/queryBuilder'; import labels from 'labels'; diff --git a/src/components/queryBuilder/ColumnSelect.tsx b/src/components/queryBuilder/ColumnSelect.tsx index aa5801a5..e132d3ef 100644 --- a/src/components/queryBuilder/ColumnSelect.tsx +++ b/src/components/queryBuilder/ColumnSelect.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { SelectableValue } from '@grafana/data'; import { Combobox, ComboboxOption, InlineFormLabel } from '@grafana/ui'; import { ColumnHint, SelectedColumn, TableColumn } from 'types/queryBuilder'; import { styles } from 'styles'; @@ -34,7 +33,6 @@ export const ColumnSelect = (props: ColumnSelectProps) => { invalid, wide, inline, - clearable, } = props; const selectedColumnName = selectedColumn?.name; const columns: Array> = allColumns diff --git a/src/components/queryBuilder/DurationUnitSelect.tsx b/src/components/queryBuilder/DurationUnitSelect.tsx index fa5867cc..2ca1bbad 100644 --- a/src/components/queryBuilder/DurationUnitSelect.tsx +++ b/src/components/queryBuilder/DurationUnitSelect.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { TimeUnit } from 'types/queryBuilder'; import allLabels from 'labels'; import { InlineFormLabel, Combobox, ComboboxOption } from '@grafana/ui'; -import { SelectableValue } from '@grafana/data'; import { styles } from 'styles'; interface DurationUnitSelectProps { diff --git a/src/components/queryBuilder/FilterEditor.tsx b/src/components/queryBuilder/FilterEditor.tsx index c70e0e29..54f907ac 100644 --- a/src/components/queryBuilder/FilterEditor.tsx +++ b/src/components/queryBuilder/FilterEditor.tsx @@ -210,7 +210,6 @@ export const FilterEditor = (props: { table: string; }) => { const { index, filter, allColumns: fieldsList, onFilterChange, removeFilter } = props; - const [isOpen, setIsOpen] = useState(false); const isMapType = filter.type.startsWith('Map'); const isJSONType = filter.type.startsWith('JSON'); const mapKeys = useUniqueMapKeys(props.datasource, isMapType ? filter.key : '', props.database, props.table); @@ -292,7 +291,6 @@ export const FilterEditor = (props: { } }; const onFilterNameChange = (fieldName: string) => { - setIsOpen(false); const matchingField = fieldsList.find((f) => f.name === fieldName); const filterData = { key: matchingField?.name || fieldName, diff --git a/src/components/queryBuilder/OrderByEditor.tsx b/src/components/queryBuilder/OrderByEditor.tsx index 27956baa..f35ebbd8 100644 --- a/src/components/queryBuilder/OrderByEditor.tsx +++ b/src/components/queryBuilder/OrderByEditor.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { SelectableValue } from '@grafana/data'; import { Button, InlineFormLabel, Combobox, ComboboxOption } from '@grafana/ui'; import { OrderBy, OrderByDirection, QueryBuilderOptions, TableColumn } from 'types/queryBuilder'; import allLabels from 'labels'; diff --git a/src/components/queryBuilder/OtelVersionSelect.tsx b/src/components/queryBuilder/OtelVersionSelect.tsx index db1ff3a0..191eaea1 100644 --- a/src/components/queryBuilder/OtelVersionSelect.tsx +++ b/src/components/queryBuilder/OtelVersionSelect.tsx @@ -1,5 +1,4 @@ import React, { useEffect } from 'react'; -import { SelectableValue } from '@grafana/data'; import { InlineFormLabel, Combobox, Switch as GrafanaSwitch, useTheme, ComboboxOption } from '@grafana/ui'; import otel from 'otel'; import selectors from 'labels'; diff --git a/src/views/config-v2/CHConfigEditor.tsx b/src/views/config-v2/CHConfigEditor.tsx index 3a3ebfd3..19e661ca 100644 --- a/src/views/config-v2/CHConfigEditor.tsx +++ b/src/views/config-v2/CHConfigEditor.tsx @@ -71,7 +71,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ top: '100px', alignSelf: 'flex-start', maxHeight: 'calc(100vh - 100px)', - overflowY: 'auto', + overflow: 'hidden', }), requiredFields: css({ marginBottom: theme.spacing(2), diff --git a/src/views/config-v2/constants.ts b/src/views/config-v2/constants.ts index a82f52ff..b1bebb59 100644 --- a/src/views/config-v2/constants.ts +++ b/src/views/config-v2/constants.ts @@ -11,7 +11,7 @@ export const CONFIG_SECTION_HEADERS = [ { label: 'Server and encryption', id: 'server', isOpen: true, isOptional: false }, { label: 'Database credentials', id: 'credentials', isOpen: true, isOptional: false }, { label: 'TLS/SSL settings', id: 'tls', isOpen: false, isOptional: true }, - { label: 'Additional settings', id: 'additional', isOpen: false, isOptional: true }, + { label: 'Private data source connect', id: 'additional', isOpen: false, isOptional: true }, { label: 'Save & test', id: `${selectors.pages.DataSource.saveAndTest}`, isOpen: undefined, isOptional: null }, ]; From 5846e29a2032963558a401bf8f4a4c02df4ace9d Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 10:39:56 -0600 Subject: [PATCH 04/14] Add back in gf-form temporarily to make sure design matches --- src/components/SqlEditor.tsx | 2 +- .../configEditor/HttpHeadersConfig.tsx | 2 ++ src/components/configEditor/LabeledInput.tsx | 2 +- src/components/configEditor/LogsConfig.tsx | 2 +- .../configEditor/QuerySettingsConfig.tsx | 2 +- .../queryBuilder/AggregateEditor.tsx | 8 +++++-- src/components/queryBuilder/ColumnSelect.tsx | 2 +- src/components/queryBuilder/ColumnsEditor.tsx | 2 +- .../queryBuilder/DatabaseTableSelect.tsx | 2 +- .../queryBuilder/DurationUnitSelect.tsx | 2 +- src/components/queryBuilder/FilterEditor.tsx | 6 ++--- src/components/queryBuilder/GroupByEditor.tsx | 2 +- src/components/queryBuilder/LimitEditor.tsx | 2 +- src/components/queryBuilder/ModeSwitch.tsx | 2 +- src/components/queryBuilder/OrderByEditor.tsx | 2 +- .../queryBuilder/OtelVersionSelect.tsx | 2 +- src/components/queryBuilder/QueryBuilder.tsx | 4 ++-- src/components/queryBuilder/SqlPreview.tsx | 2 +- src/components/queryBuilder/Switch.tsx | 9 ++++++-- src/components/queryBuilder/TraceIdInput.tsx | 2 +- .../queryBuilder/views/LogsQueryBuilder.tsx | 6 ++--- .../queryBuilder/views/TraceQueryBuilder.tsx | 22 +++++++++---------- src/views/CHConfigEditor.tsx | 6 +++++ src/views/CHQueryEditor.tsx | 2 +- 24 files changed, 56 insertions(+), 39 deletions(-) diff --git a/src/components/SqlEditor.tsx b/src/components/SqlEditor.tsx index 893b983d..937e283c 100644 --- a/src/components/SqlEditor.tsx +++ b/src/components/SqlEditor.tsx @@ -110,7 +110,7 @@ export const SqlEditor = (props: SqlEditorProps) => { return ( <> -
+
saveChanges({ queryType })} sqlEditor />
diff --git a/src/components/configEditor/HttpHeadersConfig.tsx b/src/components/configEditor/HttpHeadersConfig.tsx index 773b409b..7a28dbea 100644 --- a/src/components/configEditor/HttpHeadersConfig.tsx +++ b/src/components/configEditor/HttpHeadersConfig.tsx @@ -72,6 +72,7 @@ export const HttpHeadersConfig = (props: HttpHeadersConfigProps) => { updateForwardGrafanaHeaders(e.currentTarget.checked)} /> @@ -154,6 +155,7 @@ const HttpHeaderEditor = (props: HttpHeaderEditorProps) => { setSecure(e.currentTarget.checked)} onBlur={() => onUpdate()} diff --git a/src/components/configEditor/LabeledInput.tsx b/src/components/configEditor/LabeledInput.tsx index e59a78f2..78650577 100644 --- a/src/components/configEditor/LabeledInput.tsx +++ b/src/components/configEditor/LabeledInput.tsx @@ -14,7 +14,7 @@ export function LabeledInput(props: LabeledInputProps) { const { label, tooltip, placeholder, disabled, value, onChange } = props; return ( -
+
{label} diff --git a/src/components/configEditor/LogsConfig.tsx b/src/components/configEditor/LogsConfig.tsx index c82c6c21..ca45c9b9 100644 --- a/src/components/configEditor/LogsConfig.tsx +++ b/src/components/configEditor/LogsConfig.tsx @@ -125,7 +125,7 @@ export const LogsConfig = (props: LogsConfigProps) => { onChange={onSelectContextColumnsChange} wide /> -
+
{labels.contextColumns.columns.label} diff --git a/src/components/configEditor/QuerySettingsConfig.tsx b/src/components/configEditor/QuerySettingsConfig.tsx index 73c42c51..e6a14dfa 100644 --- a/src/components/configEditor/QuerySettingsConfig.tsx +++ b/src/components/configEditor/QuerySettingsConfig.tsx @@ -100,7 +100,7 @@ export const QuerySettingsConfig = (props: QuerySettingsConfigProps) => { - + ); diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index ff22e2aa..55279d51 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -132,7 +132,11 @@ export const AggregateEditor = (props: AggregateEditorProps) => { {aggregates.map((aggregate, index) => { const key = `${index}-${aggregate.column}-${aggregate.aggregateType}-${aggregate.alias}`; return ( -
+
{index === 0 ? fieldLabel : fieldSpacer} { ); })} -
+
{aggregates.length === 0 ? fieldLabel : fieldSpacer}
From 62ca9d40d3d3d33daf4043c9e0331e19b49827de Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 10:41:40 -0600 Subject: [PATCH 05/14] Lint --- src/components/configEditor/HttpHeadersConfig.tsx | 2 +- src/components/queryBuilder/OrderByEditor.tsx | 2 +- src/components/queryBuilder/OtelVersionSelect.tsx | 7 ++++++- src/components/queryBuilder/Switch.tsx | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/configEditor/HttpHeadersConfig.tsx b/src/components/configEditor/HttpHeadersConfig.tsx index 7a28dbea..165c8321 100644 --- a/src/components/configEditor/HttpHeadersConfig.tsx +++ b/src/components/configEditor/HttpHeadersConfig.tsx @@ -155,7 +155,7 @@ const HttpHeaderEditor = (props: HttpHeaderEditorProps) => { setSecure(e.currentTarget.checked)} onBlur={() => onUpdate()} diff --git a/src/components/queryBuilder/OrderByEditor.tsx b/src/components/queryBuilder/OrderByEditor.tsx index eb209f64..7ae447c5 100644 --- a/src/components/queryBuilder/OrderByEditor.tsx +++ b/src/components/queryBuilder/OrderByEditor.tsx @@ -100,7 +100,7 @@ export const OrderByEditor = (props: OrderByEditorProps) => { {orderBy.map((orderByItem, index) => { const key = `${index}-${orderByItem.name}-${orderByItem.hint || ''}-${orderByItem.dir}`; return ( -
+
{index === 0 ? fieldLabel : fieldSpacer} { {label}
- onEnabledChange(e.currentTarget.checked)} role="checkbox" /> + onEnabledChange(e.currentTarget.checked)} + role="checkbox" + />
{
onChange(e.currentTarget.checked)} /> From f9b0f0a38dbbda83cf7a89d5c4f125ccb20dc918 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 15:06:34 -0600 Subject: [PATCH 06/14] Remove gf-form and fix validatesql toggle --- src/components/SqlEditor.tsx | 2 +- .../configEditor/HttpHeadersConfig.tsx | 2 - src/components/configEditor/LabeledInput.tsx | 2 +- src/components/configEditor/LogsConfig.tsx | 2 +- .../configEditor/QuerySettingsConfig.tsx | 2 +- .../queryBuilder/AggregateEditor.tsx | 4 +- src/components/queryBuilder/ColumnSelect.tsx | 27 ++--- src/components/queryBuilder/ColumnsEditor.tsx | 2 +- .../queryBuilder/DatabaseTableSelect.tsx | 2 +- .../queryBuilder/DurationUnitSelect.tsx | 5 +- src/components/queryBuilder/FilterEditor.tsx | 97 ++++++++------- src/components/queryBuilder/GroupByEditor.tsx | 2 +- src/components/queryBuilder/LimitEditor.tsx | 2 +- src/components/queryBuilder/ModeSwitch.tsx | 2 +- src/components/queryBuilder/OrderByEditor.tsx | 5 +- .../queryBuilder/OtelVersionSelect.tsx | 10 +- src/components/queryBuilder/QueryBuilder.tsx | 4 +- src/components/queryBuilder/SqlPreview.tsx | 2 +- src/components/queryBuilder/Switch.tsx | 9 +- src/components/queryBuilder/TraceIdInput.tsx | 2 +- .../queryBuilder/views/LogsQueryBuilder.tsx | 114 +++++++++--------- .../queryBuilder/views/TraceQueryBuilder.tsx | 30 ++--- src/labels.ts | 2 +- src/module.ts | 2 +- src/views/CHConfigEditor.tsx | 6 - src/views/CHQueryEditor.tsx | 2 +- .../config-v2/AdditionalSettingsSection.tsx | 15 ++- src/views/config-v2/constants.ts | 2 +- 28 files changed, 171 insertions(+), 187 deletions(-) diff --git a/src/components/SqlEditor.tsx b/src/components/SqlEditor.tsx index 937e283c..893b983d 100644 --- a/src/components/SqlEditor.tsx +++ b/src/components/SqlEditor.tsx @@ -110,7 +110,7 @@ export const SqlEditor = (props: SqlEditorProps) => { return ( <> -
+
saveChanges({ queryType })} sqlEditor />
diff --git a/src/components/configEditor/HttpHeadersConfig.tsx b/src/components/configEditor/HttpHeadersConfig.tsx index 165c8321..773b409b 100644 --- a/src/components/configEditor/HttpHeadersConfig.tsx +++ b/src/components/configEditor/HttpHeadersConfig.tsx @@ -72,7 +72,6 @@ export const HttpHeadersConfig = (props: HttpHeadersConfigProps) => { updateForwardGrafanaHeaders(e.currentTarget.checked)} /> @@ -155,7 +154,6 @@ const HttpHeaderEditor = (props: HttpHeaderEditorProps) => { setSecure(e.currentTarget.checked)} onBlur={() => onUpdate()} diff --git a/src/components/configEditor/LabeledInput.tsx b/src/components/configEditor/LabeledInput.tsx index 78650577..3025d3a8 100644 --- a/src/components/configEditor/LabeledInput.tsx +++ b/src/components/configEditor/LabeledInput.tsx @@ -14,7 +14,7 @@ export function LabeledInput(props: LabeledInputProps) { const { label, tooltip, placeholder, disabled, value, onChange } = props; return ( -
+
{label} diff --git a/src/components/configEditor/LogsConfig.tsx b/src/components/configEditor/LogsConfig.tsx index ca45c9b9..5b152a1e 100644 --- a/src/components/configEditor/LogsConfig.tsx +++ b/src/components/configEditor/LogsConfig.tsx @@ -125,7 +125,7 @@ export const LogsConfig = (props: LogsConfigProps) => { onChange={onSelectContextColumnsChange} wide /> -
+
{labels.contextColumns.columns.label} diff --git a/src/components/configEditor/QuerySettingsConfig.tsx b/src/components/configEditor/QuerySettingsConfig.tsx index e6a14dfa..73c42c51 100644 --- a/src/components/configEditor/QuerySettingsConfig.tsx +++ b/src/components/configEditor/QuerySettingsConfig.tsx @@ -100,7 +100,7 @@ export const QuerySettingsConfig = (props: QuerySettingsConfigProps) => { - + ); diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index 55279d51..4ac4e95d 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -133,7 +133,7 @@ export const AggregateEditor = (props: AggregateEditorProps) => { const key = `${index}-${aggregate.column}-${aggregate.aggregateType}-${aggregate.alias}`; return (
@@ -149,7 +149,7 @@ export const AggregateEditor = (props: AggregateEditorProps) => { ); })} -
+
{aggregates.length === 0 ? fieldLabel : fieldSpacer}
- -
); }; @@ -442,7 +439,7 @@ export const FiltersEditor = (props: { return ( <> {filters.length === 0 && ( -
+
{label} @@ -460,7 +457,7 @@ export const FiltersEditor = (props: { )} {filters.map((filter, index) => { return ( -
+
{index === 0 ? ( {label} @@ -482,7 +479,7 @@ export const FiltersEditor = (props: { ); })} {filters.length !== 0 && ( -
+
diff --git a/src/components/queryBuilder/OtelVersionSelect.tsx b/src/components/queryBuilder/OtelVersionSelect.tsx index 58a228a7..b94d76b5 100644 --- a/src/components/queryBuilder/OtelVersionSelect.tsx +++ b/src/components/queryBuilder/OtelVersionSelect.tsx @@ -32,20 +32,16 @@ export const OtelVersionSelect = (props: OtelVersionSelectProps) => { height: `${theme.spacing.formInputHeight}px`, display: 'flex', alignItems: 'center', + marginBottom: '4px', }; return ( -
+
{label}
- onEnabledChange(e.currentTarget.checked)} - role="checkbox" - /> + onEnabledChange(e.currentTarget.checked)} role="checkbox" />
{ return (
-
+
{ onTableChange={onTableChange} />
-
+
diff --git a/src/components/queryBuilder/SqlPreview.tsx b/src/components/queryBuilder/SqlPreview.tsx index 1bffd7e6..b6ad734e 100644 --- a/src/components/queryBuilder/SqlPreview.tsx +++ b/src/components/queryBuilder/SqlPreview.tsx @@ -11,7 +11,7 @@ export const SqlPreview = (props: SqlPreviewProps) => { const { label, tooltip } = labels.components.SqlPreview; return ( -
+
{label} diff --git a/src/components/queryBuilder/Switch.tsx b/src/components/queryBuilder/Switch.tsx index 973d60f5..22b439f1 100644 --- a/src/components/queryBuilder/Switch.tsx +++ b/src/components/queryBuilder/Switch.tsx @@ -26,17 +26,12 @@ export const Switch = (props: SwitchProps) => { const labelStyle = 'query-keyword ' + (inline ? styles.QueryEditor.inlineField : ''); return ( -
+
{label}
- onChange(e.currentTarget.checked)} - /> + onChange(e.currentTarget.checked)} />
); diff --git a/src/components/queryBuilder/TraceIdInput.tsx b/src/components/queryBuilder/TraceIdInput.tsx index 24a27834..16751b68 100644 --- a/src/components/queryBuilder/TraceIdInput.tsx +++ b/src/components/queryBuilder/TraceIdInput.tsx @@ -19,7 +19,7 @@ const TraceIdInput = (props: TraceIdInputProps) => { }, [traceId]); return ( -
+
{label} diff --git a/src/components/queryBuilder/views/LogsQueryBuilder.tsx b/src/components/queryBuilder/views/LogsQueryBuilder.tsx index 9ba099c9..860cb3e7 100644 --- a/src/components/queryBuilder/views/LogsQueryBuilder.tsx +++ b/src/components/queryBuilder/views/LogsQueryBuilder.tsx @@ -150,61 +150,61 @@ export const LogsQueryBuilder = (props: LogsQueryBuilderProps) => { selectedColumns={builderState.selectedColumns} onSelectedColumnsChange={onOptionChange('selectedColumns')} /> -
- - -
-
- - - {/* */} +
+
+ + +
+
+ + + {/* */} +
{ }, [logMessageLike]); return ( -
+
{label} setInput(e.currentTarget.value)} diff --git a/src/components/queryBuilder/views/TraceQueryBuilder.tsx b/src/components/queryBuilder/views/TraceQueryBuilder.tsx index ed8d421d..6a0f26e9 100644 --- a/src/components/queryBuilder/views/TraceQueryBuilder.tsx +++ b/src/components/queryBuilder/views/TraceQueryBuilder.tsx @@ -180,7 +180,7 @@ export const TraceQueryBuilder = (props: TraceQueryBuilderProps) => { onVersionChange={(v) => builderOptionsDispatch(setOtelVersion(v))} wide /> -
+
{ label={labels.columns.spanId.label} tooltip={labels.columns.spanId.tooltip} wide - inline />
-
+
{ label={labels.columns.serviceName.label} tooltip={labels.columns.serviceName.tooltip} wide - inline />
-
+
{ label={labels.columns.startTime.label} tooltip={labels.columns.startTime.tooltip} wide - inline />
-
+
{ disabled={builderState.otelEnabled} unit={builderState.durationUnit} onChange={onOptionChange('durationUnit')} - inline />
-
+
{ label={labels.columns.serviceTags.label} tooltip={labels.columns.serviceTags.tooltip} wide - inline />
-
+
{ label={labels.columns.statusCode.label} tooltip={labels.columns.statusCode.tooltip} wide - inline />
-
+
{ label={labels.columns.state.label} tooltip={labels.columns.state.tooltip} wide - inline />
-
+
{ label={labels.columns.instrumentationLibraryVersion.label} tooltip={labels.columns.instrumentationLibraryVersion.tooltip} wide - inline />
-
+
{ wide />
-
+
{ onChange={onOptionChange('traceEventsColumnPrefix')} />
-
+
(Datasource) diff --git a/src/views/CHConfigEditor.tsx b/src/views/CHConfigEditor.tsx index 015743ca..e587b933 100644 --- a/src/views/CHConfigEditor.tsx +++ b/src/views/CHConfigEditor.tsx @@ -284,7 +284,6 @@ export const ConfigEditor: React.FC = (props) => { { trackingV1.trackClickhouseConfigV1SecureConnectionToggleClicked({ @@ -326,7 +325,6 @@ export const ConfigEditor: React.FC = (props) => { { trackingV1.trackClickhouseConfigV1SkipTLSVerifyToggleClicked({ @@ -338,7 +336,6 @@ export const ConfigEditor: React.FC = (props) => { { trackingV1.trackClickhouseConfigV1TLSClientAuthToggleClicked({ @@ -350,7 +347,6 @@ export const ConfigEditor: React.FC = (props) => { { trackingV1.trackClickhouseConfigV1WithCACertToggleClicked({ caCertToggle: e.currentTarget.checked }); @@ -613,7 +609,6 @@ export const ConfigEditor: React.FC = (props) => { { @@ -625,7 +620,6 @@ export const ConfigEditor: React.FC = (props) => { {config.secureSocksDSProxyEnabled && versionGte(config.buildInfo.version, '10.0.0') && ( onSwitchToggle('enableSecureSocksProxy', e.currentTarget.checked)} /> diff --git a/src/views/CHQueryEditor.tsx b/src/views/CHQueryEditor.tsx index f75d38f2..675ce3b6 100644 --- a/src/views/CHQueryEditor.tsx +++ b/src/views/CHQueryEditor.tsx @@ -25,7 +25,7 @@ export const CHQueryEditor = (props: CHQueryEditorProps) => { return ( <> -
+
diff --git a/src/views/config-v2/AdditionalSettingsSection.tsx b/src/views/config-v2/AdditionalSettingsSection.tsx index 3a36b98e..60bd5230 100644 --- a/src/views/config-v2/AdditionalSettingsSection.tsx +++ b/src/views/config-v2/AdditionalSettingsSection.tsx @@ -106,6 +106,19 @@ export const AdditionalSettingsSection = (props: Props) => { }); }; + const onSwitchToggle = ( + key: keyof Pick, + value: boolean + ) => { + onOptionsChange({ + ...options, + jsonData: { + ...options.jsonData, + [key]: value, + }, + }); + }; + return ( { }} onValidateSqlChange={(e) => { trackClickhouseConfigV2QuerySettings({ validateSql: e.currentTarget.checked }); - onUpdateDatasourceJsonDataOption(props, 'validateSql')(e); + onSwitchToggle('validateSql', e.currentTarget.checked); }} /> diff --git a/src/views/config-v2/constants.ts b/src/views/config-v2/constants.ts index b1bebb59..a82f52ff 100644 --- a/src/views/config-v2/constants.ts +++ b/src/views/config-v2/constants.ts @@ -11,7 +11,7 @@ export const CONFIG_SECTION_HEADERS = [ { label: 'Server and encryption', id: 'server', isOpen: true, isOptional: false }, { label: 'Database credentials', id: 'credentials', isOpen: true, isOptional: false }, { label: 'TLS/SSL settings', id: 'tls', isOpen: false, isOptional: true }, - { label: 'Private data source connect', id: 'additional', isOpen: false, isOptional: true }, + { label: 'Additional settings', id: 'additional', isOpen: false, isOptional: true }, { label: 'Save & test', id: `${selectors.pages.DataSource.saveAndTest}`, isOpen: undefined, isOptional: null }, ]; From 3f800332fa4f683ac4f4a3ed18ab3adc4aa9cb12 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 15:13:12 -0600 Subject: [PATCH 07/14] Update styles --- src/components/configEditor/LabeledInput.tsx | 3 ++- src/components/configEditor/LogsConfig.tsx | 3 ++- src/components/queryBuilder/AggregateEditor.tsx | 4 ++-- src/components/queryBuilder/ColumnSelect.tsx | 2 +- src/components/queryBuilder/ColumnsEditor.tsx | 2 +- .../queryBuilder/DatabaseTableSelect.tsx | 2 +- .../queryBuilder/DurationUnitSelect.tsx | 2 +- src/components/queryBuilder/FilterEditor.tsx | 8 ++++---- src/components/queryBuilder/LimitEditor.tsx | 3 ++- src/components/queryBuilder/ModeSwitch.tsx | 3 ++- src/components/queryBuilder/OrderByEditor.tsx | 4 ++-- .../queryBuilder/OtelVersionSelect.tsx | 3 ++- src/components/queryBuilder/SqlPreview.tsx | 3 ++- src/components/queryBuilder/Switch.tsx | 2 +- src/components/queryBuilder/TraceIdInput.tsx | 3 ++- .../queryBuilder/views/LogsQueryBuilder.tsx | 8 ++++---- .../queryBuilder/views/TraceQueryBuilder.tsx | 17 +++++++++-------- src/styles.ts | 11 +++++++++++ src/views/CHQueryEditor.tsx | 2 +- 19 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/components/configEditor/LabeledInput.tsx b/src/components/configEditor/LabeledInput.tsx index 3025d3a8..33bc8281 100644 --- a/src/components/configEditor/LabeledInput.tsx +++ b/src/components/configEditor/LabeledInput.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { Input, InlineFormLabel } from '@grafana/ui'; +import { styles } from 'styles'; interface LabeledInputProps { label: string; @@ -14,7 +15,7 @@ export function LabeledInput(props: LabeledInputProps) { const { label, tooltip, placeholder, disabled, value, onChange } = props; return ( -
+
{label} diff --git a/src/components/configEditor/LogsConfig.tsx b/src/components/configEditor/LogsConfig.tsx index 5b152a1e..996e2913 100644 --- a/src/components/configEditor/LogsConfig.tsx +++ b/src/components/configEditor/LogsConfig.tsx @@ -9,6 +9,7 @@ import { CHLogsConfig } from 'types/config'; import allLabels from 'labels'; import { columnLabelToPlaceholder } from 'data/utils'; import { Switch } from 'components/queryBuilder/Switch'; +import { styles } from 'styles'; interface LogsConfigProps { logsConfig?: CHLogsConfig; @@ -125,7 +126,7 @@ export const LogsConfig = (props: LogsConfigProps) => { onChange={onSelectContextColumnsChange} wide /> -
+
{labels.contextColumns.columns.label} diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index 4ac4e95d..76889ced 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -133,7 +133,7 @@ export const AggregateEditor = (props: AggregateEditorProps) => { const key = `${index}-${aggregate.column}-${aggregate.aggregateType}-${aggregate.alias}`; return (
@@ -149,7 +149,7 @@ export const AggregateEditor = (props: AggregateEditorProps) => { ); })} -
+
{aggregates.length === 0 ? fieldLabel : fieldSpacer}
From 371df9cf532da88b3bbed3c382013941675afb8b Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 15:21:31 -0600 Subject: [PATCH 08/14] Move config bug fixes to separate PR --- src/views/config-v2/AdditionalSettingsSection.tsx | 15 +-------------- src/views/config-v2/CHConfigEditor.tsx | 2 +- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/views/config-v2/AdditionalSettingsSection.tsx b/src/views/config-v2/AdditionalSettingsSection.tsx index 60bd5230..3a36b98e 100644 --- a/src/views/config-v2/AdditionalSettingsSection.tsx +++ b/src/views/config-v2/AdditionalSettingsSection.tsx @@ -106,19 +106,6 @@ export const AdditionalSettingsSection = (props: Props) => { }); }; - const onSwitchToggle = ( - key: keyof Pick, - value: boolean - ) => { - onOptionsChange({ - ...options, - jsonData: { - ...options.jsonData, - [key]: value, - }, - }); - }; - return ( { }} onValidateSqlChange={(e) => { trackClickhouseConfigV2QuerySettings({ validateSql: e.currentTarget.checked }); - onSwitchToggle('validateSql', e.currentTarget.checked); + onUpdateDatasourceJsonDataOption(props, 'validateSql')(e); }} /> diff --git a/src/views/config-v2/CHConfigEditor.tsx b/src/views/config-v2/CHConfigEditor.tsx index 19e661ca..3a3ebfd3 100644 --- a/src/views/config-v2/CHConfigEditor.tsx +++ b/src/views/config-v2/CHConfigEditor.tsx @@ -71,7 +71,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ top: '100px', alignSelf: 'flex-start', maxHeight: 'calc(100vh - 100px)', - overflow: 'hidden', + overflowY: 'auto', }), requiredFields: css({ marginBottom: theme.spacing(2), From 062f71372e213e35c43b3da6cab1dc8be1b0408b Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 15:25:05 -0600 Subject: [PATCH 09/14] Fix module.ts bug --- src/module.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index 394dd2fb..319dc276 100644 --- a/src/module.ts +++ b/src/module.ts @@ -12,7 +12,7 @@ import clickhouseVersion from '../package.json'; // ConfigEditorV2 is the new design for the Clickhouse configuration page const configEditor = config.featureToggles['newClickhouseConfigPageDesign' as keyof FeatureToggles] - ? ConfigEditorV1 + ? ConfigEditorV2 : ConfigEditorV1; export const plugin = new DataSourcePlugin(Datasource) From 336b382a5b5f092b9b465c188ce967608f77367f Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 15:44:30 -0600 Subject: [PATCH 10/14] Fix toggle bug --- src/views/config-v2/TLSSSLSettingsSection.tsx | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/views/config-v2/TLSSSLSettingsSection.tsx b/src/views/config-v2/TLSSSLSettingsSection.tsx index 493763e9..785e8833 100644 --- a/src/views/config-v2/TLSSSLSettingsSection.tsx +++ b/src/views/config-v2/TLSSSLSettingsSection.tsx @@ -1,4 +1,4 @@ -import { DataSourcePluginOptionsEditorProps, onUpdateDatasourceJsonDataOption } from '@grafana/data'; +import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; import { Box, CollapsableSection, CertificationKey, Text, useStyles2, Checkbox, Stack, Badge } from '@grafana/ui'; import React from 'react'; import { CHConfig, CHSecureConfig } from 'types/config'; @@ -46,6 +46,19 @@ export const TLSSSLSettingsSection = (props: Props) => { }); }; + const onTLSSettingsChange = ( + key: keyof Pick, + value: boolean + ) => { + onOptionsChange({ + ...options, + jsonData: { + ...options.jsonData, + [key]: value, + }, + }); + }; + return ( { value={jsonData.tlsSkipVerify || false} onChange={(e) => { trackClickhouseConfigV2SkipTLSVerifyToggleClicked({ skipTlsVerifyToggle: e.currentTarget.checked }); - onUpdateDatasourceJsonDataOption(props, 'tlsSkipVerify')(e); + onTLSSettingsChange('tlsSkipVerify', e.currentTarget.checked); }} /> { value={jsonData.tlsAuth || false} onChange={(e) => { trackClickhouseConfigV2TLSClientAuthToggleClicked({ clientAuthToggle: e.currentTarget.checked }); - onUpdateDatasourceJsonDataOption(props, 'tlsAuth')(e); + onTLSSettingsChange('tlsAuth', e.currentTarget.checked); }} /> {jsonData.tlsAuth && ( @@ -116,7 +129,7 @@ export const TLSSSLSettingsSection = (props: Props) => { value={jsonData.tlsAuthWithCACert || false} onChange={(e) => { trackClickhouseConfigV2WithCACertToggleClicked({ caCertToggle: e.currentTarget.checked }); - onUpdateDatasourceJsonDataOption(props, 'tlsAuthWithCACert')(e); + onTLSSettingsChange('tlsAuthWithCACert', e.currentTarget.checked); }} />
From 35bd14c656df761ed4413c82cc4a4552a78af462 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Tue, 21 Oct 2025 20:43:42 -0600 Subject: [PATCH 11/14] Remove change from this PR --- src/views/config-v2/TLSSSLSettingsSection.tsx | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/views/config-v2/TLSSSLSettingsSection.tsx b/src/views/config-v2/TLSSSLSettingsSection.tsx index 785e8833..493763e9 100644 --- a/src/views/config-v2/TLSSSLSettingsSection.tsx +++ b/src/views/config-v2/TLSSSLSettingsSection.tsx @@ -1,4 +1,4 @@ -import { DataSourcePluginOptionsEditorProps } from '@grafana/data'; +import { DataSourcePluginOptionsEditorProps, onUpdateDatasourceJsonDataOption } from '@grafana/data'; import { Box, CollapsableSection, CertificationKey, Text, useStyles2, Checkbox, Stack, Badge } from '@grafana/ui'; import React from 'react'; import { CHConfig, CHSecureConfig } from 'types/config'; @@ -46,19 +46,6 @@ export const TLSSSLSettingsSection = (props: Props) => { }); }; - const onTLSSettingsChange = ( - key: keyof Pick, - value: boolean - ) => { - onOptionsChange({ - ...options, - jsonData: { - ...options.jsonData, - [key]: value, - }, - }); - }; - return ( { value={jsonData.tlsSkipVerify || false} onChange={(e) => { trackClickhouseConfigV2SkipTLSVerifyToggleClicked({ skipTlsVerifyToggle: e.currentTarget.checked }); - onTLSSettingsChange('tlsSkipVerify', e.currentTarget.checked); + onUpdateDatasourceJsonDataOption(props, 'tlsSkipVerify')(e); }} /> { value={jsonData.tlsAuth || false} onChange={(e) => { trackClickhouseConfigV2TLSClientAuthToggleClicked({ clientAuthToggle: e.currentTarget.checked }); - onTLSSettingsChange('tlsAuth', e.currentTarget.checked); + onUpdateDatasourceJsonDataOption(props, 'tlsAuth')(e); }} /> {jsonData.tlsAuth && ( @@ -129,7 +116,7 @@ export const TLSSSLSettingsSection = (props: Props) => { value={jsonData.tlsAuthWithCACert || false} onChange={(e) => { trackClickhouseConfigV2WithCACertToggleClicked({ caCertToggle: e.currentTarget.checked }); - onTLSSettingsChange('tlsAuthWithCACert', e.currentTarget.checked); + onUpdateDatasourceJsonDataOption(props, 'tlsAuthWithCACert')(e); }} />
From fef88a7c3fb71707bff826b9c7f8016b29c1b717 Mon Sep 17 00:00:00 2001 From: alyssabull Date: Wed, 22 Oct 2025 09:45:30 -0600 Subject: [PATCH 12/14] Update styles --- src/components/configEditor/LabeledInput.tsx | 2 +- .../queryBuilder/DatabaseTableSelect.tsx | 4 +- .../queryBuilder/EditorTypeSwitcher.tsx | 3 +- src/components/queryBuilder/OrderByEditor.tsx | 1 - .../queryBuilder/views/TraceQueryBuilder.tsx | 16 +-- src/styles.ts | 132 +++++++++--------- 6 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/components/configEditor/LabeledInput.tsx b/src/components/configEditor/LabeledInput.tsx index 33bc8281..a4b688b0 100644 --- a/src/components/configEditor/LabeledInput.tsx +++ b/src/components/configEditor/LabeledInput.tsx @@ -15,7 +15,7 @@ export function LabeledInput(props: LabeledInputProps) { const { label, tooltip, placeholder, disabled, value, onChange } = props; return ( -
+
{label} diff --git a/src/components/queryBuilder/DatabaseTableSelect.tsx b/src/components/queryBuilder/DatabaseTableSelect.tsx index ad35413b..c53aeed6 100644 --- a/src/components/queryBuilder/DatabaseTableSelect.tsx +++ b/src/components/queryBuilder/DatabaseTableSelect.tsx @@ -34,7 +34,7 @@ export const DatabaseSelect = (props: DatabaseSelectProps) => { }, [datasource, database, onDatabaseChange]); return ( - <> +
{label} @@ -46,7 +46,7 @@ export const DatabaseSelect = (props: DatabaseSelectProps) => { createCustomValue={true} >
- +
); }; diff --git a/src/components/queryBuilder/EditorTypeSwitcher.tsx b/src/components/queryBuilder/EditorTypeSwitcher.tsx index e6d51887..b7f509ba 100644 --- a/src/components/queryBuilder/EditorTypeSwitcher.tsx +++ b/src/components/queryBuilder/EditorTypeSwitcher.tsx @@ -8,6 +8,7 @@ import { EditorType, CHQuery, defaultCHBuilderQuery } from 'types/sql'; import { QueryBuilderOptions } from 'types/queryBuilder'; import { mapQueryTypeToGrafanaFormat } from 'data/utils'; import { Datasource } from 'data/CHDatasource'; +import { styles } from 'styles'; interface CHEditorTypeSwitcherProps { query: CHQuery; @@ -85,7 +86,7 @@ export const EditorTypeSwitcher = (props: CHEditorTypeSwitcherProps) => { setCannotConvertModalState(false); }; return ( - + {label} diff --git a/src/components/queryBuilder/OrderByEditor.tsx b/src/components/queryBuilder/OrderByEditor.tsx index c2b3dade..ebd00769 100644 --- a/src/components/queryBuilder/OrderByEditor.tsx +++ b/src/components/queryBuilder/OrderByEditor.tsx @@ -122,7 +122,6 @@ export const OrderByEditor = (props: OrderByEditorProps) => { size="sm" onClick={addOrderByItem} className={styles.Common.smallBtn} - style={{ margin: '4px 0 0 0' }} > {addLabel} diff --git a/src/components/queryBuilder/views/TraceQueryBuilder.tsx b/src/components/queryBuilder/views/TraceQueryBuilder.tsx index a8eadebe..efdc9ec0 100644 --- a/src/components/queryBuilder/views/TraceQueryBuilder.tsx +++ b/src/components/queryBuilder/views/TraceQueryBuilder.tsx @@ -181,7 +181,7 @@ export const TraceQueryBuilder = (props: TraceQueryBuilderProps) => { onVersionChange={(v) => builderOptionsDispatch(setOtelVersion(v))} wide /> -
+
{ wide />
-
+
{ wide />
-
+
{ wide />
-
+
{ onChange={onOptionChange('durationUnit')} />
-
+
{ wide />
-
+
{ wide />
-
+
{ wide />
-
+
Date: Thu, 23 Oct 2025 11:42:17 -0600 Subject: [PATCH 13/14] Revert Combobox changes --- src/components/SqlEditor.tsx | 2 +- .../queryBuilder/AggregateEditor.tsx | 53 ++++---- src/components/queryBuilder/ColumnSelect.tsx | 37 +++--- .../queryBuilder/DatabaseTableSelect.tsx | 40 +++--- .../queryBuilder/DurationUnitSelect.tsx | 15 +-- src/components/queryBuilder/FilterEditor.tsx | 119 +++++++++--------- .../queryBuilder/OrderByEditor.test.tsx | 4 +- src/components/queryBuilder/OrderByEditor.tsx | 53 ++++---- .../queryBuilder/OtelVersionSelect.tsx | 19 +-- 9 files changed, 180 insertions(+), 162 deletions(-) diff --git a/src/components/SqlEditor.tsx b/src/components/SqlEditor.tsx index 893b983d..d03e0cf2 100644 --- a/src/components/SqlEditor.tsx +++ b/src/components/SqlEditor.tsx @@ -110,7 +110,7 @@ export const SqlEditor = (props: SqlEditorProps) => { return ( <> -
+
saveChanges({ queryType })} sqlEditor />
diff --git a/src/components/queryBuilder/AggregateEditor.tsx b/src/components/queryBuilder/AggregateEditor.tsx index 76889ced..846632ff 100644 --- a/src/components/queryBuilder/AggregateEditor.tsx +++ b/src/components/queryBuilder/AggregateEditor.tsx @@ -1,19 +1,20 @@ import React, { useState } from 'react'; -import { InlineFormLabel, Combobox, Button, Input, Stack, ComboboxOption } from '@grafana/ui'; +import { SelectableValue } from '@grafana/data'; +import { InlineFormLabel, Select, Button, Input, Stack } from '@grafana/ui'; import { AggregateColumn, AggregateType, TableColumn } from 'types/queryBuilder'; import labels from 'labels'; import { selectors } from 'selectors'; import { styles } from 'styles'; interface AggregateProps { - columnOptions: Array>; + columnOptions: Array>; index: number; aggregate: AggregateColumn; updateAggregate: (index: number, aggregate: AggregateColumn) => void; removeAggregate: (index: number) => void; } -const allAggregateOptions: Array> = [ +const allAggregateOptions: Array> = [ { label: 'Count', value: AggregateType.Count }, { label: 'Sum', value: AggregateType.Sum }, { label: 'Min', value: AggregateType.Min }, @@ -25,6 +26,7 @@ const allAggregateOptions: Array> = [ const Aggregate = (props: AggregateProps) => { const { index, aggregate, updateAggregate, removeAggregate } = props; + const [isOpen, setIsOpen] = useState(false); const [alias, setAlias] = useState(aggregate.alias || ''); const { aliasLabel } = labels.components.AggregatesEditor; @@ -42,24 +44,27 @@ const Aggregate = (props: AggregateProps) => { return ( -
- updateAggregate(index, { ...aggregate, aggregateType: e.value! })} - createCustomValue={true} - /> -
-
- - width={40} - options={columnOptions} - onChange={(e) => updateAggregate(index, { ...aggregate, column: e.value! })} - value={aggregate.column} - createCustomValue={true} - /> -
+ onDatabaseChange(e.value!)} + menuPlacement={'bottom'} + allowCustomValue + > + ); }; @@ -82,14 +82,14 @@ export const TableSelect = (props: TableSelectProps) => { {label} -
- onTableChange(e.value!)} - createCustomValue={true} - > -
+ ); }; @@ -106,7 +106,7 @@ export const DatabaseTableSelect = (props: DatabaseTableSelectProps) => { const { datasource, database, onDatabaseChange, table, onTableChange } = props; return ( -
+
diff --git a/src/components/queryBuilder/DurationUnitSelect.tsx b/src/components/queryBuilder/DurationUnitSelect.tsx index 44ea74a1..7b7b684a 100644 --- a/src/components/queryBuilder/DurationUnitSelect.tsx +++ b/src/components/queryBuilder/DurationUnitSelect.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { TimeUnit } from 'types/queryBuilder'; import allLabels from 'labels'; -import { InlineFormLabel, Combobox, ComboboxOption } from '@grafana/ui'; +import { InlineFormLabel, Select } from '@grafana/ui'; +import { SelectableValue } from '@grafana/data'; import { styles } from 'styles'; interface DurationUnitSelectProps { @@ -11,7 +12,7 @@ interface DurationUnitSelectProps { inline?: boolean; } -const durationUnitOptions: ReadonlyArray> = [ +const durationUnitOptions: ReadonlyArray> = [ { label: TimeUnit.Seconds, value: TimeUnit.Seconds }, { label: TimeUnit.Milliseconds, value: TimeUnit.Milliseconds }, { label: TimeUnit.Microseconds, value: TimeUnit.Microseconds }, @@ -23,7 +24,7 @@ export const DurationUnitSelect = (props: DurationUnitSelectProps) => { const { label, tooltip } = allLabels.components.TraceQueryBuilder.columns.durationUnit; return ( -
+
{ > {label} - + disabled={disabled} - options={durationUnitOptions as Array>} + options={durationUnitOptions as Array>} value={unit} onChange={(v) => onChange(v.value!)} - width={25} - placeholder="Choose" + width={inline ? 25 : 30} + menuPlacement={'bottom'} />
); diff --git a/src/components/queryBuilder/FilterEditor.tsx b/src/components/queryBuilder/FilterEditor.tsx index f0377789..374d96ba 100644 --- a/src/components/queryBuilder/FilterEditor.tsx +++ b/src/components/queryBuilder/FilterEditor.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { SelectableValue } from '@grafana/data'; -import { Button, InlineFormLabel, Input, MultiSelect, RadioButtonGroup, Combobox, ComboboxOption } from '@grafana/ui'; +import { Button, InlineFormLabel, Input, MultiSelect, RadioButtonGroup, Select, Stack } from '@grafana/ui'; import { Filter, FilterOperator, TableColumn, NullFilter } from 'types/queryBuilder'; import * as utils from 'components/queryBuilder/utils'; import labels from 'labels'; @@ -16,7 +16,7 @@ const conditions: Array> = [ { value: 'AND', label: 'AND' }, { value: 'OR', label: 'OR' }, ]; -const filterOperators: Array> = [ +const filterOperators: Array> = [ { value: FilterOperator.WithInGrafanaTimeRange, label: 'Within dashboard time range' }, { value: FilterOperator.OutsideGrafanaTimeRange, label: 'Outside dashboard time range' }, { value: FilterOperator.IsAnything, label: 'IS ANYTHING' }, @@ -35,7 +35,7 @@ const filterOperators: Array> = [ { value: FilterOperator.IsNull, label: 'IS NULL' }, { value: FilterOperator.IsNotNull, label: 'IS NOT NULL' }, ]; -const standardTimeOptions: Array> = [ +const standardTimeOptions: Array> = [ { value: 'today()', label: 'TODAY' }, { value: 'yesterday()', label: 'YESTERDAY' }, { value: 'now()', label: 'NOW' }, @@ -137,12 +137,12 @@ export const FilterValueEditor = (props: { return (
- onDateFilterValueChange(e.value!)} options={dateOptions} width={40} - createCustomValue={true} + allowCustomValue />
); @@ -156,7 +156,7 @@ export const FilterValueEditor = (props: { ) { return (
- onStringFilterValueChange(e.value!)} options={getOptions()} /> + setIsOpen(true)} + onCloseMenu={() => setIsOpen(false)} + onChange={(e) => onFilterNameChange(e.value!)} + allowCustomValue + menuPlacement={'bottom'} + /> + {(isMapType || isJSONType) && ( + onFilterOperatorChange(e.value!)} + menuPlacement={'bottom'} + /> + +