From 8c7b42d9ba9b0efe238cbbfd2a2f0f90c7cc81d2 Mon Sep 17 00:00:00 2001 From: Darren Janeczek <38694490+darrenjaneczek@users.noreply.github.com> Date: Wed, 30 Aug 2023 14:18:37 -0400 Subject: [PATCH] fix: make URLs modifiable in code (#2337) * fix: make URLs modifiable in code --- .../app/hooks/navigateUserIntroPages.hook.ts | 2 +- public/app/pages/IntroPages/SignIn/index.tsx | 2 +- public/app/pages/IntroPages/SignUp/index.tsx | 2 +- public/app/pages/TagExplorerView.tsx | 2 +- public/app/pages/constants.ts | 20 ------------------- .../tagExplorer/components/TagsSelector.tsx | 2 +- public/app/pages/urls.ts | 20 +++++++++++++++++++ 7 files changed, 25 insertions(+), 25 deletions(-) delete mode 100644 public/app/pages/constants.ts create mode 100644 public/app/pages/urls.ts diff --git a/public/app/hooks/navigateUserIntroPages.hook.ts b/public/app/hooks/navigateUserIntroPages.hook.ts index a5fad9efb0..281be81055 100644 --- a/public/app/hooks/navigateUserIntroPages.hook.ts +++ b/public/app/hooks/navigateUserIntroPages.hook.ts @@ -5,7 +5,7 @@ import { selectCurrentUser, } from '@pyroscope/redux/reducers/user'; import { useHistory } from 'react-router-dom'; -import { PAGES } from '@pyroscope/pages/constants'; +import { PAGES } from '@pyroscope/pages/urls'; export default function useNavigateUserIntroPages() { const dispatch = useAppDispatch(); diff --git a/public/app/pages/IntroPages/SignIn/index.tsx b/public/app/pages/IntroPages/SignIn/index.tsx index c1361ae048..b164cbdf99 100644 --- a/public/app/pages/IntroPages/SignIn/index.tsx +++ b/public/app/pages/IntroPages/SignIn/index.tsx @@ -14,7 +14,7 @@ import { isInternalAuthEnabled, isSignupEnabled, } from '@pyroscope/util/features'; -import { PAGES } from '@pyroscope/pages/constants'; +import { PAGES } from '@pyroscope/pages/urls'; import { GitlabIcon, GoogleIcon } from '../Icons'; import Divider from '../Divider'; import inputStyles from '../InputGroup.module.css'; diff --git a/public/app/pages/IntroPages/SignUp/index.tsx b/public/app/pages/IntroPages/SignUp/index.tsx index 7c0c373301..a499544ebb 100644 --- a/public/app/pages/IntroPages/SignUp/index.tsx +++ b/public/app/pages/IntroPages/SignUp/index.tsx @@ -11,7 +11,7 @@ import { isSignupEnabled } from '@pyroscope/util/features'; import inputStyles from '../InputGroup.module.css'; import styles from '../IntroPages.module.css'; import Divider from '../Divider'; -import { PAGES } from '../../constants'; +import { PAGES } from '../../urls'; function SignUpPage() { const dispatch = useAppDispatch(); diff --git a/public/app/pages/TagExplorerView.tsx b/public/app/pages/TagExplorerView.tsx index bdb28428f9..0744a8b443 100644 --- a/public/app/pages/TagExplorerView.tsx +++ b/public/app/pages/TagExplorerView.tsx @@ -40,7 +40,7 @@ import ExploreTooltip from '@pyroscope/components/TimelineChart/ExploreTooltip'; import { getFormatter } from '@pyroscope/legacy/flamegraph/format/format'; import { LoadingOverlay } from '@pyroscope/ui/LoadingOverlay'; import { calculateMean, calculateStdDeviation, calculateTotal } from './math'; -import { PAGES } from './constants'; +import { PAGES } from './urls'; import { addSpaces, getIntegerSpaceLengthForString, diff --git a/public/app/pages/constants.ts b/public/app/pages/constants.ts deleted file mode 100644 index 6371d680a9..0000000000 --- a/public/app/pages/constants.ts +++ /dev/null @@ -1,20 +0,0 @@ -export enum PAGES { - CONTINOUS_SINGLE_VIEW = '/', - COMPARISON_VIEW = '/comparison', - COMPARISON_DIFF_VIEW = '/comparison-diff', - SETTINGS = '/settings', - LOGIN = '/login', - SIGNUP = '/signup', - SERVICE_DISCOVERY = '/service-discovery', - ADHOC_SINGLE = '/adhoc-single', - ADHOC_COMPARISON = '/adhoc-comparison', - ADHOC_COMPARISON_DIFF = '/adhoc-comparison-diff', - FORBIDDEN = '/forbidden', - TAG_EXPLORER = '/explore', - TRACING_EXEMPLARS_MERGE = '/exemplars/merge', - TRACING_EXEMPLARS_SINGLE = '/exemplars/single', -} - -export default { - PAGES, -}; diff --git a/public/app/pages/tagExplorer/components/TagsSelector.tsx b/public/app/pages/tagExplorer/components/TagsSelector.tsx index e9ac2bdac0..2e6e0d4e72 100644 --- a/public/app/pages/tagExplorer/components/TagsSelector.tsx +++ b/public/app/pages/tagExplorer/components/TagsSelector.tsx @@ -6,7 +6,7 @@ import { useAppDispatch } from '@pyroscope/redux/hooks'; import { actions } from '@pyroscope/redux/reducers/continuous'; import { appendLabelToQuery } from '@pyroscope/util/query'; import { brandQuery } from '@pyroscope/models/query'; -import { PAGES } from '@pyroscope/pages/constants'; +import { PAGES } from '@pyroscope/pages/urls'; import ModalWithToggle from '@pyroscope/ui/Modals/ModalWithToggle'; import styles from './TagsSelector.module.scss'; diff --git a/public/app/pages/urls.ts b/public/app/pages/urls.ts new file mode 100644 index 0000000000..93920b1e9b --- /dev/null +++ b/public/app/pages/urls.ts @@ -0,0 +1,20 @@ +export const PAGES = { + CONTINOUS_SINGLE_VIEW: '/', + COMPARISON_VIEW: '/comparison', + COMPARISON_DIFF_VIEW: '/comparison-diff', + SETTINGS: '/settings', + LOGIN: '/login', + SIGNUP: '/signup', + SERVICE_DISCOVERY: '/service-discovery', + ADHOC_SINGLE: '/adhoc-single', + ADHOC_COMPARISON: '/adhoc-comparison', + ADHOC_COMPARISON_DIFF: '/adhoc-comparison-diff', + FORBIDDEN: '/forbidden', + TAG_EXPLORER: '/explore', + TRACING_EXEMPLARS_MERGE: '/exemplars/merge', + TRACING_EXEMPLARS_SINGLE: '/exemplars/single', +}; + +export default { + PAGES, +};