conditional on OSS license, refactored to separate const
This commit is contained in:
parent
f7a11386ee
commit
09cae43d1c
4 changed files with 14 additions and 5 deletions
|
|
@ -4,13 +4,19 @@ import { Card } from '@grafana/ui';
|
|||
import cn from 'classnames/bind';
|
||||
|
||||
import gitHubStarSVG from 'assets/img/github_star.svg';
|
||||
import { APP_SUBTITLE } from 'utils/consts';
|
||||
import { useStore } from 'state/useStore';
|
||||
import { APP_SUBTITLE, GRAFANA_LICENSE_OSS } from 'utils/consts';
|
||||
|
||||
import styles from './NavBarSubtitle.module.css';
|
||||
|
||||
const cx = cn.bind(styles);
|
||||
|
||||
function NavBarSubtitle() {
|
||||
const store = useStore();
|
||||
if (store.backendLicense === GRAFANA_LICENSE_OSS) {
|
||||
return APP_SUBTITLE;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={cx('navbar-container')}>
|
||||
{APP_SUBTITLE}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@ import React, { FC, useEffect, useState, useCallback } from 'react';
|
|||
|
||||
import { AppRootProps } from '@grafana/data';
|
||||
import { getLocationSrv } from '@grafana/runtime';
|
||||
import { Alert, Button } from '@grafana/ui';
|
||||
import { Alert } from '@grafana/ui';
|
||||
import cn from 'classnames/bind';
|
||||
import { observer } from 'mobx-react';
|
||||
|
||||
import PluginLink from 'components/PluginLink/PluginLink';
|
||||
import { useStore } from 'state/useStore';
|
||||
import { UserAction } from 'state/userAction';
|
||||
import { GRAFANA_LICENSE_OSS } from 'utils/consts';
|
||||
import { useForceUpdate } from 'utils/hooks';
|
||||
import { getItem, setItem } from 'utils/localStorage';
|
||||
import sanitize from 'utils/sanitize';
|
||||
|
|
@ -89,7 +90,7 @@ const DefaultPageLayout: FC<DefaultPageLayoutProps> = observer((props) => {
|
|||
/>
|
||||
</Alert>
|
||||
)}
|
||||
{store.backendLicense === 'OpenSource' &&
|
||||
{store.backendLicense === GRAFANA_LICENSE_OSS &&
|
||||
store.backendVersion &&
|
||||
plugin?.version &&
|
||||
store.backendVersion !== plugin?.version && (
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import WithConfirm from 'components/WithConfirm/WithConfirm';
|
|||
import logo from 'img/logo.svg';
|
||||
import { makeRequest } from 'network';
|
||||
import { createGrafanaToken, getPluginSyncStatus, startPluginSync, updateGrafanaToken } from 'state/plugin';
|
||||
import { openNotification } from 'utils';
|
||||
import { GRAFANA_LICENSE_OSS } from 'utils/consts';
|
||||
import { getItem, setItem } from 'utils/localStorage';
|
||||
|
||||
import styles from './PluginConfigPage.module.css';
|
||||
|
|
@ -152,7 +152,7 @@ export const PluginConfigPage = (props: Props) => {
|
|||
setPluginStatusMessage(
|
||||
`Connected to OnCall${versionInfo}\n - OnCall URL: ${plugin.meta.jsonData.onCallApiUrl}\n - Grafana URL: ${plugin.meta.jsonData.grafanaUrl}`
|
||||
);
|
||||
setIsSelfHostedInstall(plugin.meta.jsonData?.license === 'OpenSource');
|
||||
setIsSelfHostedInstall(plugin.meta.jsonData?.license === GRAFANA_LICENSE_OSS);
|
||||
setPluginStatusOk(true);
|
||||
} else {
|
||||
setPluginStatusMessage(
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@ import plugin from '../../package.json'; // eslint-disable-line
|
|||
export const APP_TITLE = 'Grafana OnCall';
|
||||
export const APP_SUBTITLE = `Developer-friendly incident response (${plugin?.version})`;
|
||||
|
||||
export const GRAFANA_LICENSE_OSS = 'OpenSource';
|
||||
|
||||
// Reusable breakpoint sizes
|
||||
export const BREAKPOINT_TABS = 1024;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue