mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
Alerting: Show Insights page only on cloud (when required ds's are available) (#89679)
* Show Insights page only on cloud (when required ds's are available) * fix typo * remove unnecessary export
This commit is contained in:
parent
9c6d3590a2
commit
579250a89a
@ -4,15 +4,14 @@ import { config } from '@grafana/runtime';
|
||||
import { Box, Stack, Tab, TabContent, TabsBar } from '@grafana/ui';
|
||||
|
||||
import { AlertingPageWrapper } from '../components/AlertingPageWrapper';
|
||||
import { isLocalDevEnv, isOpenSourceEdition } from '../utils/misc';
|
||||
import { isLocalDevEnv } from '../utils/misc';
|
||||
|
||||
import GettingStarted, { WelcomeHeader } from './GettingStarted';
|
||||
import { getInsightsScenes } from './Insights';
|
||||
import { getInsightsScenes, insightsIsAvailable } from './Insights';
|
||||
import { PluginIntegrations } from './PluginIntegrations';
|
||||
|
||||
export default function Home() {
|
||||
const insightsEnabled =
|
||||
(!isOpenSourceEdition() || isLocalDevEnv()) && Boolean(config.featureToggles.alertingInsights);
|
||||
const insightsEnabled = (insightsIsAvailable() || isLocalDevEnv()) && Boolean(config.featureToggles.alertingInsights);
|
||||
|
||||
const [activeTab, setActiveTab] = useState<'insights' | 'overview'>(insightsEnabled ? 'insights' : 'overview');
|
||||
const insightsScene = getInsightsScenes();
|
||||
|
@ -98,12 +98,22 @@ const namespace = config.bootData.settings.namespace;
|
||||
|
||||
export const INSTANCE_ID = namespace.includes('stack-') ? namespace.replace('stack-', '') : undefined;
|
||||
|
||||
export function getInsightsScenes() {
|
||||
const getInsightsDataSources = () => {
|
||||
const dataSourceSrv = getDataSourceSrv();
|
||||
|
||||
[ashDs, cloudUsageDs, grafanaCloudPromDs].forEach((ds) => {
|
||||
ds.settings = dataSourceSrv.getInstanceSettings(ds.uid);
|
||||
});
|
||||
return [ashDs, cloudUsageDs, grafanaCloudPromDs];
|
||||
};
|
||||
|
||||
export const insightsIsAvailable = () => {
|
||||
const [_, cloudUsageDs, __] = getInsightsDataSources();
|
||||
return cloudUsageDs.settings;
|
||||
};
|
||||
|
||||
export function getInsightsScenes() {
|
||||
const [ashDs, cloudUsageDs, grafanaCloudPromDs] = getInsightsDataSources();
|
||||
|
||||
const categories = [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user