From c226201debf3093e4b60025f886fde84cae4f223 Mon Sep 17 00:00:00 2001 From: nikkikapadia Date: Fri, 18 Jul 2025 10:51:41 -0400 Subject: [PATCH 1/4] lock down tranactions tab completely --- static/app/components/core/tabs/item.tsx | 3 ++ static/app/components/core/tabs/tabList.tsx | 40 ++++++++++++------- .../savedQuery/datasetSelectorTabs.tsx | 33 ++++++++++++++- .../app/views/discover/savedQuery/index.tsx | 36 +++++++++++++++-- 4 files changed, 92 insertions(+), 20 deletions(-) diff --git a/static/app/components/core/tabs/item.tsx b/static/app/components/core/tabs/item.tsx index 7e2944c5488118..4efc79788670aa 100644 --- a/static/app/components/core/tabs/item.tsx +++ b/static/app/components/core/tabs/item.tsx @@ -2,11 +2,14 @@ import {Item as _Item} from '@react-stately/collections'; import type {ItemProps} from '@react-types/shared'; import type {LocationDescriptor} from 'history'; +import type {TooltipProps} from 'sentry/components/core/tooltip'; + export interface TabListItemProps extends ItemProps { key: string | number; disabled?: boolean; hidden?: boolean; to?: LocationDescriptor; + tooltip?: TooltipProps; } export const TabListItem = _Item as (props: TabListItemProps) => React.JSX.Element; diff --git a/static/app/components/core/tabs/tabList.tsx b/static/app/components/core/tabs/tabList.tsx index 07d07b538c3aa8..9af1fd7d83f1eb 100644 --- a/static/app/components/core/tabs/tabList.tsx +++ b/static/app/components/core/tabs/tabList.tsx @@ -11,6 +11,7 @@ import type {Node, Orientation} from '@react-types/shared'; import type {SelectOption} from 'sentry/components/core/compactSelect'; import {CompactSelect} from 'sentry/components/core/compactSelect'; +import {Tooltip} from 'sentry/components/core/tooltip'; import DropdownButton from 'sentry/components/dropdownButton'; import {IconEllipsis} from 'sentry/icons'; import {t} from 'sentry/locale'; @@ -221,6 +222,7 @@ function BaseTabList({ value: key, label: item.props.children, disabled: item.props.disabled, + tooltip: item.props.tooltip, textValue: item.textValue, }; }); @@ -235,20 +237,30 @@ function BaseTabList({ ref={tabListRef} variant={variant} > - {[...state.collection].map(item => ( - { - tabItemsRef.current[item.key] = element; - }} - variant={variant} - /> - ))} + {[...state.collection].map(item => { + const rendered = item.props.tooltip ? ( + {item.rendered} + ) : ( + item.rendered + ); + + return ( + { + tabItemsRef.current[item.key] = element; + }} + variant={variant} + /> + ); + })} {orientation === 'horizontal' && overflowMenuItems.length > 0 && ( diff --git a/static/app/views/discover/savedQuery/datasetSelectorTabs.tsx b/static/app/views/discover/savedQuery/datasetSelectorTabs.tsx index 085a62093412c6..a152b64346a9ca 100644 --- a/static/app/views/discover/savedQuery/datasetSelectorTabs.tsx +++ b/static/app/views/discover/savedQuery/datasetSelectorTabs.tsx @@ -1,6 +1,7 @@ +import {Link} from 'sentry/components/core/link'; import {TabList} from 'sentry/components/core/tabs'; import * as Layout from 'sentry/components/layouts/thirds'; -import {t} from 'sentry/locale'; +import {t, tct} from 'sentry/locale'; import type {SavedQuery} from 'sentry/types/organization'; import type EventView from 'sentry/utils/discover/eventView'; import { @@ -20,6 +21,7 @@ import { getDatasetFromLocationOrSavedQueryDataset, getSavedQueryDataset, } from 'sentry/views/discover/savedQuery/utils'; +import {getExploreUrl} from 'sentry/views/explore/utils'; export const DATASET_PARAM = 'queryDataset'; @@ -107,6 +109,15 @@ export function DatasetSelectorTabs(props: Props) { const value = getSavedQueryDataset(organization, location, savedQuery, splitDecision); + const deprecatingTransactionsDataset = organization.features.includes( + 'discover-saved-queries-deprecation' + ); + + const tracesUrl = getExploreUrl({ + organization, + query: 'is_transaction:true', + }); + const options = [ { value: SavedQueryDatasets.ERRORS, @@ -115,6 +126,18 @@ export function DatasetSelectorTabs(props: Props) { { value: SavedQueryDatasets.TRANSACTIONS, label: DATASET_LABEL_MAP[SavedQueryDatasets.TRANSACTIONS], + disabled: deprecatingTransactionsDataset, + tooltip: deprecatingTransactionsDataset + ? { + title: tct( + 'Discover\u2192Transactions is going to be merged into Explore\u2192Traces soon. Please browse and save any transaction related queries from [traces:Explore\u2192Traces]', + { + traces: , + } + ), + isHoverable: true, + } + : undefined, }, ]; @@ -153,7 +176,13 @@ export function DatasetSelectorTabs(props: Props) { > {options.map(option => ( - {option.label} + + {option.label} + ))} diff --git a/static/app/views/discover/savedQuery/index.tsx b/static/app/views/discover/savedQuery/index.tsx index 8b0450c64e77f6..a19313380c7288 100644 --- a/static/app/views/discover/savedQuery/index.tsx +++ b/static/app/views/discover/savedQuery/index.tsx @@ -393,19 +393,46 @@ class SavedQueryButtonGroup extends PureComponent { renderButtonSave(disabled: boolean) { const {isNewQuery, isEditingQuery} = this.state; + const {organization, savedQuery, location} = this.props; + + const currentDataset = getDatasetFromLocationOrSavedQueryDataset( + location, + savedQuery?.queryDataset + ); + + const deprecatingTransactionsDataset = + currentDataset === DiscoverDatasets.TRANSACTIONS && + organization.features.includes('discover-saved-queries-deprecation'); if (!isNewQuery && !isEditingQuery) { return null; } // Existing query with edits, show save and save as. if (!isNewQuery && isEditingQuery) { + const tracesUrl = getExploreUrl({ + organization, + query: 'is_transaction:true', + }); + return ( + + {this.renderButtonSaveAs(disabled)} );