index.tsx 3.7 KB

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