From da4fb8b3eda822a1168aaff8af50d46c8cca05c7 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 26 Feb 2024 14:36:34 +0000 Subject: [PATCH] E2C: Initial config to switch between cloud and onprem pages (#83380) hacky config to switch between cloud and onprem pages --- .../admin/migrate-to-cloud/MigrateToCloud.tsx | 13 +++++++------ .../cloud/{EmptyState => }/InfoPane.tsx | 2 +- .../cloud/{EmptyState => }/MigrationTokenPane.tsx | 2 +- .../cloud/{EmptyState/EmptyState.tsx => Page.tsx} | 2 +- .../features/admin/migrate-to-cloud/onprem/Page.tsx | 8 ++++++++ 5 files changed, 18 insertions(+), 9 deletions(-) rename public/app/features/admin/migrate-to-cloud/cloud/{EmptyState => }/InfoPane.tsx (98%) rename public/app/features/admin/migrate-to-cloud/cloud/{EmptyState => }/MigrationTokenPane.tsx (95%) rename public/app/features/admin/migrate-to-cloud/cloud/{EmptyState/EmptyState.tsx => Page.tsx} (95%) create mode 100644 public/app/features/admin/migrate-to-cloud/onprem/Page.tsx diff --git a/public/app/features/admin/migrate-to-cloud/MigrateToCloud.tsx b/public/app/features/admin/migrate-to-cloud/MigrateToCloud.tsx index 3545be33a21..86163f63521 100644 --- a/public/app/features/admin/migrate-to-cloud/MigrateToCloud.tsx +++ b/public/app/features/admin/migrate-to-cloud/MigrateToCloud.tsx @@ -1,13 +1,14 @@ import React from 'react'; +import { config } from '@grafana/runtime'; import { Page } from 'app/core/components/Page/Page'; -import { EmptyState } from './onprem/EmptyState/EmptyState'; +import { Page as CloudPage } from './cloud/Page'; +import { Page as OnPremPage } from './onprem/Page'; export default function MigrateToCloud() { - return ( - - - - ); + // TODO replace this with a proper config value when it's available + const isMigrationTarget = config.namespace.startsWith('stack-'); + + return {isMigrationTarget ? : }; } diff --git a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/InfoPane.tsx b/public/app/features/admin/migrate-to-cloud/cloud/InfoPane.tsx similarity index 98% rename from public/app/features/admin/migrate-to-cloud/cloud/EmptyState/InfoPane.tsx rename to public/app/features/admin/migrate-to-cloud/cloud/InfoPane.tsx index 27b30134b40..929daaa642b 100644 --- a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/InfoPane.tsx +++ b/public/app/features/admin/migrate-to-cloud/cloud/InfoPane.tsx @@ -5,7 +5,7 @@ import { GrafanaTheme2 } from '@grafana/data'; import { Box, Stack, TextLink, useStyles2 } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; -import { InfoItem } from '../../shared/InfoItem'; +import { InfoItem } from '../shared/InfoItem'; export const InfoPane = () => { const styles = useStyles2(getStyles); diff --git a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/MigrationTokenPane.tsx b/public/app/features/admin/migrate-to-cloud/cloud/MigrationTokenPane.tsx similarity index 95% rename from public/app/features/admin/migrate-to-cloud/cloud/EmptyState/MigrationTokenPane.tsx rename to public/app/features/admin/migrate-to-cloud/cloud/MigrationTokenPane.tsx index 192a54c9231..d70f219d1c5 100644 --- a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/MigrationTokenPane.tsx +++ b/public/app/features/admin/migrate-to-cloud/cloud/MigrationTokenPane.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { Box, Button, Text } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; -import { InfoItem } from '../../shared/InfoItem'; +import { InfoItem } from '../shared/InfoItem'; export const MigrationTokenPane = () => { const onGenerateToken = () => { diff --git a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/EmptyState.tsx b/public/app/features/admin/migrate-to-cloud/cloud/Page.tsx similarity index 95% rename from public/app/features/admin/migrate-to-cloud/cloud/EmptyState/EmptyState.tsx rename to public/app/features/admin/migrate-to-cloud/cloud/Page.tsx index 9ffcc839993..765e8cdb84b 100644 --- a/public/app/features/admin/migrate-to-cloud/cloud/EmptyState/EmptyState.tsx +++ b/public/app/features/admin/migrate-to-cloud/cloud/Page.tsx @@ -7,7 +7,7 @@ import { Grid, useStyles2 } from '@grafana/ui'; import { InfoPane } from './InfoPane'; import { MigrationTokenPane } from './MigrationTokenPane'; -export const EmptyState = () => { +export const Page = () => { const styles = useStyles2(getStyles); return ( diff --git a/public/app/features/admin/migrate-to-cloud/onprem/Page.tsx b/public/app/features/admin/migrate-to-cloud/onprem/Page.tsx new file mode 100644 index 00000000000..ee3bbdde694 --- /dev/null +++ b/public/app/features/admin/migrate-to-cloud/onprem/Page.tsx @@ -0,0 +1,8 @@ +import React from 'react'; + +import { EmptyState } from './EmptyState/EmptyState'; + +export const Page = () => { + // TODO logic to determine whether to show the empty state or the resource table + return ; +};