From 5e1516c315203379d4db70e7a339c4d75e65f106 Mon Sep 17 00:00:00 2001 From: yenienserrano Date: Tue, 14 Feb 2023 12:16:07 +0100 Subject: [PATCH] Remove add sample data and update test snapshots Signed-off-by: yenienserrano --- .../__snapshots__/home.test.js.snap | 102 ------------ .../public/application/components/home.js | 5 +- .../public/application/components/home_app.js | 63 ++++---- src/plugins/home/public/plugin.test.ts | 2 +- src/plugins/home/public/plugin.ts | 8 +- .../__snapshots__/empty_state.test.tsx.snap | 30 +--- .../empty_state/empty_state.tsx | 3 + .../getting_started.test.tsx.snap | 26 ---- .../getting_started/getting_started.tsx | 3 + .../__snapshots__/overview.test.tsx.snap | 69 --------- .../public/components/overview/overview.tsx | 2 + .../overview_page_header.test.tsx.snap | 145 +----------------- .../overview_page_header.tsx | 3 + 13 files changed, 61 insertions(+), 400 deletions(-) diff --git a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap index 61855f17954e..8b7802c52e00 100644 --- a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap +++ b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap @@ -26,12 +26,6 @@ exports[`home change home route should render a link to change the default route - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {/* + Disable the card to add sample data on the home page + */} diff --git a/src/plugins/home/public/application/components/home_app.js b/src/plugins/home/public/application/components/home_app.js index 4e8dd16dd998..fb98c2ba3bae 100644 --- a/src/plugins/home/public/application/components/home_app.js +++ b/src/plugins/home/public/application/components/home_app.js @@ -33,11 +33,11 @@ import { I18nProvider } from '@osd/i18n/react'; import PropTypes from 'prop-types'; import { Home } from './home'; import { FeatureDirectory } from './feature_directory'; -import { TutorialDirectory } from './tutorial_directory'; -import { Tutorial } from './tutorial/tutorial'; +// import { TutorialDirectory } from './tutorial_directory'; +// import { Tutorial } from './tutorial/tutorial'; import { HashRouter as Router, Switch, Route } from 'react-router-dom'; -import { getTutorial } from '../load_tutorials'; -import { replaceTemplateStrings } from './tutorial/replace_template_strings'; +// import { getTutorial } from '../load_tutorials'; +// import { replaceTemplateStrings } from './tutorial/replace_template_strings'; import { getServices } from '../opensearch_dashboards_services'; import { useMount } from 'react-use'; @@ -54,41 +54,44 @@ export function HomeApp({ directories, solutions }) { savedObjectsClient, getBasePath, addBasePath, - environmentService, + // environmentService, telemetry, } = getServices(); - const environment = environmentService.getEnvironment(); - const isCloudEnabled = environment.cloud; + // const environment = environmentService.getEnvironment(); + // const isCloudEnabled = environment.cloud; - const renderTutorialDirectory = (props) => { - return ( - - ); - }; + // const renderTutorialDirectory = (props) => { + // return ( + // + // ); + // }; - const renderTutorial = (props) => { - return ( - - ); - }; + // const renderTutorial = (props) => { + // return ( + // + // ); + // }; return ( - - + {/* + Disable routes to add sample data + + FlexItem> + */} diff --git a/src/plugins/home/public/plugin.test.ts b/src/plugins/home/public/plugin.test.ts index c311b6ee0fe5..ab23a292a585 100644 --- a/src/plugins/home/public/plugin.test.ts +++ b/src/plugins/home/public/plugin.test.ts @@ -58,7 +58,7 @@ describe('HomePublicPlugin', () => { category: 'data', icon: 'indexOpen', id: 'home_tutorial_directory', - showOnHomePage: true, + showOnHomePage: false, }) ); }); diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 03823c5da179..277abdcdf968 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -130,7 +130,8 @@ export class HomePublicPlugin urlForwarding.forwardApp('home', 'home'); const featureCatalogue = { ...this.featuresCatalogueRegistry.setup() }; - + // Disable sample data in home/view app directory + // To activate it again, remove visible() and change showOnHomePage to true. featureCatalogue.register({ id: 'home_tutorial_directory', title: i18n.translate('home.tutorialDirectory.featureCatalogueTitle', { @@ -140,9 +141,12 @@ export class HomePublicPlugin defaultMessage: 'Get started with sample data, visualizations, and dashboards.', }), icon: 'indexOpen', - showOnHomePage: true, + showOnHomePage: false, path: `${HOME_APP_BASE_PATH}#/tutorial_directory`, category: 'data' as FeatureCatalogueCategory.DATA, + visible() { + return false; + }, order: 500, }); diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap index a617fa0511e2..8a36dc08a89e 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/__snapshots__/empty_state.test.tsx.snap @@ -29,35 +29,7 @@ exports[`EmptyState should render normally 1`] = ` className="inpEmptyState__cardGrid" columns={3} responsive={true} - > - - - } - icon={ - - } - onClick={[Function]} - title={ - - } - /> - - + /> diff --git a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx index 96862e59ffa5..c5970f2580ed 100644 --- a/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx +++ b/src/plugins/index_pattern_management/public/components/index_pattern_table/empty_state/empty_state.tsx @@ -172,6 +172,8 @@ export const EmptyState = ({ /> */} {getMlCardState() !== MlCardState.HIDDEN ? mlCard : <>} + {/* + Disable card to add sample data when we dont have data + */}
diff --git a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap index 9df3bb12caec..f2a26c2fa3b1 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/getting_started/__snapshots__/getting_started.test.tsx.snap @@ -168,19 +168,6 @@ exports[`GettingStarted dark mode on 1`] = ` - - - - -
- - - - - = ({ addBasePath, isDarkTheme, apps }) => + {/* + Disable the overview button for adding sample data = ({ addBasePath, isDarkTheme, apps }) => /> + */} diff --git a/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap b/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap index 198e0119ebd8..d02f740e1a41 100644 --- a/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_overview/public/components/overview/__snapshots__/overview.test.tsx.snap @@ -1032,75 +1032,6 @@ exports[`Overview without solutions 1`] = ` - - - = ({ newsFetchResult, solutions, features, bran : 'osdOverviewData--expanded' }`} > + {/* + */} diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/__snapshots__/overview_page_header.test.tsx.snap b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/__snapshots__/overview_page_header.test.tsx.snap index 72a25d779ded..dd2b5075a659 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/__snapshots__/overview_page_header.test.tsx.snap +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/__snapshots__/overview_page_header.test.tsx.snap @@ -33,34 +33,7 @@ exports[`OverviewPageHeader in dark mode render logo as custom dark mode logo className="osdOverviewPageHeader__actions" responsive={false} wrap={true} - > - - - - Add data - - - - + />
@@ -100,34 +73,7 @@ exports[`OverviewPageHeader in dark mode render logo as custom default mode lo className="osdOverviewPageHeader__actions" responsive={false} wrap={true} - > - - - - Add data - - - - + /> @@ -167,34 +113,7 @@ exports[`OverviewPageHeader in dark mode render logo as original dark mode ope className="osdOverviewPageHeader__actions" responsive={false} wrap={true} - > - - - - Add data - - - - + /> @@ -234,34 +153,7 @@ exports[`OverviewPageHeader in default mode render logo as custom default mode className="osdOverviewPageHeader__actions" responsive={false} wrap={true} - > - - - - Add data - - - - + /> @@ -301,34 +193,7 @@ exports[`OverviewPageHeader in default mode render logo as original default mo className="osdOverviewPageHeader__actions" responsive={false} wrap={true} - > - - - - Add data - - - - + /> diff --git a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx index 00273fcf993b..7b0ca7ee1102 100644 --- a/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx +++ b/src/plugins/opensearch_dashboards_react/public/overview_page/overview_page_header/overview_page_header.tsx @@ -159,6 +159,8 @@ export const OverviewPageHeader: FC = ({ {!hideToolbar && ( + {/* + Disable the home button for adding sample data = ({ + */} {showManagementLink && isManagementEnabled ? (