mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] Add new View job detail flyouts for Anomaly detection and Data Frame Analytics (#207141)
## Summary This PR adds new View job detail flyout for Anomaly detection and Data Frame Analytics **For Anomaly detection jobs:** - New options are added when clicking on job's name (Remove from page, View datafeed charts, Navigate to Single Metric Viewer/Anomaly Explorer) <img width="553" alt="Screenshot 2025-01-24 at 15 02 10" src="https://github.com/user-attachments/assets/207fa601-b04e-4ab6-b808-e0e420b40584" /> - If there's only one job, the remove from {page} is disabled <img width="553" alt="Screenshot 2025-01-24 at 15 02 01" src="https://github.com/user-attachments/assets/6b2e75a6-e508-4a7d-8e07-dec9b22fc67a" /> https://github.com/user-attachments/assets/1a4f0e8f-da15-4e8c-86bd-48045f9144f9 **For Anomaly detection groups:** - Remove job option is not shown https://github.com/user-attachments/assets/1976f7dc-8cfe-4f94-975e-233f0225e15b https://github.com/user-attachments/assets/3381a4f2-ec99-4848-b2fe-9df456306523 **For Data frame analytics jobs:** https://github.com/user-attachments/assets/7e067ac2-4eda-44b3-bc63-a5901912350f ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
3430ab8246
commit
201169a04a
23 changed files with 1165 additions and 191 deletions
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { EuiContextMenuPanelItemDescriptor } from '@elastic/eui';
|
||||
import type { SharePluginStart } from '@kbn/share-plugin/public';
|
||||
import { ML_PAGES, type MlPages } from '../../../../locator';
|
||||
import { FlyoutType } from '../../../jobs/components/job_details_flyout/job_details_flyout_context';
|
||||
import { ML_APP_LOCATOR } from '../../../../../common/constants/locator';
|
||||
|
||||
const ANOMALY_EXPLORER_TITLE = i18n.translate('xpack.ml.anomalyExplorerPageLabel', {
|
||||
defaultMessage: 'Anomaly Explorer',
|
||||
});
|
||||
const SINGLE_METRIC_VIEWER_TITLE = i18n.translate('xpack.ml.singleMetricViewerPageLabel', {
|
||||
defaultMessage: 'Single Metric Viewer',
|
||||
});
|
||||
|
||||
export const getOptionsForJobSelectorMenuItems = ({
|
||||
jobId,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
showRemoveJobId,
|
||||
isSingleMetricViewerDisabled,
|
||||
closePopover,
|
||||
globalState,
|
||||
setActiveFlyout,
|
||||
setActiveJobId,
|
||||
navigateToUrl,
|
||||
share,
|
||||
}: {
|
||||
jobId: string;
|
||||
page: MlPages;
|
||||
onRemoveJobId: (jobOrGroupId: string[]) => void;
|
||||
removeJobIdDisabled: boolean;
|
||||
showRemoveJobId: boolean;
|
||||
isSingleMetricViewerDisabled: boolean;
|
||||
closePopover: () => void;
|
||||
globalState: Record<string, any>;
|
||||
setActiveFlyout: (flyout: FlyoutType | null) => void;
|
||||
setActiveJobId: (jobId: string | null) => void;
|
||||
navigateToUrl: (url: string) => void;
|
||||
share: SharePluginStart;
|
||||
}) => {
|
||||
const pageToNavigateTo =
|
||||
page === ML_PAGES.SINGLE_METRIC_VIEWER ? ANOMALY_EXPLORER_TITLE : SINGLE_METRIC_VIEWER_TITLE;
|
||||
const viewInMenu: EuiContextMenuPanelItemDescriptor = {
|
||||
name: i18n.translate(
|
||||
'xpack.ml.overview.anomalyDetection.jobContextMenu.viewInSingleMetricViewer',
|
||||
{
|
||||
defaultMessage: 'View in {page}',
|
||||
values: {
|
||||
page: pageToNavigateTo,
|
||||
},
|
||||
}
|
||||
),
|
||||
disabled: page === ML_PAGES.ANOMALY_EXPLORER && isSingleMetricViewerDisabled,
|
||||
icon: 'visLine',
|
||||
onClick: async () => {
|
||||
const mlLocator = share.url.locators.get(ML_APP_LOCATOR);
|
||||
if (!mlLocator) {
|
||||
return;
|
||||
}
|
||||
const singleMetricViewerLink = await mlLocator.getUrl(
|
||||
{
|
||||
page:
|
||||
page === ML_PAGES.SINGLE_METRIC_VIEWER
|
||||
? ML_PAGES.ANOMALY_EXPLORER
|
||||
: ML_PAGES.SINGLE_METRIC_VIEWER,
|
||||
pageState: {
|
||||
globalState,
|
||||
refreshInterval: {
|
||||
display: 'Off',
|
||||
pause: true,
|
||||
value: 0,
|
||||
},
|
||||
jobIds: [jobId],
|
||||
query: {
|
||||
query_string: {
|
||||
analyze_wildcard: true,
|
||||
query: '*',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{ absolute: true }
|
||||
);
|
||||
navigateToUrl(singleMetricViewerLink);
|
||||
|
||||
closePopover();
|
||||
},
|
||||
};
|
||||
|
||||
const items = [
|
||||
{
|
||||
name: i18n.translate('xpack.ml.overview.anomalyDetection.jobContextMenu.jobDetails', {
|
||||
defaultMessage: 'Job details',
|
||||
}),
|
||||
icon: 'eye',
|
||||
onClick: () => {
|
||||
setActiveJobId(jobId);
|
||||
setActiveFlyout(FlyoutType.JOB_DETAILS);
|
||||
closePopover();
|
||||
},
|
||||
},
|
||||
...(showRemoveJobId
|
||||
? [
|
||||
{
|
||||
name: i18n.translate('xpack.ml.overview.anomalyDetection.jobContextMenu.removeJob', {
|
||||
defaultMessage: 'Remove from {page}',
|
||||
values: {
|
||||
page: ANOMALY_EXPLORER_TITLE,
|
||||
},
|
||||
}),
|
||||
disabled: removeJobIdDisabled,
|
||||
icon: 'minusInCircle',
|
||||
onClick: () => {
|
||||
if (onRemoveJobId) {
|
||||
onRemoveJobId([jobId]);
|
||||
setActiveJobId(jobId);
|
||||
setActiveFlyout(null);
|
||||
}
|
||||
closePopover();
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
isSeparator: true,
|
||||
key: 'separator2',
|
||||
} as EuiContextMenuPanelItemDescriptor,
|
||||
...(viewInMenu.disabled ? [] : [viewInMenu]),
|
||||
{
|
||||
name: i18n.translate('xpack.ml.overview.anomalyDetection.jobContextMenu.viewDatafeedCounts', {
|
||||
defaultMessage: 'View datafeed counts',
|
||||
}),
|
||||
icon: 'visAreaStacked',
|
||||
onClick: () => {
|
||||
setActiveJobId(jobId);
|
||||
setActiveFlyout(FlyoutType.DATAFEED_CHART);
|
||||
closePopover();
|
||||
},
|
||||
},
|
||||
];
|
||||
return items;
|
||||
};
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { EuiContextMenuPanelDescriptor } from '@elastic/eui';
|
||||
import { EuiContextMenu, EuiNotificationBadge, EuiPopover } from '@elastic/eui';
|
||||
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { EuiButton } from '@elastic/eui';
|
||||
import { useUrlState } from '@kbn/ml-url-state';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import type { MlPages } from '../../../../locator';
|
||||
import { useJobInfoFlyouts } from '../../../jobs/components/job_details_flyout/job_details_flyout_context';
|
||||
import { getOptionsForJobSelectorMenuItems } from './get_options_for_job_selector_menu';
|
||||
import { useMlKibana } from '../../../contexts/kibana';
|
||||
|
||||
export const GroupSelectorMenu = ({
|
||||
groupId,
|
||||
jobIds,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
removeGroupDisabled,
|
||||
singleMetricViewerDisabledIds = [],
|
||||
}: {
|
||||
groupId: string;
|
||||
jobIds: string[];
|
||||
page: MlPages;
|
||||
onRemoveJobId: (jobOrGroupId: string[]) => void;
|
||||
removeJobIdDisabled: boolean;
|
||||
removeGroupDisabled: boolean;
|
||||
singleMetricViewerDisabledIds: string[];
|
||||
}) => {
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
||||
const { setActiveFlyout, setActiveJobId } = useJobInfoFlyouts();
|
||||
const {
|
||||
services: {
|
||||
share,
|
||||
application: { navigateToUrl },
|
||||
},
|
||||
} = useMlKibana();
|
||||
const [globalState] = useUrlState('_g');
|
||||
|
||||
const closePopover = () => setIsPopoverOpen(false);
|
||||
const onButtonClick = () => setIsPopoverOpen(true);
|
||||
|
||||
const popoverId = `mlAnomalyGroupPopover-${groupId}`;
|
||||
const button = (
|
||||
<EuiButton
|
||||
data-test-subj="mlJobSelectionBadge"
|
||||
iconType="folderClosed"
|
||||
iconSide="left"
|
||||
onClick={onButtonClick}
|
||||
size="s"
|
||||
color="text"
|
||||
>
|
||||
{groupId}
|
||||
<EuiNotificationBadge size="s">{jobIds.length}</EuiNotificationBadge>
|
||||
</EuiButton>
|
||||
);
|
||||
const panels: EuiContextMenuPanelDescriptor[] = useMemo(() => {
|
||||
const items: EuiContextMenuPanelDescriptor[] = [
|
||||
{
|
||||
id: 0,
|
||||
items: [
|
||||
...jobIds.map((jobId, idx) => ({
|
||||
panel: jobId,
|
||||
name: jobId,
|
||||
})),
|
||||
{
|
||||
isSeparator: true,
|
||||
},
|
||||
{
|
||||
name: i18n.translate('xpack.ml.groupSelectorMenu.removeGroupLabel', {
|
||||
defaultMessage: 'Remove group from {page}',
|
||||
values: { page },
|
||||
}),
|
||||
icon: 'minusInCircle',
|
||||
disabled: removeGroupDisabled,
|
||||
onClick: () => {
|
||||
onRemoveJobId([groupId, ...jobIds]);
|
||||
closePopover();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
jobIds.forEach((jobId) => {
|
||||
const options = getOptionsForJobSelectorMenuItems({
|
||||
jobId,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
showRemoveJobId: false,
|
||||
isSingleMetricViewerDisabled: singleMetricViewerDisabledIds.includes(jobId),
|
||||
closePopover,
|
||||
globalState,
|
||||
setActiveFlyout,
|
||||
setActiveJobId,
|
||||
navigateToUrl,
|
||||
share,
|
||||
});
|
||||
const jobPanel: EuiContextMenuPanelDescriptor = {
|
||||
id: jobId,
|
||||
title: jobId,
|
||||
items: options,
|
||||
};
|
||||
items.push(jobPanel);
|
||||
});
|
||||
return items;
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
jobIds,
|
||||
setActiveFlyout,
|
||||
setActiveJobId,
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
JSON.stringify(globalState),
|
||||
navigateToUrl,
|
||||
share,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
removeGroupDisabled,
|
||||
]);
|
||||
return (
|
||||
<EuiPopover
|
||||
id={popoverId}
|
||||
button={button}
|
||||
isOpen={isPopoverOpen}
|
||||
closePopover={closePopover}
|
||||
panelPaddingSize="none"
|
||||
anchorPosition="downLeft"
|
||||
>
|
||||
<EuiContextMenu initialPanelId={0} panels={panels} />
|
||||
</EuiPopover>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { FC } from 'react';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import type { EuiContextMenuPanelDescriptor } from '@elastic/eui';
|
||||
import { EuiButton, EuiContextMenu, EuiPopover, useGeneratedHtmlId } from '@elastic/eui';
|
||||
import { useUrlState } from '@kbn/ml-url-state';
|
||||
import { ML_PAGES, type MlPages } from '../../../../../common/constants/locator';
|
||||
import { useJobInfoFlyouts } from '../../../jobs/components/job_details_flyout';
|
||||
import { useMlKibana } from '../../../contexts/kibana';
|
||||
import { getOptionsForJobSelectorMenuItems } from './get_options_for_job_selector_menu';
|
||||
|
||||
interface Props {
|
||||
jobId: string;
|
||||
page: MlPages;
|
||||
onRemoveJobId: (jobOrGroupId: string[]) => void;
|
||||
removeJobIdDisabled: boolean;
|
||||
isSingleMetricViewerDisabled: boolean;
|
||||
}
|
||||
|
||||
export const AnomalyDetectionInfoButton: FC<Props> = ({
|
||||
jobId,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
isSingleMetricViewerDisabled,
|
||||
}) => {
|
||||
const [isPopoverOpen, setPopover] = useState(false);
|
||||
const {
|
||||
services: {
|
||||
share,
|
||||
application: { navigateToUrl },
|
||||
},
|
||||
} = useMlKibana();
|
||||
const [globalState] = useUrlState('_g');
|
||||
|
||||
const popoverId = useGeneratedHtmlId({
|
||||
prefix: 'adJobInfoContextMenu',
|
||||
suffix: jobId,
|
||||
});
|
||||
const onButtonClick = () => {
|
||||
setPopover(!isPopoverOpen);
|
||||
};
|
||||
const closePopover = () => {
|
||||
setPopover(false);
|
||||
};
|
||||
|
||||
const { setActiveFlyout, setActiveJobId } = useJobInfoFlyouts();
|
||||
const panels = useMemo(
|
||||
() => {
|
||||
return [
|
||||
{
|
||||
id: 0,
|
||||
items: getOptionsForJobSelectorMenuItems({
|
||||
jobId,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
removeJobIdDisabled,
|
||||
showRemoveJobId: page === ML_PAGES.ANOMALY_EXPLORER,
|
||||
isSingleMetricViewerDisabled,
|
||||
closePopover,
|
||||
globalState,
|
||||
setActiveFlyout,
|
||||
setActiveJobId,
|
||||
navigateToUrl,
|
||||
share,
|
||||
}),
|
||||
},
|
||||
] as EuiContextMenuPanelDescriptor[];
|
||||
},
|
||||
// globalState is an object with references change on every render, so we are stringifying it here
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[
|
||||
jobId,
|
||||
page,
|
||||
setActiveJobId,
|
||||
setActiveFlyout,
|
||||
navigateToUrl,
|
||||
share.url.locators,
|
||||
removeJobIdDisabled,
|
||||
onRemoveJobId,
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
JSON.stringify(globalState),
|
||||
]
|
||||
);
|
||||
|
||||
const button = (
|
||||
<EuiButton
|
||||
data-test-subj="mlJobSelectionBadge"
|
||||
iconType="boxesVertical"
|
||||
iconSide="right"
|
||||
onClick={onButtonClick}
|
||||
size="s"
|
||||
color="text"
|
||||
>
|
||||
{jobId}
|
||||
</EuiButton>
|
||||
);
|
||||
return (
|
||||
<EuiPopover
|
||||
id={popoverId}
|
||||
button={button}
|
||||
isOpen={isPopoverOpen}
|
||||
closePopover={closePopover}
|
||||
panelPaddingSize="none"
|
||||
anchorPosition="downLeft"
|
||||
>
|
||||
<EuiContextMenu initialPanelId={0} panels={panels} />
|
||||
</EuiPopover>
|
||||
);
|
||||
};
|
|
@ -9,8 +9,19 @@ import React from 'react';
|
|||
import { render } from '@testing-library/react';
|
||||
import type { IdBadgesProps } from './id_badges';
|
||||
import { IdBadges } from './id_badges';
|
||||
import type { MlSummaryJob } from '../../../../../common/types/anomaly_detection_jobs';
|
||||
|
||||
jest.mock('../../../contexts/kibana', () => ({
|
||||
useMlKibana: () => ({
|
||||
services: {
|
||||
share: { url: { locators: jest.fn() } },
|
||||
application: { navigateToUrl: jest.fn() },
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
const props: IdBadgesProps = {
|
||||
page: 'jobs',
|
||||
limit: 2,
|
||||
selectedGroups: [
|
||||
{
|
||||
|
@ -25,6 +36,21 @@ const props: IdBadgesProps = {
|
|||
selectedJobIds: ['job1', 'job2', 'job3'],
|
||||
onLinkClick: jest.fn(),
|
||||
showAllBarBadges: false,
|
||||
onRemoveJobId: jest.fn(),
|
||||
selectedJobs: [
|
||||
{
|
||||
id: 'job1',
|
||||
isSingleMetricViewerJob: false,
|
||||
} as MlSummaryJob,
|
||||
{
|
||||
id: 'job2',
|
||||
isSingleMetricViewerJob: true,
|
||||
} as MlSummaryJob,
|
||||
{
|
||||
id: 'job3',
|
||||
isSingleMetricViewerJob: true,
|
||||
} as MlSummaryJob,
|
||||
],
|
||||
};
|
||||
|
||||
const overLimitProps: IdBadgesProps = { ...props, selectedJobIds: ['job4'] };
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { EuiFlexItem, EuiLink, EuiText } from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { JobSelectorBadge } from '../job_selector_badge';
|
||||
import { GroupSelectorMenu } from '../group_or_job_selector_menu/group_selector_menu';
|
||||
import type { GroupObj } from '../job_selector';
|
||||
import { AnomalyDetectionInfoButton } from '../group_or_job_selector_menu/job_selector_button';
|
||||
import type { MlPages } from '../../../../../common/constants/locator';
|
||||
import type { MlSummaryJob } from '../../../../../common/types/anomaly_detection_jobs';
|
||||
|
||||
export interface IdBadgesProps {
|
||||
limit: number;
|
||||
|
@ -17,6 +20,9 @@ export interface IdBadgesProps {
|
|||
selectedJobIds: string[];
|
||||
onLinkClick: () => void;
|
||||
showAllBarBadges: boolean;
|
||||
page: MlPages;
|
||||
onRemoveJobId: (jobOrGroupId: string[]) => void;
|
||||
selectedJobs: MlSummaryJob[];
|
||||
}
|
||||
|
||||
export function IdBadges({
|
||||
|
@ -25,18 +31,30 @@ export function IdBadges({
|
|||
onLinkClick,
|
||||
selectedJobIds,
|
||||
showAllBarBadges,
|
||||
page,
|
||||
onRemoveJobId,
|
||||
selectedJobs,
|
||||
}: IdBadgesProps) {
|
||||
const badges = [];
|
||||
|
||||
const singleMetricViewerDisabledIds: string[] = useMemo(
|
||||
() => selectedJobs.filter((job) => !job.isSingleMetricViewerJob).map((job) => job.id),
|
||||
[selectedJobs]
|
||||
);
|
||||
// Create group badges. Skip job ids here.
|
||||
for (let i = 0; i < selectedGroups.length; i++) {
|
||||
const currentGroup = selectedGroups[i];
|
||||
badges.push(
|
||||
<EuiFlexItem grow={false} key={currentGroup.groupId}>
|
||||
<JobSelectorBadge
|
||||
id={currentGroup.groupId}
|
||||
isGroup={true}
|
||||
numJobs={currentGroup.jobIds.length}
|
||||
<GroupSelectorMenu
|
||||
groupId={currentGroup.groupId}
|
||||
jobIds={currentGroup.jobIds}
|
||||
page={page}
|
||||
onRemoveJobId={onRemoveJobId}
|
||||
removeJobIdDisabled={selectedJobIds.length < 2}
|
||||
removeGroupDisabled={
|
||||
selectedGroups.length < 2 && selectedJobIds.length <= currentGroup.jobIds.length
|
||||
}
|
||||
singleMetricViewerDisabledIds={singleMetricViewerDisabledIds}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
);
|
||||
|
@ -49,7 +67,13 @@ export function IdBadges({
|
|||
}
|
||||
badges.push(
|
||||
<EuiFlexItem grow={false} key={currentId}>
|
||||
<JobSelectorBadge id={currentId} />
|
||||
<AnomalyDetectionInfoButton
|
||||
jobId={currentId}
|
||||
page={page}
|
||||
onRemoveJobId={onRemoveJobId}
|
||||
removeJobIdDisabled={selectedJobIds.length < 2}
|
||||
isSingleMetricViewerDisabled={singleMetricViewerDisabledIds.includes(currentId)}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
|
||||
import {
|
||||
EuiButtonEmpty,
|
||||
|
@ -24,9 +24,14 @@ import type { Dictionary } from '../../../../common/types/common';
|
|||
import { IdBadges } from './id_badges';
|
||||
import type { JobSelectorFlyoutProps } from './job_selector_flyout';
|
||||
import { BADGE_LIMIT, JobSelectorFlyoutContent } from './job_selector_flyout';
|
||||
import type { MlJobWithTimeRange } from '../../../../common/types/anomaly_detection_jobs';
|
||||
import type {
|
||||
MlJobWithTimeRange,
|
||||
MlSummaryJob,
|
||||
} from '../../../../common/types/anomaly_detection_jobs';
|
||||
import { ML_APPLY_TIME_RANGE_CONFIG } from '../../../../common/types/storage';
|
||||
import { FeedBackButton } from '../feedback_button';
|
||||
import { JobInfoFlyoutsProvider } from '../../jobs/components/job_details_flyout';
|
||||
import { JobInfoFlyoutsManager } from '../../jobs/components/job_details_flyout/job_details_context_manager';
|
||||
|
||||
export interface GroupObj {
|
||||
groupId: string;
|
||||
|
@ -86,6 +91,7 @@ export interface JobSelectorProps {
|
|||
}) => void;
|
||||
selectedJobIds?: string[];
|
||||
selectedGroups?: GroupObj[];
|
||||
selectedJobs?: MlSummaryJob[];
|
||||
}
|
||||
|
||||
export interface JobSelectionMaps {
|
||||
|
@ -99,6 +105,7 @@ export function JobSelector({
|
|||
timeseriesOnly,
|
||||
selectedJobIds = [],
|
||||
selectedGroups = [],
|
||||
selectedJobs = [],
|
||||
onSelectionChange,
|
||||
}: JobSelectorProps) {
|
||||
const [applyTimeRangeConfig, setApplyTimeRangeConfig] = useStorage(
|
||||
|
@ -141,6 +148,14 @@ export function JobSelector({
|
|||
[onSelectionChange]
|
||||
);
|
||||
|
||||
const page = useMemo(() => {
|
||||
return singleSelection ? ML_PAGES.SINGLE_METRIC_VIEWER : ML_PAGES.ANOMALY_EXPLORER;
|
||||
}, [singleSelection]);
|
||||
|
||||
const removeJobId = (jobOrGroupId: string[]) => {
|
||||
const newSelection = selectedIds.filter((id) => !jobOrGroupId.includes(id));
|
||||
applySelection({ newSelection, jobIds: newSelection, time: undefined });
|
||||
};
|
||||
function renderJobSelectionBar() {
|
||||
return (
|
||||
<>
|
||||
|
@ -159,7 +174,10 @@ export function JobSelector({
|
|||
onLinkClick={() => setShowAllBarBadges(!showAllBarBadges)}
|
||||
selectedJobIds={selectedJobIds}
|
||||
selectedGroups={selectedGroups}
|
||||
selectedJobs={selectedJobs}
|
||||
showAllBarBadges={showAllBarBadges}
|
||||
page={page}
|
||||
onRemoveJobId={removeJobId}
|
||||
/>
|
||||
</EuiFlexGroup>
|
||||
) : (
|
||||
|
@ -187,10 +205,7 @@ export function JobSelector({
|
|||
<EuiFlexItem />
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<FeedBackButton
|
||||
jobIds={selectedIds}
|
||||
page={singleSelection ? ML_PAGES.SINGLE_METRIC_VIEWER : ML_PAGES.ANOMALY_EXPLORER}
|
||||
/>
|
||||
<FeedBackButton jobIds={selectedIds} page={page} />
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<EuiHorizontalRule margin="s" />
|
||||
|
@ -223,8 +238,11 @@ export function JobSelector({
|
|||
|
||||
return (
|
||||
<div>
|
||||
{renderJobSelectionBar()}
|
||||
{renderFlyout()}
|
||||
<JobInfoFlyoutsProvider>
|
||||
{renderJobSelectionBar()}
|
||||
{renderFlyout()}
|
||||
<JobInfoFlyoutsManager />
|
||||
</JobInfoFlyoutsProvider>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ export const DEFAULT_GANTT_BAR_WIDTH = 299; // pixels
|
|||
export interface JobSelectionResult {
|
||||
newSelection: string[];
|
||||
jobIds: string[];
|
||||
time: { from: string; to: string } | undefined;
|
||||
time?: { from: string; to: string } | undefined;
|
||||
}
|
||||
|
||||
export interface JobSelectorFlyoutProps {
|
||||
|
|
|
@ -10,6 +10,17 @@ import { render } from '@testing-library/react';
|
|||
import type { NewSelectionIdBadgesProps } from './new_selection_id_badges';
|
||||
import { NewSelectionIdBadges } from './new_selection_id_badges';
|
||||
|
||||
jest.mock('../../../contexts/kibana', () => ({
|
||||
useMlKibana: () => ({
|
||||
services: {
|
||||
share: {},
|
||||
application: {
|
||||
navigateToUrl: jest.fn(),
|
||||
},
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
const props: NewSelectionIdBadgesProps = {
|
||||
limit: 2,
|
||||
groups: [
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
EuiButtonEmpty,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiFlyout,
|
||||
EuiFlyoutBody,
|
||||
EuiFlyoutHeader,
|
||||
EuiLoadingSpinner,
|
||||
EuiText,
|
||||
EuiTitle,
|
||||
} from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { useUrlState } from '@kbn/ml-url-state';
|
||||
import { useJobInfoFlyouts } from '../../../../../jobs/components/job_details_flyout';
|
||||
import { useGetAnalytics } from '../../../analytics_management/services/analytics_service';
|
||||
import type { AnalyticStatsBarStats } from '../../../../../components/stats_bar';
|
||||
import type { DataFrameAnalyticsListRow } from '../../../analytics_management/components/analytics_list/common';
|
||||
import { useMlLocator, useNavigateToPath } from '../../../../../contexts/kibana';
|
||||
import { ML_PAGES } from '../../../../../../locator';
|
||||
import { ExpandedRow } from '../../../analytics_management/components/analytics_list/expanded_row';
|
||||
|
||||
export const AnalyticsDetailFlyout = () => {
|
||||
const {
|
||||
isDataFrameAnalyticsDetailsFlyoutOpen,
|
||||
closeActiveFlyout,
|
||||
setActiveJobId,
|
||||
activeJobId: analyticsId,
|
||||
} = useJobInfoFlyouts();
|
||||
const [analytics, setAnalytics] = useState<DataFrameAnalyticsListRow[]>([]);
|
||||
const [, setAnalyticsStats] = useState<AnalyticStatsBarStats | undefined>(undefined);
|
||||
const [, setErrorMessage] = useState<any>(undefined);
|
||||
const [, setIsInitialized] = useState(false);
|
||||
const [, setJobsAwaitingNodeCount] = useState(0);
|
||||
const blockRefresh = false;
|
||||
const getAnalytics = useGetAnalytics(
|
||||
setAnalytics,
|
||||
setAnalyticsStats,
|
||||
setErrorMessage,
|
||||
setIsInitialized,
|
||||
setJobsAwaitingNodeCount,
|
||||
blockRefresh
|
||||
);
|
||||
const getAnalyticsCallback = useCallback(
|
||||
(id: string | null) => getAnalytics(true, id),
|
||||
[getAnalytics]
|
||||
);
|
||||
|
||||
// Subscribe to the refresh observable to trigger reloading the analytics list.
|
||||
|
||||
useEffect(
|
||||
function getAnalyticsDetailsOnChange() {
|
||||
if (!analyticsId) {
|
||||
return;
|
||||
}
|
||||
getAnalyticsCallback(analyticsId);
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[analyticsId]
|
||||
);
|
||||
const analytic = useMemo(
|
||||
() => analytics.find((a) => a.id === analyticsId),
|
||||
[analytics, analyticsId]
|
||||
);
|
||||
|
||||
const locator = useMlLocator()!;
|
||||
const navigateToPath = useNavigateToPath();
|
||||
const [globalState] = useUrlState('_g');
|
||||
|
||||
const redirectToAnalyticsList = useCallback(async () => {
|
||||
const path = await locator.getUrl({
|
||||
page: ML_PAGES.DATA_FRAME_ANALYTICS_JOBS_MANAGE,
|
||||
pageState: {
|
||||
jobId: globalState?.ml?.jobId,
|
||||
},
|
||||
});
|
||||
await navigateToPath(path, false);
|
||||
}, [locator, navigateToPath, globalState?.ml?.jobId]);
|
||||
|
||||
const flyoutTitleId = `mlAnalyticsDetailsFlyout-${analyticsId}`;
|
||||
return isDataFrameAnalyticsDetailsFlyoutOpen ? (
|
||||
<EuiFlyout
|
||||
data-test-subj="analyticsDetailsFlyout"
|
||||
type="overlay"
|
||||
size="m"
|
||||
ownFocus={false}
|
||||
onClose={() => {
|
||||
closeActiveFlyout();
|
||||
setActiveJobId(null);
|
||||
}}
|
||||
aria-labelledby={flyoutTitleId}
|
||||
>
|
||||
<EuiFlyoutHeader hasBorder data-test-subj={`analyticsDetailsFlyout-${analyticsId}`}>
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem grow={true}>
|
||||
<EuiTitle size="s">
|
||||
<h2 id={flyoutTitleId}>{analyticsId}</h2>
|
||||
</EuiTitle>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButtonEmpty onClick={redirectToAnalyticsList}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobDetailsFlyout.openJobsListButton"
|
||||
defaultMessage="Open jobs list"
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiFlyoutHeader>
|
||||
<EuiFlyoutBody>
|
||||
{analytic ? (
|
||||
<ExpandedRow item={analytic} />
|
||||
) : (
|
||||
<EuiText textAlign="center">
|
||||
<EuiLoadingSpinner />
|
||||
</EuiText>
|
||||
)}
|
||||
</EuiFlyoutBody>
|
||||
</EuiFlyout>
|
||||
) : null;
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { AnalyticsDetailFlyout } from './analytics_detail_flyout';
|
|
@ -26,6 +26,8 @@ import type { AnalyticsSelectorIds } from '../components/analytics_selector';
|
|||
import { AnalyticsIdSelector, AnalyticsIdSelectorControls } from '../components/analytics_selector';
|
||||
import { AnalyticsEmptyPrompt } from '../analytics_management/components/empty_prompt';
|
||||
import { SavedObjectsWarning } from '../../../components/saved_objects_warning';
|
||||
import { JobInfoFlyoutsProvider } from '../../../jobs/components/job_details_flyout/job_details_flyout_context';
|
||||
import { AnalyticsDetailFlyout } from './components/analytics_detail_flyout';
|
||||
|
||||
export const Page: FC<{
|
||||
jobId: string;
|
||||
|
@ -131,52 +133,55 @@ export const Page: FC<{
|
|||
|
||||
return (
|
||||
<>
|
||||
<AnalyticsIdSelectorControls
|
||||
setIsIdSelectorFlyoutVisible={setIsIdSelectorFlyoutVisible}
|
||||
selectedId={jobIdToUse}
|
||||
/>
|
||||
{isIdSelectorFlyoutVisible ? (
|
||||
<AnalyticsIdSelector
|
||||
setAnalyticsId={setAnalyticsId}
|
||||
<JobInfoFlyoutsProvider>
|
||||
<AnalyticsDetailFlyout />
|
||||
<AnalyticsIdSelectorControls
|
||||
setIsIdSelectorFlyoutVisible={setIsIdSelectorFlyoutVisible}
|
||||
selectedId={jobIdToUse}
|
||||
/>
|
||||
) : null}
|
||||
{jobIdToUse !== undefined && (
|
||||
<MlPageHeader>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analyticsExploration.titleWithId"
|
||||
defaultMessage="Explore results for job ID {id}"
|
||||
values={{ id: jobIdToUse }}
|
||||
{isIdSelectorFlyoutVisible ? (
|
||||
<AnalyticsIdSelector
|
||||
setAnalyticsId={setAnalyticsId}
|
||||
setIsIdSelectorFlyoutVisible={setIsIdSelectorFlyoutVisible}
|
||||
/>
|
||||
</MlPageHeader>
|
||||
)}
|
||||
{jobIdToUse === undefined && (
|
||||
<MlPageHeader>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analyticsExploration.title"
|
||||
defaultMessage="Explore results"
|
||||
/>
|
||||
</MlPageHeader>
|
||||
)}
|
||||
) : null}
|
||||
{jobIdToUse !== undefined && (
|
||||
<MlPageHeader>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analyticsExploration.titleWithId"
|
||||
defaultMessage="Explore results for job ID {id}"
|
||||
values={{ id: jobIdToUse }}
|
||||
/>
|
||||
</MlPageHeader>
|
||||
)}
|
||||
{jobIdToUse === undefined && (
|
||||
<MlPageHeader>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analyticsExploration.title"
|
||||
defaultMessage="Explore results"
|
||||
/>
|
||||
</MlPageHeader>
|
||||
)}
|
||||
|
||||
<SavedObjectsWarning onCloseFlyout={refresh} />
|
||||
<SavedObjectsWarning onCloseFlyout={refresh} />
|
||||
|
||||
{jobIdToUse && analysisTypeToUse ? (
|
||||
<div data-test-subj="mlPageDataFrameAnalyticsExploration">
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && (
|
||||
<OutlierExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.REGRESSION && (
|
||||
<RegressionExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.CLASSIFICATION && (
|
||||
<ClassificationExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
getEmptyState()
|
||||
)}
|
||||
<HelpMenu docLink={helpLink} />
|
||||
{jobIdToUse && analysisTypeToUse ? (
|
||||
<div data-test-subj="mlPageDataFrameAnalyticsExploration">
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.OUTLIER_DETECTION && (
|
||||
<OutlierExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.REGRESSION && (
|
||||
<RegressionExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
{analysisTypeToUse === ANALYSIS_CONFIG_TYPE.CLASSIFICATION && (
|
||||
<ClassificationExploration jobId={jobIdToUse} />
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
getEmptyState()
|
||||
)}
|
||||
<HelpMenu docLink={helpLink} />
|
||||
</JobInfoFlyoutsProvider>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ export const isGetDataFrameAnalyticsStatsResponseOk = (
|
|||
);
|
||||
};
|
||||
|
||||
export type GetAnalytics = (forceRefresh?: boolean) => void;
|
||||
export type GetAnalytics = (forceRefresh?: boolean, nullableAnalyticsId?: string | null) => void;
|
||||
|
||||
/**
|
||||
* Gets initial object for analytics stats.
|
||||
|
@ -124,7 +124,7 @@ export const useGetAnalytics = (
|
|||
|
||||
let concurrentLoads = 0;
|
||||
|
||||
const getAnalytics = async (forceRefresh = false) => {
|
||||
const getAnalytics = async (forceRefresh = false, nullableAnalyticsId?: string | null) => {
|
||||
if (forceRefresh === true || blockRefresh === false) {
|
||||
refreshAnalyticsList$.next(REFRESH_ANALYTICS_LIST_STATE.LOADING);
|
||||
concurrentLoads++;
|
||||
|
@ -133,9 +133,13 @@ export const useGetAnalytics = (
|
|||
return;
|
||||
}
|
||||
|
||||
const analyticsId = nullableAnalyticsId ?? undefined;
|
||||
|
||||
try {
|
||||
const analyticsConfigs = await mlApi.dataFrameAnalytics.getDataFrameAnalytics();
|
||||
const analyticsStats = await mlApi.dataFrameAnalytics.getDataFrameAnalyticsStats();
|
||||
const analyticsConfigs = await mlApi.dataFrameAnalytics.getDataFrameAnalytics(analyticsId);
|
||||
const analyticsStats = await mlApi.dataFrameAnalytics.getDataFrameAnalyticsStats(
|
||||
analyticsId
|
||||
);
|
||||
|
||||
let savedObjectsSpaces: Record<string, string[]> = {};
|
||||
if (canManageSpacesAndSavedObjects && mlApi.savedObjects.jobsSpaces) {
|
||||
|
|
|
@ -6,61 +6,127 @@
|
|||
*/
|
||||
|
||||
import type { FC } from 'react';
|
||||
import React from 'react';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import type { EuiContextMenuPanelDescriptor } from '@elastic/eui';
|
||||
import {
|
||||
EuiBadge,
|
||||
EuiButton,
|
||||
EuiButtonEmpty,
|
||||
EuiContextMenu,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiHorizontalRule,
|
||||
EuiPopover,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
FlyoutType,
|
||||
useJobInfoFlyouts,
|
||||
} from '../../../../jobs/components/job_details_flyout/job_details_flyout_context';
|
||||
interface Props {
|
||||
setIsIdSelectorFlyoutVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
selectedId?: string;
|
||||
}
|
||||
|
||||
interface SelectorControlProps {
|
||||
analyticsId: string;
|
||||
'data-test-subj': string;
|
||||
}
|
||||
|
||||
const SelectorControl = ({ analyticsId, 'data-test-subj': dataTestSubj }: SelectorControlProps) => {
|
||||
const { setActiveJobId, setActiveFlyout } = useJobInfoFlyouts();
|
||||
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
||||
const closePopover = useCallback(() => {
|
||||
setIsPopoverOpen(false);
|
||||
}, []);
|
||||
|
||||
const panels = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
id: 0,
|
||||
items: [
|
||||
{
|
||||
name: i18n.translate('xpack.ml.overview.dataFrameAnalytics.jobContextMenu.details', {
|
||||
defaultMessage: 'Job details',
|
||||
}),
|
||||
icon: 'eye',
|
||||
onClick: () => {
|
||||
setActiveJobId(analyticsId);
|
||||
setActiveFlyout(FlyoutType.DATA_FRAME_ANALYTICS_DETAILS);
|
||||
closePopover();
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
] as EuiContextMenuPanelDescriptor[];
|
||||
}, [analyticsId, closePopover, setActiveFlyout, setActiveJobId]);
|
||||
|
||||
const button = (
|
||||
<EuiButton
|
||||
data-test-subj={dataTestSubj}
|
||||
iconType="boxesVertical"
|
||||
iconSide="right"
|
||||
onClick={setIsPopoverOpen.bind(null, true)}
|
||||
size="s"
|
||||
color="text"
|
||||
>
|
||||
{analyticsId}
|
||||
</EuiButton>
|
||||
);
|
||||
return (
|
||||
<EuiPopover
|
||||
id={`mlAnalyticsDetailsPopover ${analyticsId}`}
|
||||
button={button}
|
||||
isOpen={isPopoverOpen}
|
||||
closePopover={closePopover}
|
||||
panelPaddingSize="none"
|
||||
anchorPosition="downLeft"
|
||||
>
|
||||
<EuiContextMenu initialPanelId={0} panels={panels} />
|
||||
</EuiPopover>
|
||||
);
|
||||
};
|
||||
|
||||
export const AnalyticsIdSelectorControls: FC<Props> = ({
|
||||
setIsIdSelectorFlyoutVisible,
|
||||
selectedId,
|
||||
}) => (
|
||||
<>
|
||||
<EuiFlexGroup gutterSize="xs" alignItems="center">
|
||||
<EuiFlexItem grow={false}>
|
||||
{selectedId ? (
|
||||
<EuiBadge
|
||||
key={`${selectedId}-id`}
|
||||
data-test-subj={`mlAnalyticsIdSelectionBadge ${selectedId}`}
|
||||
color="hollow"
|
||||
>
|
||||
{selectedId}
|
||||
</EuiBadge>
|
||||
) : null}
|
||||
{!selectedId ? (
|
||||
<EuiText size={'xs'}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analytics.noIdsSelectedLabel"
|
||||
defaultMessage="No Analytics ID selected"
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
<EuiFlexGroup gutterSize="xs" alignItems="center">
|
||||
<EuiFlexItem grow={false}>
|
||||
{selectedId ? (
|
||||
<SelectorControl
|
||||
key={`${selectedId}-id`}
|
||||
data-test-subj={`mlAnalyticsIdSelectionBadge ${selectedId}`}
|
||||
analyticsId={selectedId}
|
||||
/>
|
||||
</EuiText>
|
||||
) : null}
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButtonEmpty
|
||||
size="xs"
|
||||
iconType="pencil"
|
||||
onClick={setIsIdSelectorFlyoutVisible.bind(null, true)}
|
||||
data-test-subj="mlButtonEditAnalyticsIdSelection"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analytics.editSelection"
|
||||
defaultMessage="Edit selection"
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<EuiHorizontalRule />
|
||||
</>
|
||||
);
|
||||
) : null}
|
||||
{!selectedId ? (
|
||||
<EuiText size={'xs'}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analytics.noIdsSelectedLabel"
|
||||
defaultMessage="No Analytics ID selected"
|
||||
/>
|
||||
</EuiText>
|
||||
) : null}
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButtonEmpty
|
||||
size="xs"
|
||||
iconType="pencil"
|
||||
onClick={setIsIdSelectorFlyoutVisible.bind(null, true)}
|
||||
data-test-subj="mlButtonEditAnalyticsIdSelection"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.dataframe.analytics.editSelection"
|
||||
defaultMessage="Edit selection"
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<EuiHorizontalRule />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ export const Page: FC = () => {
|
|||
const [isLoadingJobsExist, setIsLoadingJobsExist] = useState(false);
|
||||
const { refresh } = useRefreshAnalyticsList({ isLoading: setIsLoading });
|
||||
|
||||
const setAnalyticsId = useCallback(
|
||||
const onAnalyticsIdChange = useCallback(
|
||||
(analyticsId: AnalyticsSelectorIds) => {
|
||||
setGlobalState({
|
||||
ml: {
|
||||
|
@ -108,7 +108,7 @@ export const Page: FC = () => {
|
|||
/>
|
||||
{isIdSelectorFlyoutVisible ? (
|
||||
<AnalyticsIdSelector
|
||||
setAnalyticsId={setAnalyticsId}
|
||||
setAnalyticsId={onAnalyticsIdChange}
|
||||
setIsIdSelectorFlyoutVisible={setIsIdSelectorFlyoutVisible}
|
||||
/>
|
||||
) : null}
|
||||
|
|
|
@ -427,6 +427,7 @@ export const Explorer: FC<ExplorerUIProps> = ({
|
|||
onSelectionChange: handleJobSelectionChange,
|
||||
selectedJobIds,
|
||||
selectedGroups,
|
||||
selectedJobs,
|
||||
} as unknown as JobSelectorProps;
|
||||
|
||||
const noJobsSelected = !selectedJobs || selectedJobs.length === 0;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export { JobDetailsFlyout } from './job_details_flyout';
|
||||
export { JobInfoFlyoutsProvider, useJobInfoFlyouts } from './job_details_flyout_context';
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { useContext, useMemo } from 'react';
|
||||
import { useUrlState } from '@kbn/ml-url-state';
|
||||
import moment from 'moment';
|
||||
import { JobDetailsFlyout } from './job_details_flyout';
|
||||
import { DatafeedChartFlyout } from '../../jobs_list/components/datafeed_chart_flyout';
|
||||
import { JobInfoFlyoutsContext } from './job_details_flyout_context';
|
||||
|
||||
export const JobInfoFlyoutsManager = () => {
|
||||
const { isDatafeedChartFlyoutOpen, activeJobId, closeActiveFlyout } =
|
||||
useContext(JobInfoFlyoutsContext);
|
||||
const [globalState] = useUrlState('_g');
|
||||
const end = useMemo(
|
||||
() => moment(globalState?.time?.to).unix() * 1000 ?? 0,
|
||||
[globalState?.time?.to]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<JobDetailsFlyout />
|
||||
{isDatafeedChartFlyoutOpen && activeJobId ? (
|
||||
<DatafeedChartFlyout onClose={closeActiveFlyout} jobId={activeJobId} end={end} />
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
EuiFlyout,
|
||||
EuiFlyoutHeader,
|
||||
EuiFlyoutBody,
|
||||
EuiText,
|
||||
EuiTitle,
|
||||
EuiFlexItem,
|
||||
EuiButtonEmpty,
|
||||
EuiFlexGroup,
|
||||
useGeneratedHtmlId,
|
||||
EuiLoadingSpinner,
|
||||
} from '@elastic/eui';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import useMountedState from 'react-use/lib/useMountedState';
|
||||
import type { CombinedJobWithStats } from '../../../../../common/types/anomaly_detection_jobs';
|
||||
import { useMlApi, useMlLocator, useNavigateToPath } from '../../../contexts/kibana';
|
||||
import { JobDetails } from '../../jobs_list/components/job_details';
|
||||
import { loadFullJob } from '../../jobs_list/components/utils';
|
||||
import { useToastNotificationService } from '../../../services/toast_notification_service';
|
||||
import { ML_PAGES } from '../../../../../common/constants/locator';
|
||||
import { useJobInfoFlyouts } from './job_details_flyout_context';
|
||||
|
||||
const doNothing = () => {};
|
||||
export const JobDetailsFlyout = () => {
|
||||
const {
|
||||
isDetailFlyoutOpen,
|
||||
activeJobId: jobId,
|
||||
setActiveJobId,
|
||||
closeActiveFlyout,
|
||||
} = useJobInfoFlyouts();
|
||||
const flyoutTitleId = useGeneratedHtmlId({
|
||||
prefix: 'jobDetailsFlyout',
|
||||
});
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [jobDetails, setJobDetails] = useState<CombinedJobWithStats | null>(null);
|
||||
const mlApi = useMlApi();
|
||||
const { displayErrorToast } = useToastNotificationService();
|
||||
|
||||
const isMounted = useMountedState();
|
||||
useEffect(() => {
|
||||
const fetchJobDetails = async () => {
|
||||
if (!isMounted()) return;
|
||||
if (jobId) {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const job = await loadFullJob(mlApi, jobId);
|
||||
if (job) {
|
||||
setJobDetails(job);
|
||||
}
|
||||
} catch (error) {
|
||||
displayErrorToast(
|
||||
error,
|
||||
i18n.translate('xpack.ml.jobDetailsFlyout.errorFetchingJobDetails', {
|
||||
defaultMessage: 'Error fetching job details',
|
||||
})
|
||||
);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
fetchJobDetails();
|
||||
}, [jobId, mlApi, displayErrorToast, isMounted]);
|
||||
|
||||
const navigateToPath = useNavigateToPath();
|
||||
const mlLocator = useMlLocator();
|
||||
|
||||
if (!jobId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const openJobsList = async () => {
|
||||
const pageState = { jobId };
|
||||
if (mlLocator) {
|
||||
const url = await mlLocator.getUrl({
|
||||
page: ML_PAGES.ANOMALY_DETECTION_JOBS_MANAGE,
|
||||
pageState,
|
||||
});
|
||||
await navigateToPath(url);
|
||||
}
|
||||
};
|
||||
|
||||
return isDetailFlyoutOpen ? (
|
||||
<EuiFlyout
|
||||
data-test-subj="jobDetailsFlyout"
|
||||
type="overlay"
|
||||
size="m"
|
||||
ownFocus={false}
|
||||
onClose={() => {
|
||||
closeActiveFlyout();
|
||||
setActiveJobId(null);
|
||||
}}
|
||||
aria-labelledby={flyoutTitleId}
|
||||
>
|
||||
<EuiFlyoutHeader hasBorder data-test-subj={`jobDetailsFlyout-${jobId}`}>
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem grow={true}>
|
||||
<EuiTitle size="s">
|
||||
<h2 id={flyoutTitleId}>{jobId}</h2>
|
||||
</EuiTitle>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButtonEmpty onClick={openJobsList}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobDetailsFlyout.openJobsListButton"
|
||||
defaultMessage="Open jobs list"
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiFlyoutHeader>
|
||||
<EuiFlyoutBody>
|
||||
{isLoading ? (
|
||||
<EuiText textAlign="center">
|
||||
<EuiLoadingSpinner size="m" />
|
||||
</EuiText>
|
||||
) : (
|
||||
<EuiText>
|
||||
{jobDetails ? (
|
||||
<JobDetails
|
||||
mode="flyout"
|
||||
jobId={jobId}
|
||||
job={jobDetails}
|
||||
// No need to add or remove from the job list
|
||||
addYourself={doNothing}
|
||||
removeYourself={doNothing}
|
||||
refreshJobList={doNothing}
|
||||
showClearButton={false}
|
||||
/>
|
||||
) : null}
|
||||
</EuiText>
|
||||
)}
|
||||
</EuiFlyoutBody>
|
||||
</EuiFlyout>
|
||||
) : null;
|
||||
};
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import React, { createContext, useContext, useMemo, useState, useCallback } from 'react';
|
||||
|
||||
export enum FlyoutType {
|
||||
JOB_DETAILS = 'jobDetails',
|
||||
DATAFEED_CHART = 'datafeedChart',
|
||||
DATA_FRAME_ANALYTICS_DETAILS = 'dataFrameAnalyticsDetails',
|
||||
}
|
||||
interface JobInfoFlyoutsContextValue {
|
||||
activeJobId: string | null;
|
||||
setActiveJobId: (jobId: string | null) => void;
|
||||
activeFlyout: FlyoutType | null;
|
||||
setActiveFlyout: (flyout: FlyoutType | null) => void;
|
||||
isDetailFlyoutOpen: boolean;
|
||||
isDatafeedChartFlyoutOpen: boolean;
|
||||
closeActiveFlyout: () => void;
|
||||
isDataFrameAnalyticsDetailsFlyoutOpen: boolean;
|
||||
}
|
||||
|
||||
export const JobInfoFlyoutsContext = createContext<JobInfoFlyoutsContextValue>({
|
||||
activeJobId: null,
|
||||
setActiveJobId: () => {},
|
||||
activeFlyout: null,
|
||||
setActiveFlyout: () => {},
|
||||
isDetailFlyoutOpen: false,
|
||||
isDatafeedChartFlyoutOpen: false,
|
||||
closeActiveFlyout: () => {},
|
||||
isDataFrameAnalyticsDetailsFlyoutOpen: false,
|
||||
});
|
||||
|
||||
export const useJobInfoFlyouts = () => useContext(JobInfoFlyoutsContext);
|
||||
|
||||
export const JobInfoFlyoutsProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const [activeJobId, setActiveJobId] = useState<string | null>(null);
|
||||
const [activeFlyout, setActiveFlyout] = useState<FlyoutType | null>(null);
|
||||
const isDetailFlyoutOpen = useMemo(() => activeFlyout === FlyoutType.JOB_DETAILS, [activeFlyout]);
|
||||
const isDatafeedChartFlyoutOpen = useMemo(
|
||||
() => activeFlyout === FlyoutType.DATAFEED_CHART,
|
||||
[activeFlyout]
|
||||
);
|
||||
const isDataFrameAnalyticsDetailsFlyoutOpen = useMemo(
|
||||
() => activeFlyout === FlyoutType.DATA_FRAME_ANALYTICS_DETAILS,
|
||||
[activeFlyout]
|
||||
);
|
||||
const closeActiveFlyout = useCallback(() => {
|
||||
setActiveJobId(null);
|
||||
setActiveFlyout(null);
|
||||
}, [setActiveJobId, setActiveFlyout]);
|
||||
|
||||
return (
|
||||
<JobInfoFlyoutsContext.Provider
|
||||
value={{
|
||||
activeJobId,
|
||||
setActiveJobId,
|
||||
isDetailFlyoutOpen,
|
||||
isDatafeedChartFlyoutOpen,
|
||||
isDataFrameAnalyticsDetailsFlyoutOpen,
|
||||
setActiveFlyout,
|
||||
activeFlyout,
|
||||
closeActiveFlyout,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</JobInfoFlyoutsContext.Provider>
|
||||
);
|
||||
};
|
|
@ -52,6 +52,7 @@ import {
|
|||
Tooltip,
|
||||
TooltipType,
|
||||
} from '@elastic/charts';
|
||||
import { isPopulatedObject } from '@kbn/ml-is-populated-object';
|
||||
import { DATAFEED_STATE } from '../../../../../../common/constants/states';
|
||||
import type {
|
||||
CombinedJobWithStats,
|
||||
|
@ -87,7 +88,7 @@ interface DatafeedChartFlyoutProps {
|
|||
jobId: string;
|
||||
end: number;
|
||||
onClose: () => void;
|
||||
onModelSnapshotAnnotationClick: (modelSnapshot: ModelSnapshot) => void;
|
||||
onModelSnapshotAnnotationClick?: (modelSnapshot: ModelSnapshot) => void;
|
||||
}
|
||||
|
||||
function setLineAnnotationHeader(
|
||||
|
@ -356,21 +357,23 @@ export const DatafeedChartFlyout: FC<DatafeedChartFlyoutProps> = ({
|
|||
onChange={() => setShowAnnotations(!showAnnotations)}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiCheckbox
|
||||
id={checkboxIdModelSnapshot}
|
||||
label={
|
||||
<EuiText size={'xs'}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobsList.datafeedChart.showModelSnapshotsCheckboxLabel"
|
||||
defaultMessage="Show model snapshots"
|
||||
/>
|
||||
</EuiText>
|
||||
}
|
||||
checked={showModelSnapshots}
|
||||
onChange={() => setShowModelSnapshots(!showModelSnapshots)}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
{onModelSnapshotAnnotationClick ? (
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiCheckbox
|
||||
id={checkboxIdModelSnapshot}
|
||||
label={
|
||||
<EuiText size={'xs'}>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobsList.datafeedChart.showModelSnapshotsCheckboxLabel"
|
||||
defaultMessage="Show model snapshots"
|
||||
/>
|
||||
</EuiText>
|
||||
}
|
||||
checked={showModelSnapshots}
|
||||
onChange={() => setShowModelSnapshots(!showModelSnapshots)}
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
) : null}
|
||||
</EuiFlexGroup>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
|
@ -421,10 +424,17 @@ export const DatafeedChartFlyout: FC<DatafeedChartFlyoutProps> = ({
|
|||
)
|
||||
return;
|
||||
|
||||
onModelSnapshotAnnotationClick(
|
||||
// @ts-expect-error property 'modelSnapshot' does not exist on type
|
||||
annotations.lines[0].datum.modelSnapshot
|
||||
);
|
||||
if (
|
||||
onModelSnapshotAnnotationClick &&
|
||||
isPopulatedObject<string, ModelSnapshot>(
|
||||
annotations.lines?.[0]?.datum,
|
||||
['modelSnapshot']
|
||||
)
|
||||
) {
|
||||
onModelSnapshotAnnotationClick(
|
||||
annotations.lines[0].datum.modelSnapshot
|
||||
);
|
||||
}
|
||||
}}
|
||||
theme={{
|
||||
lineSeriesStyle: {
|
||||
|
|
|
@ -52,7 +52,9 @@ export const DatafeedPreviewPane: FC<Props> = ({ job }) => {
|
|||
}
|
||||
|
||||
return loading ? (
|
||||
<EuiLoadingSpinner size="xl" />
|
||||
<div className="job-loading-spinner" data-test-subj="mlJobDetails loading">
|
||||
<EuiLoadingSpinner size="l" />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{previewJson === null ? (
|
||||
|
|
|
@ -177,19 +177,23 @@ export class JobDetailsUI extends Component {
|
|||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'counts',
|
||||
'data-test-subj': 'mlJobListTab-counts',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.countsLabel', {
|
||||
defaultMessage: 'Counts',
|
||||
}),
|
||||
content: (
|
||||
<JobDetailsPane
|
||||
data-test-subj="mlJobDetails-counts"
|
||||
sections={[counts, modelSizeStats, jobTimingStats]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
...(this.props.mode !== 'flyout'
|
||||
? [
|
||||
{
|
||||
id: 'counts',
|
||||
'data-test-subj': 'mlJobListTab-counts',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.countsLabel', {
|
||||
defaultMessage: 'Counts',
|
||||
}),
|
||||
content: (
|
||||
<JobDetailsPane
|
||||
data-test-subj="mlJobDetails-counts"
|
||||
sections={[counts, modelSizeStats, jobTimingStats]}
|
||||
/>
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: 'json',
|
||||
'data-test-subj': 'mlJobListTab-json',
|
||||
|
@ -214,58 +218,59 @@ export class JobDetailsUI extends Component {
|
|||
},
|
||||
];
|
||||
|
||||
if (datafeed.items.length) {
|
||||
tabs.push(
|
||||
{
|
||||
id: 'datafeed-preview',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-datafeed-preview',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.datafeedPreviewLabel', {
|
||||
defaultMessage: 'Datafeed preview',
|
||||
}),
|
||||
content: <DatafeedPreviewPane job={job} />,
|
||||
},
|
||||
{
|
||||
id: 'forecasts',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-forecasts',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.forecastsLabel', {
|
||||
defaultMessage: 'Forecasts',
|
||||
}),
|
||||
content: <ForecastsTable job={job} />,
|
||||
}
|
||||
);
|
||||
if (this.props.mode !== 'flyout') {
|
||||
if (datafeed.items.length) {
|
||||
tabs.push(
|
||||
{
|
||||
id: 'datafeed-preview',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-datafeed-preview',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.datafeedPreviewLabel', {
|
||||
defaultMessage: 'Datafeed preview',
|
||||
}),
|
||||
content: <DatafeedPreviewPane job={job} />,
|
||||
},
|
||||
{
|
||||
id: 'forecasts',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-forecasts',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.forecastsLabel', {
|
||||
defaultMessage: 'Forecasts',
|
||||
}),
|
||||
content: <ForecastsTable job={job} />,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
tabs.push({
|
||||
id: 'annotations',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-annotations',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.annotationsLabel', {
|
||||
defaultMessage: 'Annotations',
|
||||
}),
|
||||
content: (
|
||||
<Fragment>
|
||||
<AnnotationsTable jobs={[job]} refreshJobList={refreshJobList} />
|
||||
<AnnotationFlyout />
|
||||
</Fragment>
|
||||
),
|
||||
});
|
||||
|
||||
tabs.push({
|
||||
id: 'modelSnapshots',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-modelSnapshots',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.modelSnapshotsLabel', {
|
||||
defaultMessage: 'Model snapshots',
|
||||
}),
|
||||
content: (
|
||||
<Fragment>
|
||||
<ModelSnapshotTable job={job} refreshJobList={refreshJobList} />
|
||||
</Fragment>
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
tabs.push({
|
||||
id: 'annotations',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-annotations',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.annotationsLabel', {
|
||||
defaultMessage: 'Annotations',
|
||||
}),
|
||||
content: (
|
||||
<Fragment>
|
||||
<AnnotationsTable jobs={[job]} refreshJobList={refreshJobList} />
|
||||
<AnnotationFlyout />
|
||||
</Fragment>
|
||||
),
|
||||
});
|
||||
|
||||
tabs.push({
|
||||
id: 'modelSnapshots',
|
||||
disabled: job.blocked !== undefined,
|
||||
'data-test-subj': 'mlJobListTab-modelSnapshots',
|
||||
name: i18n.translate('xpack.ml.jobsList.jobDetails.tabs.modelSnapshotsLabel', {
|
||||
defaultMessage: 'Model snapshots',
|
||||
}),
|
||||
content: (
|
||||
<Fragment>
|
||||
<ModelSnapshotTable job={job} refreshJobList={refreshJobList} />
|
||||
</Fragment>
|
||||
),
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="tab-contents" data-test-subj={`mlJobListRowDetails details-${job.job_id}`}>
|
||||
<EuiTabbedContent tabs={tabs} initialSelectedTab={tabs[0]} onTabClick={() => {}} />
|
||||
|
|
|
@ -136,7 +136,6 @@ export const JobMemoryTreeMap: FC<Props> = ({ node, type, height }) => {
|
|||
},
|
||||
[loadJobMemorySize, refresh]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{ height: chartHeight }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue