123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import ExternalLink from 'sentry/components/links/externalLink';
- import {t, tct} from 'sentry/locale';
- import type {TagCollection} from 'sentry/types/group';
- import type {Organization} from 'sentry/types/organization';
- import type {QueryFieldValue} from 'sentry/utils/discover/fields';
- import useCustomMeasurements from 'sentry/utils/useCustomMeasurements';
- import {getDatasetConfig} from 'sentry/views/dashboards/datasetConfig/base';
- import type {DisplayType, WidgetQuery, WidgetType} from 'sentry/views/dashboards/types';
- import {hasDatasetSelector} from 'sentry/views/dashboards/utils';
- import {addIncompatibleFunctions, DataSet} from '../../utils';
- import {BuildStep} from '../buildStep';
- import {ColumnFields} from './columnFields';
- interface Props {
- dataSet: DataSet;
- displayType: DisplayType;
- explodedFields: QueryFieldValue[];
- handleColumnFieldChange: (newFields: QueryFieldValue[]) => void;
- isOnDemandWidget: boolean;
- onQueryChange: (queryIndex: number, newQuery: WidgetQuery) => void;
- organization: Organization;
- tags: TagCollection;
- widgetType: WidgetType;
- queryErrors?: Record<string, any>[];
- }
- export function ColumnsStep({
- dataSet,
- displayType,
- organization,
- widgetType,
- handleColumnFieldChange,
- queryErrors,
- explodedFields,
- tags,
- isOnDemandWidget,
- }: Props) {
- const {customMeasurements} = useCustomMeasurements();
- const datasetConfig = getDatasetConfig(widgetType);
- const fieldOptions = datasetConfig.getTableFieldOptions(
- organization,
- tags,
- customMeasurements
- );
- // We need to persist the form values across Errors and Transactions datasets
- // for the discover dataset split, so functions that are not compatible with
- // errors should still appear in the field options to gracefully handle incorrect
- // dataset splitting.
- if (
- hasDatasetSelector(organization) &&
- [DataSet.ERRORS, DataSet.TRANSACTIONS].includes(dataSet)
- ) {
- addIncompatibleFunctions(explodedFields, fieldOptions);
- }
- return (
- <BuildStep
- data-test-id="choose-column-step"
- title={t('Choose your columns')}
- description={
- dataSet === DataSet.ISSUES
- ? tct(
- '[fieldTagLink: Field and tag] columns will help you view more details about the issues (e.g., title).',
- {
- fieldTagLink: (
- <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
- ),
- }
- )
- : dataSet === DataSet.RELEASES
- ? tct(
- 'To stack sessions, add [functionLink: functions] f(x) that may take in additional parameters. [fieldTagLink: Field and tag] columns will help you view more details about the sessions (e.g., releases).',
- {
- functionLink: (
- <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
- ),
- fieldTagLink: (
- <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#release-properties" />
- ),
- }
- )
- : tct(
- 'To stack events, add [functionLink: functions] f(x) that may take in additional parameters. [fieldTagLink: Field and tag] columns will help you view more details about the events (e.g., title).',
- {
- functionLink: (
- <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
- ),
- fieldTagLink: (
- <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
- ),
- }
- )
- }
- >
- <ColumnFields
- displayType={displayType}
- organization={organization}
- widgetType={widgetType}
- fields={explodedFields}
- errors={queryErrors}
- fieldOptions={fieldOptions}
- isOnDemandWidget={isOnDemandWidget}
- filterAggregateParameters={datasetConfig.filterAggregateParams}
- filterPrimaryOptions={datasetConfig.filterTableOptions}
- onChange={handleColumnFieldChange}
- />
- </BuildStep>
- );
- }
|