Skip to content

Commit

Permalink
temporarily set tutorial to only allow cx to add sample data due to n…
Browse files Browse the repository at this point in the history
…o data instructions

Signed-off-by: Anan Zhuang <[email protected]>
  • Loading branch information
ananzh committed Jun 8, 2021
1 parent b102ed9 commit 7ada5b0
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 123 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const addBasePathMock = jest.fn((path: string) => (path ? path : 'path'));
const mockFeatures = [
{
category: 'data',
description: 'Ingest data from popular apps and services.',
description: 'Try our sample data.',
showOnHomePage: true,
icon: 'indexOpen',
id: 'home_tutorial_directory',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import React, { FC } from 'react';
import PropTypes from 'prop-types';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
// @ts-expect-error untyped service
import { FeatureCatalogueEntry } from '../../services';
Expand All @@ -55,23 +55,6 @@ export const AddData: FC<Props> = ({ addBasePath, features }) => (
</h2>
</EuiTitle>
</EuiFlexItem>

<EuiFlexItem className="homDataAdd__actions" grow={false}>
<div>
<EuiButtonEmpty
className="homDataAdd__actionButton"
flush="left"
href="#/tutorial_directory/sampleData"
iconType="visTable"
size="xs"
>
<FormattedMessage
id="home.addData.sampleDataButtonLabel"
defaultMessage="Try our sample data"
/>
</EuiButtonEmpty>
</div>
</EuiFlexItem>
</EuiFlexGroup>

<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,45 +66,48 @@ class TutorialDirectoryUi extends React.Component {
constructor(props) {
super(props);

// temporarily set tabs to empty due to no available data instructions
// to users. this part will be added back once we have instructions
// and sample code snippets that can instruct users to add data
this.tabs = [
{
id: ALL_TAB_ID,
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.allTitle',
defaultMessage: 'All',
}),
},
{
id: 'logging',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.loggingTitle',
defaultMessage: 'Logs',
}),
},
{
id: 'metrics',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.metricsTitle',
defaultMessage: 'Metrics',
}),
},
{
id: 'security',
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.securitySolutionTitle',
defaultMessage: 'Security',
}),
},
{
id: SAMPLE_DATA_TAB_ID,
name: this.props.intl.formatMessage({
id: 'home.tutorial.tabs.sampleDataTitle',
defaultMessage: 'Sample data',
}),
},
//{
// id: ALL_TAB_ID,
// name: this.props.intl.formatMessage({
// id: 'home.tutorial.tabs.allTitle',
// defaultMessage: 'All',
// }),
//},
//{
// id: 'logging',
// name: this.props.intl.formatMessage({
// id: 'home.tutorial.tabs.loggingTitle',
// defaultMessage: 'Logs',
// }),
//},
//{
// id: 'metrics',
// name: this.props.intl.formatMessage({
// id: 'home.tutorial.tabs.metricsTitle',
// defaultMessage: 'Metrics',
// }),
//},
//{
// id: 'security',
// name: this.props.intl.formatMessage({
// id: 'home.tutorial.tabs.securitySolutionTitle',
// defaultMessage: 'Security',
// }),
//},
//{
// id: SAMPLE_DATA_TAB_ID,
// name: this.props.intl.formatMessage({
// id: 'home.tutorial.tabs.sampleDataTitle',
// defaultMessage: 'Sample data',
// }),
//},
];

let openTab = ALL_TAB_ID;
let openTab = SAMPLE_DATA_TAB_ID;
if (
props.openTab &&
this.tabs.some((tab) => {
Expand Down Expand Up @@ -284,7 +287,7 @@ class TutorialDirectoryUi extends React.Component {
<h1>
<FormattedMessage
id="home.tutorial.addDataToOpenSearchDashboardsTitle"
defaultMessage="Add data"
defaultMessage="Add sample data"
/>
</h1>
</EuiTitle>
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/home/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ export class HomePublicPlugin
featureCatalogue.register({
id: 'home_tutorial_directory',
title: i18n.translate('home.tutorialDirectory.featureCatalogueTitle', {
defaultMessage: 'Add data',
defaultMessage: 'Add sample data',
}),
description: i18n.translate('home.tutorialDirectory.featureCatalogueDescription', {
defaultMessage: 'Ingest data from popular apps and services.',
defaultMessage: 'Try our sample data.',
}),
icon: 'indexOpen',
showOnHomePage: true,
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { FeatureCatalogueCategory } from 'src/plugins/home/public';
const mockFeatures = [
{
category: FeatureCatalogueCategory.DATA,
description: 'Ingest data from popular apps and services.',
description: 'Try our sample data.',
showOnHomePage: true,
icon: 'indexOpen',
id: 'home_tutorial_directory',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

import React, { FC } from 'react';
import PropTypes from 'prop-types';
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';
import { CoreStart } from 'opensearch-dashboards/public';
import {
Expand Down Expand Up @@ -66,25 +66,6 @@ export const AddData: FC<Props> = ({ addBasePath, features }) => {
</h2>
</EuiTitle>
</EuiFlexItem>

<EuiFlexItem className="osdOverviewDataAdd__actions" grow={false}>
<RedirectAppLinks application={application}>
<div>
<EuiButtonEmpty
className="osdOverviewDataAdd__actionButton"
flush="left"
href={addBasePath('/app/home#/tutorial_directory/sampleData')}
iconType="visTable"
size="xs"
>
<FormattedMessage
id="opensearchDashboardsOverview.addData.sampleDataButtonLabel"
defaultMessage="Try our sample data"
/>
</EuiButtonEmpty>
</div>
</RedirectAppLinks>
</EuiFlexItem>
</EuiFlexGroup>

<EuiSpacer size="m" />
Expand Down

0 comments on commit 7ada5b0

Please sign in to comment.