mirror of
https://github.com/grafana/grafana.git
synced 2025-09-25 18:03:50 +08:00
Explore: Remove data source onboarding page (#68131)
* Remove EmptyStateWrapper
This commit is contained in:
@ -1,32 +0,0 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
|
||||
import { EmptyStateNoDatasource } from 'app/features/datasources/components/EmptyStateNoDatasource';
|
||||
import { ExploreQueryParams, useSelector } from 'app/types';
|
||||
|
||||
import { useLoadDataSources } from '../datasources/state';
|
||||
|
||||
import { ExplorePage } from './ExplorePage';
|
||||
|
||||
export default function EmptyStateWrapper(props: GrafanaRouteComponentProps<{}, ExploreQueryParams>) {
|
||||
const { isLoading } = useLoadDataSources();
|
||||
|
||||
const { hasDatasource } = useSelector((state) => ({
|
||||
hasDatasource: state.dataSources.dataSourcesCount > 0,
|
||||
}));
|
||||
const [showOnboarding, setShowOnboarding] = useState(config.featureToggles.datasourceOnboarding);
|
||||
const showExplorePage = hasDatasource || !showOnboarding;
|
||||
|
||||
return showExplorePage ? (
|
||||
<ExplorePage {...props} />
|
||||
) : (
|
||||
<EmptyStateNoDatasource
|
||||
onCTAClick={() => setShowOnboarding(false)}
|
||||
loading={isLoading}
|
||||
title="Welcome to Grafana Explore!"
|
||||
CTAText="Or explore sample data"
|
||||
navId="explore"
|
||||
/>
|
||||
);
|
||||
}
|
@ -31,7 +31,7 @@ const styles = {
|
||||
`,
|
||||
};
|
||||
|
||||
export function ExplorePage(props: GrafanaRouteComponentProps<{}, ExploreQueryParams>) {
|
||||
export default function ExplorePage(props: GrafanaRouteComponentProps<{}, ExploreQueryParams>) {
|
||||
useExplorePageTitle();
|
||||
const dispatch = useDispatch();
|
||||
const queryParams = props.queryParams;
|
||||
|
@ -26,7 +26,7 @@ import { LokiDatasource } from '../../../../plugins/datasource/loki/datasource';
|
||||
import { LokiQuery } from '../../../../plugins/datasource/loki/types';
|
||||
import { ExploreId } from '../../../../types';
|
||||
import { initialUserState } from '../../../profile/state/reducers';
|
||||
import { ExplorePage } from '../../ExplorePage';
|
||||
import ExplorePage from '../../ExplorePage';
|
||||
|
||||
type DatasourceSetup = { settings: DataSourceInstanceSettings; api: DataSourceApi };
|
||||
|
||||
|
@ -192,7 +192,7 @@ export function getAppRoutes(): RouteDescriptor[] {
|
||||
),
|
||||
component: SafeDynamicImport(() =>
|
||||
config.exploreEnabled
|
||||
? import(/* webpackChunkName: "explore" */ 'app/features/explore/EmptyStateWrapper')
|
||||
? import(/* webpackChunkName: "explore" */ 'app/features/explore/ExplorePage')
|
||||
: import(/* webpackChunkName: "explore-feature-toggle-page" */ 'app/features/explore/FeatureTogglePage')
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user