Skip to content

Commit

Permalink
fix: reparent ROUTES type to routing/types
Browse files Browse the repository at this point in the history
  • Loading branch information
ckbedwell committed Nov 26, 2024
1 parent 1f550c6 commit e616da3
Show file tree
Hide file tree
Showing 54 changed files with 95 additions and 69 deletions.
3 changes: 2 additions & 1 deletion src/components/AlertStatus/AlertStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { GrafanaTheme2 } from '@grafana/data';
import { Icon, IconButton, LinkButton, Tooltip, useStyles2, useTheme2 } from '@grafana/ui';
import { css, cx } from '@emotion/css';

import { AlertSensitivity, Check, PrometheusAlertsGroup, ROUTES } from 'types';
import { AlertSensitivity, Check, PrometheusAlertsGroup } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useAlertRules } from 'hooks/useAlertRules';
import { useMetricsDS } from 'hooks/useMetricsDS';
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Alert, Button, Spinner, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';
import { DataTestIds } from 'test/dataTestIds';

import { ROUTES } from 'types';
import { hasGlobalPermission } from 'utils';
import { ROUTES } from 'routing/types';
import { useAppInitializer } from 'hooks/useAppInitializer';
import { useMeta } from 'hooks/useMeta';
import { MismatchedDatasourceModal } from 'components/MismatchedDatasourceModal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Alert, LinkButton, Stack, TextLink } from '@grafana/ui';
import { useLocalStorage } from 'usehooks-ts';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';

export const PrivateProbesAlert = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/CheckForm/CheckForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { css } from '@emotion/css';
import { zodResolver } from '@hookform/resolvers/zod';
import { DataTestIds } from 'test/dataTestIds';

import { Check, CheckFormValues, CheckType, ROUTES } from 'types';
import { Check, CheckFormValues, CheckType } from 'types';
import { createNavModel } from 'utils';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { AdHocCheckResponse } from 'datasource/responses.types';
import { useCheckTypeGroupOption } from 'hooks/useCheckTypeGroupOptions';
Expand Down
3 changes: 2 additions & 1 deletion src/components/CheckForm/checkForm.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { ScriptedCheckSchema } from 'schemas/forms/ScriptedCheckSchema';
import { TCPCheckSchema } from 'schemas/forms/TCPCheckSchema';
import { TracerouteCheckSchema } from 'schemas/forms/TracerouteCheckSchema';

import { Check, CheckFormValues, CheckType, ROUTES } from 'types';
import { Check, CheckFormValues, CheckType } from 'types';
import { ROUTES } from 'routing/types';
import { AdHocCheckResponse } from 'datasource/responses.types';
import { useCUDChecks, useTestCheck } from 'data/useChecks';
import { useNavigation } from 'hooks/useNavigation';
Expand Down
2 changes: 1 addition & 1 deletion src/components/CheckList/AddNewCheckButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Button } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { useCanWriteSM } from 'hooks/useDSPermission';
import { useNavigation } from 'hooks/useNavigation';

Expand Down
3 changes: 2 additions & 1 deletion src/components/CheckList/CheckList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { render } from 'test/render';
import { server } from 'test/server';
import { getSelect, selectOption } from 'test/utils';

import { Check, FeatureName, ROUTES } from 'types';
import { Check, FeatureName } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';

