@@ -52,7 +52,9 @@ import useRouter from 'sentry/utils/useRouter';
5252import withPageFilters from 'sentry/utils/withPageFilters' ;
5353import { DisplayType , Widget , WidgetType } from 'sentry/views/dashboards/types' ;
5454import {
55+ dashboardFiltersToString ,
5556 eventViewFromWidget ,
57+ getDashboardFiltersFromURL ,
5658 getFieldsFromEquations ,
5759 getNumEquations ,
5860 getWidgetDiscoverUrl ,
@@ -244,6 +246,7 @@ function WidgetViewerModal(props: Props) {
244246
245247 // Get table sort settings from location
246248 const sort = decodeScalar ( location . query [ WidgetViewerQueryField . SORT ] ) ;
249+
247250 const sortedQueries = cloneDeep (
248251 sort ? widget . queries . map ( query => ( { ...query , orderby : sort } ) ) : widget . queries
249252 ) ;
@@ -385,7 +388,15 @@ function WidgetViewerModal(props: Props) {
385388
386389 const queryOptions = sortedQueries . map ( ( { name, conditions} , index ) => {
387390 // Creates the highlighted query elements to be used in the Query Select
388- const parsedQuery = ! name && ! ! conditions ? parseSearch ( conditions ) : null ;
391+ const dashboardFilters = dashboardFiltersToString (
392+ getDashboardFiltersFromURL ( location )
393+ ) ;
394+ const parsedQuery =
395+ ! name && ! ! conditions
396+ ? parseSearch (
397+ conditions + ( dashboardFilters === '' ? '' : ` ${ dashboardFilters } ` )
398+ )
399+ : null ;
389400 const getHighlightedQuery = (
390401 highlightedContainerProps : React . ComponentProps < typeof HighlightContainer >
391402 ) => {
@@ -728,6 +739,7 @@ function WidgetViewerModal(props: Props) {
728739 : HALF_TABLE_ITEM_LIMIT
729740 }
730741 cursor = { cursor }
742+ dashboardFilters = { getDashboardFiltersFromURL ( location ) ?? undefined }
731743 >
732744 { renderIssuesTable }
733745 </ IssueWidgetQueries >
@@ -752,6 +764,7 @@ function WidgetViewerModal(props: Props) {
752764 : HALF_TABLE_ITEM_LIMIT
753765 }
754766 cursor = { cursor }
767+ dashboardFilters = { getDashboardFiltersFromURL ( location ) ?? undefined }
755768 >
756769 { renderReleaseTable }
757770 </ ReleaseWidgetQueries >
@@ -779,6 +792,7 @@ function WidgetViewerModal(props: Props) {
779792 : HALF_TABLE_ITEM_LIMIT
780793 }
781794 cursor = { cursor }
795+ dashboardFilters = { getDashboardFiltersFromURL ( location ) ?? undefined }
782796 >
783797 { ( { tableResults, loading, pageLinks} ) => (
784798 < DiscoverTable
@@ -839,6 +853,7 @@ function WidgetViewerModal(props: Props) {
839853 api = { api }
840854 organization = { organization }
841855 selection = { modalChartSelection . current }
856+ dashboardFilters = { getDashboardFiltersFromURL ( location ) ?? undefined }
842857 // Top N charts rely on the orderby of the table
843858 widget = { primaryWidget }
844859 onZoom = { onZoom }
0 commit comments