index.tsx 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/dashboardsV2/datasetConfig/base';
  7. import {DisplayType, WidgetQuery, WidgetType} from 'sentry/views/dashboardsV2/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. title={t('Choose your columns')}
  38. description={
  39. dataSet === DataSet.ISSUES
  40. ? tct(
  41. '[fieldTagLink: Field and tag] columns will help you view more details about the issues (e.g., title).',
  42. {
  43. fieldTagLink: (
  44. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
  45. ),
  46. }
  47. )
  48. : dataSet === DataSet.RELEASES
  49. ? tct(
  50. '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).',
  51. {
  52. functionLink: (
  53. <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
  54. ),
  55. fieldTagLink: (
  56. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#release-properties" />
  57. ),
  58. }
  59. )
  60. : tct(
  61. '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).',
  62. {
  63. functionLink: (
  64. <ExternalLink href="https://docs.sentry.io/product/discover-queries/query-builder/#filter-by-table-columns" />
  65. ),
  66. fieldTagLink: (
  67. <ExternalLink href="https://docs.sentry.io/product/sentry-basics/search/searchable-properties/#event-properties" />
  68. ),
  69. }
  70. )
  71. }
  72. >
  73. <ColumnFields
  74. displayType={displayType}
  75. organization={organization}
  76. widgetType={widgetType}
  77. fields={explodedFields}
  78. errors={queryErrors}
  79. fieldOptions={datasetConfig.getTableFieldOptions(
  80. organization,
  81. tags,
  82. customMeasurements
  83. )}
  84. filterAggregateParameters={datasetConfig.filterAggregateParams}
  85. filterPrimaryOptions={datasetConfig.filterTableOptions}
  86. onChange={handleColumnFieldChange}
  87. />
  88. </BuildStep>
  89. );
  90. }