Skip to content

Commit

Permalink
Change file data visualizer links to point to new location in home ap…
Browse files Browse the repository at this point in the history
…plication (elastic#101393) (elastic#101844)

* Link to home file data visualizer

* remove unused import

* i18n cleanup

* remove unused import from EmptyState

* use const

* remove ml functional test cases checking for ml_file_data_visualizer

* more clean-up of ml_file_data_visualizer

* jest snapshot and nav to home page in no_ml_access tests

* revert change to functional test dual_privileges_all at everything_space

* revert another change to security_and_spaces/tests/catalogue.ts

* revert changes to x-pack/test/ui_capabilities/security_only/tests/catalogue.ts

Co-authored-by: Kibana Machine <[email protected]>
# Conflicts:
#	src/plugins/index_pattern_management/public/components/index_pattern_table/index_pattern_table.tsx
  • Loading branch information
nreese authored Jun 9, 2021
1 parent 35a5fd6 commit f55cfb3
Show file tree
Hide file tree
Showing 29 changed files with 48 additions and 292 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 @@ -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 @@ -75,7 +75,6 @@ export const IndexPatternTable = ({ canSave, history }: Props) => {
docLinks,
application,
http,
getMlCardState,
data,
} = useKibana<IndexPatternManagmentContext>().services;
const [indexPatterns, setIndexPatterns] = useState<IndexPatternTableItem[]>([]);
Expand Down Expand Up @@ -184,7 +183,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

0 comments on commit f55cfb3

Please sign in to comment.