123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- import {Location, LocationDescriptor, Path} from 'history';
- import {Organization, Project} from 'sentry/types';
- import {Trace} from 'sentry/types/profiling/core';
- export function generateProfilingRoute({orgSlug}: {orgSlug: Organization['slug']}): Path {
- return `/organizations/${orgSlug}/profiling/`;
- }
- export function generateProfilingOnboardingRoute({
- orgSlug,
- }: {
- orgSlug: Organization['slug'];
- }): Path {
- return `/organizations/${orgSlug}/profiling/onboarding/`;
- }
- export function generateProfileSummaryRoute({
- orgSlug,
- projectSlug,
- }: {
- orgSlug: Organization['slug'];
- projectSlug: Project['slug'];
- }): Path {
- return `/organizations/${orgSlug}/profiling/summary/${projectSlug}/`;
- }
- export function generateProfileFlamegraphRoute({
- orgSlug,
- projectSlug,
- profileId,
- }: {
- orgSlug: Organization['slug'];
- profileId: Trace['id'];
- projectSlug: Project['slug'];
- }): string {
- return `/organizations/${orgSlug}/profiling/profile/${projectSlug}/${profileId}/flamegraph/`;
- }
- export function generateProfileDetailsRoute({
- orgSlug,
- projectSlug,
- profileId,
- }: {
- orgSlug: Organization['slug'];
- profileId: Trace['id'];
- projectSlug: Project['slug'];
- }): string {
- return `/organizations/${orgSlug}/profiling/profile/${projectSlug}/${profileId}/details/`;
- }
- export function generateProfilingRouteWithQuery({
- location,
- orgSlug,
- query,
- }: {
- orgSlug: Organization['slug'];
- location?: Location;
- query?: Location['query'];
- }): LocationDescriptor {
- const pathname = generateProfilingRoute({orgSlug});
- return {
- pathname,
- query: {
- ...location?.query,
- ...query,
- },
- };
- }
- export function generateProfileSummaryRouteWithQuery({
- location,
- orgSlug,
- projectSlug,
- transaction,
- query,
- }: {
- orgSlug: Organization['slug'];
- projectSlug: Project['slug'];
- transaction: string;
- location?: Location;
- query?: Location['query'];
- }): LocationDescriptor {
- const pathname = generateProfileSummaryRoute({orgSlug, projectSlug});
- return {
- pathname,
- query: {
- ...location?.query,
- ...query,
- transaction,
- },
- };
- }
- export function generateProfileFlamegraphRouteWithQuery({
- location,
- orgSlug,
- projectSlug,
- profileId,
- query,
- }: {
- orgSlug: Organization['slug'];
- profileId: Trace['id'];
- projectSlug: Project['slug'];
- location?: Location;
- query?: Location['query'];
- }): LocationDescriptor {
- const pathname = generateProfileFlamegraphRoute({orgSlug, projectSlug, profileId});
- return {
- pathname,
- query: {
- ...location?.query,
- ...query,
- },
- };
- }
- export function generateProfileDetailsRouteWithQuery({
- location,
- orgSlug,
- projectSlug,
- profileId,
- query,
- }: {
- orgSlug: Organization['slug'];
- profileId: Trace['id'];
- projectSlug: Project['slug'];
- location?: Location;
- query?: Location['query'];
- }): LocationDescriptor {
- const pathname = generateProfileDetailsRoute({orgSlug, projectSlug, profileId});
- return {
- pathname,
- query: {
- ...location?.query,
- ...query,
- },
- };
- }
|