E2C: Initial config to switch between cloud and onprem pages (#83380)

hacky config to switch between cloud and onprem pages
This commit is contained in:
Ashley Harrison
2024-02-26 14:36:34 +00:00
committed by GitHub
parent 7f8a87458f
commit da4fb8b3ed
5 changed files with 18 additions and 9 deletions
@@ -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 (
<Page navId="migrate-to-cloud">
<EmptyState />
</Page>
);
// TODO replace this with a proper config value when it's available
const isMigrationTarget = config.namespace.startsWith('stack-');
return <Page navId="migrate-to-cloud">{isMigrationTarget ? <CloudPage /> : <OnPremPage />}</Page>;
}
@@ -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);
@@ -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 = () => {
@@ -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 (
@@ -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 <EmptyState />;
};