Skip to content

Commit

Permalink
Revert "[ML] Update the Overview page (#159609)"
Browse files Browse the repository at this point in the history
This reverts commit 6ac52fb.
  • Loading branch information
mistic committed Jun 20, 2023
1 parent 064c0e7 commit bd38b48
Show file tree
Hide file tree
Showing 18 changed files with 303 additions and 441 deletions.
11 changes: 0 additions & 11 deletions x-pack/plugins/ml/common/types/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const ML_GETTING_STARTED_CALLOUT_DISMISSED = 'ml.gettingStarted.isDismiss
export const ML_FROZEN_TIER_PREFERENCE = 'ml.frozenDataTierPreference';
export const ML_ANOMALY_EXPLORER_PANELS = 'ml.anomalyExplorerPanels';
export const ML_NOTIFICATIONS_LAST_CHECKED_AT = 'ml.notificationsLastCheckedAt';
export const ML_OVERVIEW_PANELS = 'ml.overviewPanels';

export type PartitionFieldConfig =
| {
Expand Down Expand Up @@ -53,12 +52,6 @@ export interface AnomalyExplorerPanelsState {
mainPage: { size: number };
}

export interface OverviewPanelsState {
nodes: boolean;
adJobs: boolean;
dfaJobs: boolean;
}

export interface MlStorageRecord {
[key: string]: unknown;
[ML_ENTITY_FIELDS_CONFIG]: PartitionFieldsConfig;
Expand All @@ -67,7 +60,6 @@ export interface MlStorageRecord {
[ML_FROZEN_TIER_PREFERENCE]: FrozenTierPreference;
[ML_ANOMALY_EXPLORER_PANELS]: AnomalyExplorerPanelsState | undefined;
[ML_NOTIFICATIONS_LAST_CHECKED_AT]: number | undefined;
[ML_OVERVIEW_PANELS]: OverviewPanelsState;
}

export type MlStorage = Partial<MlStorageRecord> | null;
Expand All @@ -86,8 +78,6 @@ export type TMlStorageMapped<T extends MlStorageKey> = T extends typeof ML_ENTIT
? AnomalyExplorerPanelsState | undefined
: T extends typeof ML_NOTIFICATIONS_LAST_CHECKED_AT
? number | undefined
: T extends typeof ML_OVERVIEW_PANELS
? OverviewPanelsState | undefined
: null;

export const ML_STORAGE_KEYS = [
Expand All @@ -97,5 +87,4 @@ export const ML_STORAGE_KEYS = [
ML_FROZEN_TIER_PREFERENCE,
ML_ANOMALY_EXPLORER_PANELS,
ML_NOTIFICATIONS_LAST_CHECKED_AT,
ML_OVERVIEW_PANELS,
] as const;

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
*/

import React, { FC } from 'react';
import { EuiButton, EuiEmptyPrompt, EuiImage, EuiLink } from '@elastic/eui';
import {
EuiButton,
EuiCallOut,
EuiEmptyPrompt,
EuiFlexGroup,
EuiFlexItem,
EuiImage,
EuiLink,
EuiTitle,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import dfaImage from './data_frame_analytics_kibana.png';
Expand All @@ -17,7 +26,10 @@ import { usePermissionCheck } from '../../../../../capabilities/check_capabiliti

export const AnalyticsEmptyPrompt: FC = () => {
const {
services: { docLinks },
services: {
docLinks,
http: { basePath },
},
} = useMlKibana();

const [canCreateDataFrameAnalytics, canStartStopDataFrameAnalytics] = usePermissionCheck([
Expand All @@ -28,6 +40,7 @@ export const AnalyticsEmptyPrompt: FC = () => {
const disabled =
!mlNodesAvailable() || !canCreateDataFrameAnalytics || !canStartStopDataFrameAnalytics;

const transformsLink = `${basePath.get()}/app/management/data/transform`;
const navigateToPath = useNavigateToPath();

const navigateToSourceSelection = async () => {
Expand All @@ -44,15 +57,16 @@ export const AnalyticsEmptyPrompt: FC = () => {
size="fullWidth"
src={dfaImage}
alt={i18n.translate('xpack.ml.dataFrame.analyticsList.emptyPromptTitle', {
defaultMessage: 'Analyze your data with data frame analytics',
defaultMessage: 'Create your first data frame analytics job',
})}
/>
}
color="subdued"
title={
<h2>
<FormattedMessage
id="xpack.ml.dataFrame.analyticsList.emptyPromptTitle"
defaultMessage="Analyze your data with data frame analytics"
defaultMessage="Create your first data frame analytics job"
/>
</h2>
}
Expand All @@ -64,26 +78,77 @@ export const AnalyticsEmptyPrompt: FC = () => {
defaultMessage="Train outlier detection, regression, or classification machine learning models using data frame analytics."
/>
</p>
<EuiCallOut
size="s"
title={
<FormattedMessage
id="xpack.ml.overview.analyticsList.emptyPromptHelperText"
defaultMessage="Before building a data frame analytics job, use {transforms} to construct an {sourcedata}."
values={{
transforms: (
<EuiLink href={transformsLink} target="blank" color={'accent'}>
<FormattedMessage
id="xpack.ml.overview.gettingStartedSectionTransforms"
defaultMessage="transforms"
/>
</EuiLink>
),
sourcedata: (
<EuiLink
href={docLinks.links.ml.dFAPrepareData}
target="blank"
color={'accent'}
external
>
<FormattedMessage
id="xpack.ml.overview.gettingStartedSectionSourceData"
defaultMessage="entity-centric source data set"
/>
</EuiLink>
),
}}
/>
}
iconType="iInCircle"
/>
</>
}
actions={[
<EuiButton
onClick={navigateToSourceSelection}
isDisabled={disabled}
color="primary"
iconType="plusInCircle"
fill
data-test-subj="mlAnalyticsCreateFirstButton"
>
{i18n.translate('xpack.ml.dataFrame.analyticsList.emptyPromptButtonText', {
defaultMessage: 'Create data frame analytics job',
defaultMessage: 'Create job',
})}
</EuiButton>,
<EuiLink href={docLinks.links.ml.dataFrameAnalytics} target="_blank" external>
<FormattedMessage
id="xpack.ml.common.readDocumentationLink"
defaultMessage="Read documentation"
/>
</EuiLink>,
]}
footer={
<EuiFlexGroup gutterSize={'xs'} alignItems={'center'}>
<EuiFlexItem grow={false}>
<EuiTitle size="xxs">
<h3>
<FormattedMessage
id="xpack.ml.common.learnMoreQuestion"
defaultMessage="Want to learn more?"
/>
</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink href={docLinks.links.ml.dataFrameAnalytics} target="_blank" external>
<FormattedMessage
id="xpack.ml.common.readDocumentationLink"
defaultMessage="Read documentation"
/>
</EuiLink>
</EuiFlexItem>
</EuiFlexGroup>
}
data-test-subj="mlNoDataFrameAnalyticsFound"
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('get_analytics', () => {
// act and assert
expect(getAnalyticsJobsStats(mockResponse)).toEqual({
total: {
label: 'Total',
label: 'Total analytics jobs',
value: 2,
show: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function getInitialAnalyticsStats(): AnalyticStatsBarStats {
return {
total: {
label: i18n.translate('xpack.ml.overview.statsBar.totalAnalyticsLabel', {
defaultMessage: 'Total',
defaultMessage: 'Total analytics jobs',
}),
value: 0,
show: true,
Expand Down Expand Up @@ -97,18 +97,12 @@ export function getAnalyticsJobsStats(
);
resultStats.failed.show = resultStats.failed.value > 0;
resultStats.total.value = analyticsStats.count;

if (resultStats.total.value === 0) {
resultStats.started.show = false;
resultStats.stopped.show = false;
}

return resultStats;
}

export const getAnalyticsFactory = (
setAnalytics: React.Dispatch<React.SetStateAction<DataFrameAnalyticsListRow[]>>,
setAnalyticsStats: (update: AnalyticStatsBarStats | undefined) => void,
setAnalyticsStats: React.Dispatch<React.SetStateAction<AnalyticStatsBarStats | undefined>>,
setErrorMessage: React.Dispatch<
React.SetStateAction<GetDataFrameAnalyticsStatsResponseError | undefined>
>,
Expand Down
Loading

0 comments on commit bd38b48

Please sign in to comment.