import { CheckList } from './CheckList';
Expand Down
2 changes: 1 addition & 1 deletion src/components/CheckList/EmptyCheckList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { GrafanaTheme2 } from '@grafana/data';
import { Button, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { useNavigation } from 'hooks/useNavigation';

const getStyles = (theme: GrafanaTheme2) => ({
Expand Down
3 changes: 2 additions & 1 deletion src/components/CheckListItem/CheckItemActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { GrafanaTheme2 } from '@grafana/data';
import { ConfirmModal, IconButton, LinkButton, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';

import { Check, ROUTES } from 'types';
import { Check } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath, getRoute } from 'routing/utils';
import { useDeleteCheck } from 'data/useChecks';
import { useCanReadMetrics, useCanWriteSM } from 'hooks/useDSPermission';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ChooseCheckGroup/CheckGroupCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Icon, LinkButton, Stack, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';
import { DataTestIds } from 'test/dataTestIds';

import { CheckTypeGroup, ROUTES } from 'types';
import { CheckTypeGroup } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { CheckTypeGroupOption } from 'hooks/useCheckTypeGroupOptions';
import { useCheckTypeOptions } from 'hooks/useCheckTypeOptions';
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useState } from 'react';
import { getBackendSrv } from '@grafana/runtime';
import { Button, LinkButton } from '@grafana/ui';

import { ROUTES } from 'types';
import { hasGlobalPermission } from 'utils';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useMeta } from 'hooks/useMeta';

Expand Down
2 changes: 1 addition & 1 deletion src/components/OverLimitAlert/BrowserCheckLimitAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useLimits } from 'hooks/useLimits';
import { Ul } from 'components/Ul';
Expand Down
2 changes: 1 addition & 1 deletion src/components/OverLimitAlert/CheckLimitAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useLimits } from 'hooks/useLimits';
import { Ul } from 'components/Ul';
Expand Down
2 changes: 1 addition & 1 deletion src/components/OverLimitAlert/ExecutionLimitAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { FREE_EXECUTION_LIMIT } from 'hooks/useAtHgExecutionLimit';
import { Ul } from 'components/Ul';
Expand Down
2 changes: 1 addition & 1 deletion src/components/OverLimitAlert/ScriptedCheckLimitAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useLimits } from 'hooks/useLimits';
import { Ul } from 'components/Ul';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProbeCard/ProbeCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { OFFLINE_PROBE, ONLINE_PROBE, PRIVATE_PROBE, PUBLIC_PROBE } from 'test/f
import { render } from 'test/render';
import { probeToExtendedProbe, runTestAsViewer } from 'test/utils';

import { type ExtendedProbe, ROUTES } from 'types';
import { type ExtendedProbe } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';

import { ProbeCard } from './ProbeCard';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProbeCard/ProbeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { GrafanaTheme2 } from '@grafana/data';
import { Card, Link, LinkButton, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';

import { type ExtendedProbe, type Label, ROUTES } from 'types';
import { type ExtendedProbe, type Label } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { useCanEditProbe } from 'hooks/useCanEditProbe';
import { SuccessRateGaugeProbe } from 'components/Gauges';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProbeEditor/ProbeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { css } from '@emotion/css';
import { zodResolver } from '@hookform/resolvers/zod';
import { ProbeSchema } from 'schemas/forms/ProbeSchema';

import { ExtendedProbe, FeatureName, Probe, ROUTES } from 'types';
import { ExtendedProbe, FeatureName, Probe } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useCanEditProbe } from 'hooks/useCanEditProbe';
import { FeatureFlag } from 'components/FeatureFlag';
Expand Down
3 changes: 2 additions & 1 deletion src/components/ProbeUsageLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React from 'react';
import { ThemeTypographyVariantTypes } from '@grafana/data';
import { TextLink } from '@grafana/ui';

import { ExtendedProbe, ROUTES } from 'types';
import { ExtendedProbe } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';

import { DataTestIds } from '../test/dataTestIds';
Expand Down
2 changes: 1 addition & 1 deletion src/components/SceneRedirecter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Navigate } from 'react-router-dom-v5-compat';
import { LoadingPlaceholder } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { useChecks } from 'data/useChecks';
import { useQuery } from 'hooks/useQuery';
Expand Down
3 changes: 2 additions & 1 deletion src/configPage/PluginConfigPage/PluginConfigPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { Alert, Badge, Button, Card, Divider, LinkButton, TextLink, useStyles2 }
import { css } from '@emotion/css';
import { DataTestIds } from 'test/dataTestIds';

import { ProvisioningJsonData, ROUTES } from 'types';
import { ProvisioningJsonData } from 'types';
import { hasGlobalPermission } from 'utils';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import type { SMDataSource } from 'datasource/DataSource';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useAppInitializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { DataSourceInstanceSettings, DataSourceJsonData } from '@grafana/data';
import { config, getBackendSrv } from '@grafana/runtime';
import { isNumber } from 'lodash';

