index.tsx 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import ExternalLink from 'sentry/components/links/externalLink';
  2. import {t, tct} from 'sentry/locale';
  3. import {Organization, TagCollection} from 'sentry/types';
  4. import {QueryFieldValue} from 'sentry/utils/discover/fields';
  5. import useCustomMeasurements from 'sentry/utils/useCustomMeasurements';
  6. import {getDatasetConfig} from 'sentry/views/dashboards/datasetConfig/base';
  7. import {DisplayType, WidgetQuery, WidgetType} from 'sentry/views/dashboards/types';
  8. import {DataSet} from '../../utils';
  9. import {BuildStep} from '../buildStep';
  10. import {ColumnFields} from './columnFields';
  11. interface Props {
  12. dataSet: DataSet;
  13. displayType: DisplayType;
  14. explodedFields: QueryFieldValue[];
  15. handleColumnFieldChange: (newFields: QueryFieldValue[]) => void;
  16. onQueryChange: (queryIndex: number, newQuery: WidgetQuery) => void;
  17. organization: Organization;
  18. queries: WidgetQuery[];
  19. tags: TagCollection;
  20. widgetType: WidgetType;
  21. queryErrors?: Record<string, any>[];
  22. }
  23. export function ColumnsStep({
  24. dataSet,
  25. displayType,
  26. organization,
  27. widgetType,
  28. handleColumnFieldChange,
  29. queryErrors,
  30. explodedFields,
  31. tags,
  32. }: Props) {
  33. const {customMeasurements} = useCustomMeasurements();
  34. const datasetConfig = getDatasetConfig(widgetType);
  35. return (
  36. <BuildStep
  37. data-test-id="choose-column-step"
  38. title={t('Choose your columns')}
  39. description={
  40. dataSet === DataSet.ISSUES
  41. ? tct(
  42. '[fieldTagLink: Field and tag] columns will help you view more details about the issues (e.g., title).',
  43. {
  44. fieldTagLink: (
  45. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
  46. ),
  47. }
  48. )
  49. : dataSet === DataSet.RELEASES
  50. ? tct(
  51. '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).',
  52. {
  53. functionLink: (
  54. <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
  55. ),
  56. fieldTagLink: (
  57. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#release-properties" />
  58. ),
  59. }
  60. )
  61. : tct(
  62. '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).',
  63. {
  64. functionLink: (
  65. <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
  66. ),
  67. fieldTagLink: (
  68. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
  69. ),
  70. }
  71. )
  72. }
  73. >
  74. <ColumnFields
  75. displayType={displayType}
  76. organization={organization}
  77. widgetType={widgetType}
  78. fields={explodedFields}
  79. errors={queryErrors}
  80. fieldOptions={datasetConfig.getTableFieldOptions(
  81. organization,
  82. tags,
  83. customMeasurements
  84. )}
  85. filterAggregateParameters={datasetConfig.filterAggregateParams}
  86. filterPrimaryOptions={datasetConfig.filterTableOptions}
  87. onChange={handleColumnFieldChange}
  88. />
  89. </BuildStep>
  90. );
  91. }