From cee838c8a88a13ec7cc7da680f1ec64bcb2ec8a1 Mon Sep 17 00:00:00 2001 From: Haris Rozajac <58232930+harisrozajac@users.noreply.github.com> Date: Fri, 12 May 2023 07:48:17 -0600 Subject: [PATCH] Explore: Remove data source onboarding page (#68131) * Remove EmptyStateWrapper --- .../features/explore/EmptyStateWrapper.tsx | 32 ------------------- public/app/features/explore/ExplorePage.tsx | 2 +- .../features/explore/spec/helper/setup.tsx | 2 +- public/app/routes/routes.tsx | 2 +- 4 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 public/app/features/explore/EmptyStateWrapper.tsx diff --git a/public/app/features/explore/EmptyStateWrapper.tsx b/public/app/features/explore/EmptyStateWrapper.tsx deleted file mode 100644 index 0ab42ea2ad8..00000000000 --- a/public/app/features/explore/EmptyStateWrapper.tsx +++ /dev/null @@ -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 ? ( - - ) : ( - setShowOnboarding(false)} - loading={isLoading} - title="Welcome to Grafana Explore!" - CTAText="Or explore sample data" - navId="explore" - /> - ); -} diff --git a/public/app/features/explore/ExplorePage.tsx b/public/app/features/explore/ExplorePage.tsx index 78b885b479d..64dad574c12 100644 --- a/public/app/features/explore/ExplorePage.tsx +++ b/public/app/features/explore/ExplorePage.tsx @@ -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; diff --git a/public/app/features/explore/spec/helper/setup.tsx b/public/app/features/explore/spec/helper/setup.tsx index 3530b4cec9f..e375297e6b4 100644 --- a/public/app/features/explore/spec/helper/setup.tsx +++ b/public/app/features/explore/spec/helper/setup.tsx @@ -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 }; diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index b8b466801f4..e5f15e64f83 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -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') ), },