import { ROUTES, SubmissionErrorWrapper } from 'types';
import { SubmissionErrorWrapper } from 'types';
import { FaroEvent, reportError, reportEvent } from 'faro';
import { initializeDatasource } from 'utils';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { LEGACY_LOGS_DS_NAME, LEGACY_METRICS_DS_NAME } from 'components/constants';

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useCheckTypeGroupOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ReactNode, useContext } from 'react';
import { IconName } from '@grafana/data';

import { CheckType, CheckTypeGroup, FeatureName, ROUTES } from 'types';
import { CheckType, CheckTypeGroup, FeatureName } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { FeatureFlagContext } from 'contexts/FeatureFlagContext';

Expand Down
2 changes: 1 addition & 1 deletion src/page/AlertingWelcomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';

import { SubsectionWelcomePage } from './SubsectionWelcomePage';

Expand Down
3 changes: 2 additions & 1 deletion src/page/ChecksPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { apiRoute } from 'test/handlers';
import { ComponentWrapperProps, render } from 'test/render';
import { server } from 'test/server';

import { AlertSensitivity, Check, CheckTypeGroup, ROUTES } from 'types';
import { AlertSensitivity, Check, CheckTypeGroup } from 'types';
import { PLUGIN_URL_PATH } from 'routing/constants';
import { InitialisedRouter } from 'routing/InitialisedRouter';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';

import { FeatureFlagProvider } from '../components/FeatureFlagProvider';
Expand Down
2 changes: 1 addition & 1 deletion src/page/ChecksWelcomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';

import { SubsectionWelcomePage } from './SubsectionWelcomePage';

Expand Down
2 changes: 1 addition & 1 deletion src/page/ConfigPageLayout/ConfigPageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MemoryRouter } from 'react-router-dom';
import { CompatRouter, Route, Routes } from 'react-router-dom-v5-compat';
import { render } from '@testing-library/react';

import { ROUTES } from '../../types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';

import { DataTestIds } from '../../test/dataTestIds';
Expand Down
2 changes: 1 addition & 1 deletion src/page/ConfigPageLayout/ConfigPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { matchPath, Outlet, useLocation } from 'react-router-dom-v5-compat';
import { NavModelItem } from '@grafana/data';
import { PluginPage } from '@grafana/runtime';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';

function getConfigTabUrl(tab = '/') {
Expand Down
2 changes: 1 addition & 1 deletion src/page/ConfigPageLayout/tabs/TerraformTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { GrafanaTheme2 } from '@grafana/data';
import { Alert, Text, TextLink, useStyles2 } from '@grafana/ui';
import { css } from '@emotion/css';

import { ROUTES } from 'types';
import { FaroEvent, reportEvent } from 'faro';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { useTerraformConfig } from 'hooks/useTerraformConfig';
import { Clipboard } from 'components/Clipboard';
Expand Down
2 changes: 1 addition & 1 deletion src/page/ConfigPageLayout/tabs/UninitializedTab.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { screen } from '@testing-library/react';

import { ROUTES } from '../../../types';
import { ROUTES } from 'routing/types';

import { AppInitializer } from '../../../components/AppInitializer';
import { DataTestIds } from '../../../test/dataTestIds';
Expand Down
2 changes: 1 addition & 1 deletion src/page/ConfigPageLayout/tabs/UninitializedTab.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { EmptyState, TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { ROUTES } from 'routing/types';
import { AppInitializer } from 'components/AppInitializer';

import { ConfigContent } from '../ConfigContent';
Expand Down
3 changes: 2 additions & 1 deletion src/page/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { useParams } from 'react-router-dom-v5-compat';
import { SceneApp, SceneAppPage } from '@grafana/scenes';
import { Spinner } from '@grafana/ui';

import { CheckPageParams, CheckType, DashboardSceneAppConfig, FeatureName, ROUTES } from 'types';
import { CheckPageParams, CheckType, DashboardSceneAppConfig, FeatureName } from 'types';
import { getCheckType } from 'utils';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { useChecks } from 'data/useChecks';
import { useFeatureFlag } from 'hooks/useFeatureFlag';
Expand Down
3 changes: 2 additions & 1 deletion src/page/EditCheck/EditCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { useCallback } from 'react';
import { useParams } from 'react-router-dom-v5-compat';
import { Alert, Button, LinkButton, Modal } from '@grafana/ui';

import { CheckPageParams, ROUTES } from 'types';
import { CheckPageParams } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useChecks } from 'data/useChecks';
import { useNavigation } from 'hooks/useNavigation';
Expand Down
3 changes: 2 additions & 1 deletion src/page/EditProbe/EditProbe.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { apiRoute, getServerRequests } from 'test/handlers';
import { render } from 'test/render';
import { server } from 'test/server';

import { Probe, ROUTES } from 'types';
import { Probe } from 'types';
import { formatDate } from 'utils';
import { ROUTES } from 'routing/types';
import { generateRoutePath, getRoute } from 'routing/utils';

import { DataTestIds } from '../../test/dataTestIds';
Expand Down
3 changes: 2 additions & 1 deletion src/page/EditProbe/EditProbe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useNavigate, useParams } from 'react-router-dom-v5-compat';
import { PluginPage } from '@grafana/runtime';
import { LinkButton, TextLink } from '@grafana/ui';

