forked from getsentry/sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(insights): update module title for http module in the frontend (g…
…etsentry#79690) Work for getsentry#77572 This PR ensures frontend domain calls the HTTP module `Network Requests` in the frontend view, and `Outbound Api Requests` in backend <img width="832" alt="image" src="https://github.com/user-attachments/assets/a24a2877-8b90-49bc-a7a3-d8ff1843715e"> This is done using a new hook called `useModuleTitle` which will return the correct title depending on the current domain view. (Similar to `useModuleUrl`)
- Loading branch information
1 parent
63d405b
commit 078f682
Showing
7 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {useMemo} from 'react'; | ||
|
||
import {DOMAIN_VIEW_MODULE_TITLES} from 'sentry/views/insights/common/utils/moduleTitles'; | ||
import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters'; | ||
import {MODULE_TITLES} from 'sentry/views/insights/settings'; | ||
import type {ModuleName} from 'sentry/views/insights/types'; | ||
|
||
export const useModuleTitles = (): Record<ModuleName, string> => { | ||
const {isInDomainView, view} = useDomainViewFilters(); | ||
const moduleTitles = useMemo(() => { | ||
let titles = {...MODULE_TITLES}; | ||
if (isInDomainView && view) { | ||
titles = {...MODULE_TITLES, ...DOMAIN_VIEW_MODULE_TITLES[view]}; | ||
} | ||
return titles; | ||
}, [isInDomainView, view]); | ||
|
||
return moduleTitles; | ||
}; | ||
|
||
export const useModuleTitle = (moduleName: ModuleName): string => { | ||
return useModuleTitles()[moduleName]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters