-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(dashboards): temporary filters broken when changing values #104482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
1befac4
365dd7a
d908a59
7df88df
59a2f78
828b93e
7c4531c
842d629
2f9c008
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilt | |
| import {t} from 'sentry/locale'; | ||
| import {space} from 'sentry/styles/space'; | ||
| import type {User} from 'sentry/types/user'; | ||
| import {defined} from 'sentry/utils'; | ||
| import {trackAnalytics} from 'sentry/utils/analytics'; | ||
| import {ToggleOnDemand} from 'sentry/utils/performance/contexts/onDemandControl'; | ||
| import {ReleasesProvider} from 'sentry/utils/releases/releasesProvider'; | ||
|
|
@@ -28,6 +29,10 @@ import { | |
| getCombinedDashboardFilters, | ||
| getDashboardFiltersFromURL, | ||
| } from 'sentry/views/dashboards/utils'; | ||
| import { | ||
| PREBUILT_DASHBOARDS, | ||
| type PrebuiltDashboardId, | ||
| } from 'sentry/views/dashboards/utils/prebuiltConfigs'; | ||
|
|
||
| import {checkUserHasEditAccess} from './utils/checkUserHasEditAccess'; | ||
| import ReleasesSelectControl from './releasesSelectControl'; | ||
|
|
@@ -44,9 +49,9 @@ type FiltersBarProps = { | |
| onDashboardFilterChange: (activeFilters: DashboardFilters) => void; | ||
| dashboardCreator?: User; | ||
| dashboardPermissions?: DashboardPermissions; | ||
| isPrebuiltDashboard?: boolean; | ||
| onCancel?: () => void; | ||
| onSave?: () => Promise<void>; | ||
| prebuiltDashboardId?: PrebuiltDashboardId; | ||
| shouldBusySaveButton?: boolean; | ||
| }; | ||
|
|
||
|
|
@@ -63,14 +68,18 @@ export default function FiltersBar({ | |
| onDashboardFilterChange, | ||
| onSave, | ||
| shouldBusySaveButton, | ||
| isPrebuiltDashboard, | ||
| prebuiltDashboardId, | ||
| }: FiltersBarProps) { | ||
| const {selection} = usePageFilters(); | ||
| const organization = useOrganization(); | ||
| const currentUser = useUser(); | ||
| const {teams: userTeams} = useUserTeams(); | ||
| const getSearchBarData = useDatasetSearchBarData(); | ||
| const hasDrillDownFlowsFeature = useHasDrillDownFlows(); | ||
| const isPrebuiltDashboard = defined(prebuiltDashboardId); | ||
| const prebuiltDashboardFilters: GlobalFilter[] = prebuiltDashboardId | ||
| ? (PREBUILT_DASHBOARDS[prebuiltDashboardId].filters.globalFilter ?? []) | ||
| : []; | ||
|
Comment on lines
+73
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing validation for 🔍 Detailed AnalysisThe code at 💡 Suggested FixBefore accessing 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typing wouldn't allow this |
||
|
|
||
| const hasEditAccess = checkUserHasEditAccess( | ||
| currentUser, | ||
|
|
@@ -106,9 +115,12 @@ export default function FiltersBar({ | |
|
|
||
| const updateGlobalFilters = (newGlobalFilters: GlobalFilter[]) => { | ||
| setActiveGlobalFilters(newGlobalFilters); | ||
| const temporaryFilters = newGlobalFilters.filter(filter => filter.isTemporary); | ||
| const globalFilters = newGlobalFilters.filter(filter => !filter.isTemporary); | ||
| onDashboardFilterChange({ | ||
| [DashboardFilterKeys.RELEASE]: selectedReleases, | ||
| [DashboardFilterKeys.GLOBAL_FILTER]: newGlobalFilters, | ||
| [DashboardFilterKeys.GLOBAL_FILTER]: globalFilters, | ||
| [DashboardFilterKeys.TEMPORARY_FILTERS]: temporaryFilters, | ||
| }); | ||
| }; | ||
|
|
||
|
|
@@ -163,6 +175,14 @@ export default function FiltersBar({ | |
| <Fragment> | ||
| {activeGlobalFilters.map(filter => ( | ||
| <GenericFilterSelector | ||
| disableRemoveFilter={ | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| isPrebuiltDashboard && | ||
| prebuiltDashboardFilters.some( | ||
| prebuiltFilter => | ||
| prebuiltFilter.tag.key === filter.tag.key && | ||
| prebuiltFilter.dataset === filter.dataset | ||
| ) | ||
| } | ||
| key={filter.tag.key + filter.value} | ||
| globalFilter={filter} | ||
| searchBarData={getSearchBarData(filter.dataset)} | ||
DominikB2014 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.