index.tsx 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 {getDatasetConfig} from 'sentry/views/dashboards/datasetConfig/base';
  6. import {DisplayType, WidgetQuery, WidgetType} from 'sentry/views/dashboards/types';
  7. import {DataSet, useTableFieldOptions} from '../../utils';
  8. import {BuildStep} from '../buildStep';
  9. import {ColumnFields} from './columnFields';
  10. interface Props {
  11. dataSet: DataSet;
  12. displayType: DisplayType;
  13. explodedFields: QueryFieldValue[];
  14. handleColumnFieldChange: (newFields: QueryFieldValue[]) => void;
  15. onQueryChange: (queryIndex: number, newQuery: WidgetQuery) => void;
  16. organization: Organization;
  17. queries: WidgetQuery[];
  18. tags: TagCollection;
  19. widgetType: WidgetType;
  20. queryErrors?: Record<string, any>[];
  21. }
  22. export function ColumnsStep({
  23. dataSet,
  24. displayType,
  25. organization,
  26. widgetType,
  27. handleColumnFieldChange,
  28. queryErrors,
  29. explodedFields,
  30. tags,
  31. }: Props) {
  32. const datasetConfig = getDatasetConfig(widgetType);
  33. const fieldOptions = useTableFieldOptions(organization, tags, widgetType);
  34. return (
  35. <BuildStep
  36. data-test-id="choose-column-step"
  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={fieldOptions}
  80. filterAggregateParameters={datasetConfig.filterAggregateParams}
  81. filterPrimaryOptions={datasetConfig.filterTableOptions}
  82. onChange={handleColumnFieldChange}
  83. />
  84. </BuildStep>
  85. );
  86. }