import { ExtendedProbe, type Probe, type ProbePageParams, ROUTES } from 'types';
import { ExtendedProbe, type Probe, type ProbePageParams } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath, getRoute } from 'routing/utils';
import { useExtendedProbe, useUpdateProbe } from 'data/useProbes';
import { useCanEditProbe } from 'hooks/useCanEditProbe';
Expand Down
3 changes: 2 additions & 1 deletion src/page/NewCheck/NewCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React from 'react';
import { useParams } from 'react-router-dom-v5-compat';
import { TextLink } from '@grafana/ui';

import { CheckFormPageParams, ROUTES } from 'types';
import { CheckFormPageParams } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { CHECK_TYPE_GROUP_OPTIONS } from 'hooks/useCheckTypeGroupOptions';
import { CheckForm } from 'components/CheckForm/CheckForm';
Expand Down
3 changes: 2 additions & 1 deletion src/page/NewProbe/NewProbe.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { ADD_PROBE_TOKEN_RESPONSE } from 'test/fixtures/probes';
import { render } from 'test/render';
import { fillProbeForm } from 'test/utils';

import { FeatureName, ROUTES } from 'types';
import { FeatureName } from 'types';
import { ROUTES } from 'routing/types';
import { generateRoutePath, getRoute } from 'routing/utils';

import { DataTestIds } from '../../test/dataTestIds';
Expand Down
3 changes: 2 additions & 1 deletion src/page/NewProbe/NewProbe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { PluginPage } from '@grafana/runtime';
import { Alert, Label, useTheme2 } from '@grafana/ui';
import { css } from '@emotion/css';

import { ExtendedProbe, type Probe, ROUTES } from 'types';
import { ExtendedProbe, type Probe } from 'types';
import { ROUTES } from 'routing/types';
import { type AddProbeResult } from 'datasource/responses.types';
import { useCreateProbe } from 'data/useProbes';
import { useBackendAddress } from 'hooks/useBackendAddress';
Expand Down
2 changes: 1 addition & 1 deletion src/page/NotFound/CheckNotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { useParams } from 'react-router-dom-v5-compat';
import { TextLink } from '@grafana/ui';

import { ROUTES } from 'types';
import { createNavModel } from 'utils';
import { ROUTES } from 'routing/types';
import { generateRoutePath } from 'routing/utils';
import { useCheck } from 'data/useChecks';

Expand Down
3 changes: 2 additions & 1 deletion src/page/Probes/Probes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { LinkButton, useTheme2 } from '@grafana/ui';
import { css } from '@emotion/css';
import { DataTestIds } from 'test/dataTestIds';

import { ExtendedProbe, ROUTES } from 'types';
import { ExtendedProbe } from 'types';
import { ROUTES } from 'routing/types';
import { getRoute } from 'routing/utils';
import { useExtendedProbes } from 'data/useProbes';
import { useCanWriteSM } from 'hooks/useDSPermission';
Expand Down
Loading

0 comments on commit e616da3

Please sign in to comment.