Skip to content

Commit

Permalink
Remove add sample data and update test snapshots
Browse files Browse the repository at this point in the history
Signed-off-by: yenienserrano <[email protected]>
  • Loading branch information
yenienserrano authored and AlexRuiz7 committed Apr 19, 2023
1 parent 3d9ba6d commit 5e1516c
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 400 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/plugins/home/public/application/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
import { HOME_APP_BASE_PATH } from '../../../common/constants';
import { FeatureCatalogueCategory } from '../../services';
import { getServices } from '../opensearch_dashboards_services';
import { AddData } from './add_data';
// import { AddData } from './add_data';
import { ManageData } from './manage_data';
import { SolutionsSection } from './solutions_section';
import { Welcome } from './welcome';
Expand Down Expand Up @@ -173,9 +173,12 @@ export class Home extends Component {
: 'homData--expanded'
}`}
>
{/*
Disable the card to add sample data on the home page
<EuiFlexItem>
<AddData addBasePath={addBasePath} features={addDataFeatures} />
</EuiFlexItem>
*/}

<EuiFlexItem>
<ManageData addBasePath={addBasePath} features={manageDataFeatures} />
Expand Down
63 changes: 33 additions & 30 deletions src/plugins/home/public/application/components/home_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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 (
<TutorialDirectory
addBasePath={addBasePath}
openTab={props.match.params.tab}
isCloudEnabled={isCloudEnabled}
/>
);
};
// const renderTutorialDirectory = (props) => {
// return (
// <TutorialDirectory
// addBasePath={addBasePath}
// openTab={props.match.params.tab}
// isCloudEnabled={isCloudEnabled}
// />
// );
// };

const renderTutorial = (props) => {
return (
<Tutorial
addBasePath={addBasePath}
isCloudEnabled={isCloudEnabled}
getTutorial={getTutorial}
replaceTemplateStrings={replaceTemplateStrings}
tutorialId={props.match.params.id}
bulkCreate={savedObjectsClient.bulkCreate}
/>
);
};
// const renderTutorial = (props) => {
// return (
// <Tutorial
// addBasePath={addBasePath}
// isCloudEnabled={isCloudEnabled}
// getTutorial={getTutorial}
// replaceTemplateStrings={replaceTemplateStrings}
// tutorialId={props.match.params.id}
// bulkCreate={savedObjectsClient.bulkCreate}
// />
// );
// };

return (
<I18nProvider>
<Router>
<Switch>
<Route path="/tutorial/:id" render={renderTutorial} />
<Route path="/tutorial_directory/:tab?" render={renderTutorialDirectory} />
{/*
Disable routes to add sample data
<Route path="/tutorial/:id" render={renderTutorial} />
<Route path="/tutorial_directory/:tab?" render={renderTutorialDirectory} />FlexItem>
*/}
<Route exact path="/feature_directory">
<FeatureDirectory addBasePath={addBasePath} directories={directories} />
</Route>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home/public/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('HomePublicPlugin', () => {
category: 'data',
icon: 'indexOpen',
id: 'home_tutorial_directory',
showOnHomePage: true,
showOnHomePage: false,
})
);
});
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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,
});

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5e1516c

Please sign in to comment.