Provisioning: Update onPrem check to use stacks (#113262)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { css } from '@emotion/css';
|
||||
|
||||
import { FeatureState, GrafanaTheme2 } from '@grafana/data';
|
||||
import { GrafanaEdition } from '@grafana/data/internal';
|
||||
import { Trans } from '@grafana/i18n';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { Box, FeatureBadge, LinkButton, Stack, Text, TextLink, useStyles2 } from '@grafana/ui';
|
||||
|
||||
import { RepositoryTypeCards } from '../Shared/RepositoryTypeCards';
|
||||
import { isOnPrem } from '../utils/isOnPrem';
|
||||
|
||||
interface FeaturesListProps {
|
||||
hasRequiredFeatures: boolean;
|
||||
@@ -15,7 +14,6 @@ interface FeaturesListProps {
|
||||
|
||||
export const FeaturesList = ({ hasRequiredFeatures, onSetupFeatures }: FeaturesListProps) => {
|
||||
const styles = useStyles2(getStyles);
|
||||
const isOnPrem = [GrafanaEdition.OpenSource, GrafanaEdition.Enterprise].includes(config.buildInfo.edition);
|
||||
|
||||
return (
|
||||
<Stack direction="column" gap={3}>
|
||||
@@ -23,7 +21,7 @@ export const FeaturesList = ({ hasRequiredFeatures, onSetupFeatures }: FeaturesL
|
||||
<Trans i18nKey="provisioning.features-list.manage-your-dashboards-with-remote-provisioning">
|
||||
Get started with Git Sync
|
||||
</Trans>{' '}
|
||||
{!isOnPrem && <FeatureBadge featureState={FeatureState.privatePreview} />}
|
||||
{!isOnPrem() && <FeatureBadge featureState={FeatureState.privatePreview} />}
|
||||
</Text>
|
||||
<ul className={styles.featuresList}>
|
||||
<li>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { GrafanaEdition } from '@grafana/data/internal';
|
||||
import { Trans, t } from '@grafana/i18n';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { Alert, Stack, Text, TextLink } from '@grafana/ui';
|
||||
import { Repository } from 'app/api/clients/provisioning/v0alpha1';
|
||||
import { Page } from 'app/core/components/Page/Page';
|
||||
|
||||
import { isOnPrem } from '../utils/isOnPrem';
|
||||
|
||||
import GettingStarted from './GettingStarted';
|
||||
|
||||
interface Props {
|
||||
@@ -34,9 +34,7 @@ export default function GettingStartedPage({ items }: Props) {
|
||||
}
|
||||
|
||||
function Banner() {
|
||||
const isOnPrem = [GrafanaEdition.OpenSource, GrafanaEdition.Enterprise].includes(config.buildInfo.edition);
|
||||
|
||||
if (!isOnPrem) {
|
||||
if (!isOnPrem()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
/**
|
||||
* Checks if the current Grafana instance is running on-prem
|
||||
* Uses namespace to determine deployment type:
|
||||
* - Cloud instances use namespace format: `stacks-{stackId}`
|
||||
* - On-prem instances use org-based namespace format: `org-{orgId}` or similar
|
||||
*
|
||||
* @returns true if the instance is on-premise, false if it's cloud
|
||||
*/
|
||||
export function isOnPrem() {
|
||||
const namespace = config.namespace;
|
||||
|
||||
return !namespace.startsWith('stacks-');
|
||||
}
|
||||
Reference in New Issue
Block a user