Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change file data visualizer links to point to new location in home application #101393

Merged
merged 15 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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 @@ -13,7 +13,6 @@ import sinon from 'sinon';
import { findTestSubject } from '@elastic/eui/lib/test';
import { mountWithIntl } from '@kbn/test/jest';
import { docLinksServiceMock } from '../../../../../../core/public/mocks';
import { MlCardState } from '../../../types';

const docLinks = docLinksServiceMock.createStartContract();

Expand All @@ -30,7 +29,6 @@ describe('EmptyState', () => {
docLinks={docLinks}
onRefresh={() => {}}
navigateToApp={async () => {}}
getMlCardState={() => MlCardState.ENABLED}
canSave={true}
/>
);
Expand All @@ -48,7 +46,6 @@ describe('EmptyState', () => {
docLinks={docLinks}
onRefresh={onRefreshHandler}
navigateToApp={async () => {}}
getMlCardState={() => MlCardState.ENABLED}
canSave={true}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import './empty_state.scss';
import React from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { DocLinksStart, ApplicationStart } from 'kibana/public';
import {
Expand All @@ -28,60 +27,18 @@ import {
} from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { reactRouterNavigate } from '../../../../../../plugins/kibana_react/public';
import { MlCardState } from '../../../types';

export const EmptyState = ({
onRefresh,
navigateToApp,
docLinks,
getMlCardState,
canSave,
}: {
onRefresh: () => void;
navigateToApp: ApplicationStart['navigateToApp'];
docLinks: DocLinksStart;
getMlCardState: () => MlCardState;
canSave: boolean;
}) => {
const mlCard = (
<EuiFlexItem>
<EuiCard
onClick={() => navigateToApp('ml', { path: '#/filedatavisualizer' })}
className="inpEmptyState__card"
betaBadgeLabel={
getMlCardState() === MlCardState.ENABLED
? undefined
: i18n.translate(
'indexPatternManagement.createIndexPattern.emptyState.basicLicenseLabel',
{
defaultMessage: 'Basic',
}
)
}
betaBadgeTooltipContent={i18n.translate(
'indexPatternManagement.createIndexPattern.emptyState.basicLicenseDescription',
{
defaultMessage: 'This feature requires a Basic license.',
}
)}
isDisabled={getMlCardState() === MlCardState.DISABLED}
icon={<EuiIcon size="xl" type="document" color="subdued" />}
title={
<FormattedMessage
id="indexPatternManagement.createIndexPattern.emptyState.uploadCardTitle"
defaultMessage="Upload a file"
/>
}
description={
<FormattedMessage
id="indexPatternManagement.createIndexPattern.emptyState.uploadCardDescription"
defaultMessage="Import a CSV, NDJSON, or log file."
/>
}
/>
</EuiFlexItem>
);

const createAnyway = (
<EuiText color="subdued" textAlign="center" size="xs">
<FormattedMessage
Expand Down Expand Up @@ -143,7 +100,25 @@ export const EmptyState = ({
}
/>
</EuiFlexItem>
{getMlCardState() !== MlCardState.HIDDEN ? mlCard : <></>}
<EuiFlexItem>
<EuiCard
onClick={() => navigateToApp('home', { path: '#/tutorial_directory/fileDataViz' })}
className="inpEmptyState__card"
icon={<EuiIcon size="xl" type="document" color="subdued" />}
title={
<FormattedMessage
id="indexPatternManagement.createIndexPattern.emptyState.uploadCardTitle"
defaultMessage="Upload a file"
/>
}
description={
<FormattedMessage
id="indexPatternManagement.createIndexPattern.emptyState.uploadCardDescription"
defaultMessage="Import a CSV, NDJSON, or log file."
/>
}
/>
</EuiFlexItem>
<EuiFlexItem>
<EuiCard
className="inpEmptyState__card"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
application,
http,
data,
getMlCardState,
} = useKibana<IndexPatternManagmentContext>().services;
const [indexPatterns, setIndexPatterns] = useState<IndexPatternTableItem[]>([]);
const [creationOptions, setCreationOptions] = useState<IndexPatternCreationOption[]>([]);
Expand Down Expand Up @@ -182,7 +181,6 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
onRefresh={loadSources}
docLinks={docLinks}
navigateToApp={application.navigateToApp}
getMlCardState={getMlCardState}
canSave={canSave}
/>
);
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/index_pattern_management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ export {
IndexPatternCreationOption,
IndexPatternListConfig,
} from './service';

export { MlCardState } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
CreateIndexPatternWizardWithRouter,
} from '../components';
import { IndexPatternManagementStartDependencies, IndexPatternManagementStart } from '../plugin';
import { IndexPatternManagmentContext, MlCardState } from '../types';
import { IndexPatternManagmentContext } from '../types';

const readOnlyBadge = {
text: i18n.translate('indexPatternManagement.indexPatterns.badge.readOnly.text', {
Expand All @@ -37,8 +37,7 @@ const readOnlyBadge = {

export async function mountManagementSection(
getStartServices: StartServicesAccessor<IndexPatternManagementStartDependencies>,
params: ManagementAppMountParams,
getMlCardState: () => MlCardState
params: ManagementAppMountParams
) {
const [
{ chrome, application, uiSettings, notifications, overlays, http, docLinks },
Expand All @@ -63,7 +62,6 @@ export async function mountManagementSection(
indexPatternFieldEditor,
indexPatternManagementStart: indexPatternManagementStart as IndexPatternManagementStart,
setBreadcrumbs: params.setBreadcrumbs,
getMlCardState,
fieldFormatEditors: indexPatternFieldEditor.fieldFormatEditors,
};

Expand Down
4 changes: 0 additions & 4 deletions src/plugins/index_pattern_management/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ const createSetupContract = (): IndexPatternManagementSetup => ({
list: {
addListConfig: jest.fn(),
} as any,
environment: {
update: jest.fn(),
},
});

const createStartContract = (): IndexPatternManagementStart => ({
Expand Down Expand Up @@ -93,7 +90,6 @@ const createIndexPatternManagmentContext = (): {
indexPatternFieldEditor,
indexPatternManagementStart: createStartContract(),
setBreadcrumbs: () => {},
getMlCardState: () => 2,
fieldFormatEditors: indexPatternFieldEditor.fieldFormatEditors,
};
};
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/index_pattern_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ export class IndexPatternManagementPlugin
mount: async (params) => {
const { mountManagementSection } = await import('./management_app');

return mountManagementSection(core.getStartServices, params, () =>
this.indexPatternManagementService.environmentService.getEnvironment().ml()
);
return mountManagementSection(core.getStartServices, params);
},
});

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { HttpSetup } from '../../../../core/public';
import { IndexPatternCreationManager, IndexPatternCreationConfig } from './creation';
import { IndexPatternListManager, IndexPatternListConfig } from './list';
import { EnvironmentService } from './environment';
interface SetupDependencies {
httpClient: HttpSetup;
}
Expand All @@ -22,12 +21,10 @@ interface SetupDependencies {
export class IndexPatternManagementService {
indexPatternCreationManager: IndexPatternCreationManager;
indexPatternListConfig: IndexPatternListManager;
environmentService: EnvironmentService;

constructor() {
this.indexPatternCreationManager = new IndexPatternCreationManager();
this.indexPatternListConfig = new IndexPatternListManager();
this.environmentService = new EnvironmentService();
}

public setup({ httpClient }: SetupDependencies) {
Expand All @@ -40,7 +37,6 @@ export class IndexPatternManagementService {
return {
creation: creationManagerSetup,
list: indexPatternListConfigSetup,
environment: this.environmentService.setup(),
};
}

Expand Down
7 changes: 0 additions & 7 deletions src/plugins/index_pattern_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ export interface IndexPatternManagmentContext {
indexPatternFieldEditor: IndexPatternFieldEditorStart;
indexPatternManagementStart: IndexPatternManagementStart;
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs'];
getMlCardState: () => MlCardState;
fieldFormatEditors: IndexPatternFieldEditorStart['fieldFormatEditors'];
}

export type IndexPatternManagmentContextValue = KibanaReactContextValue<IndexPatternManagmentContext>;

export enum MlCardState {
HIDDEN,
DISABLED,
ENABLED,
}
1 change: 1 addition & 0 deletions x-pack/plugins/data_visualizer/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lens"
],
"requiredBundles": [
"home",
"kibanaReact",
"maps",
"esUiShared"
Expand Down
Loading