-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Logs UI] Add "View in machine learning" links in the anomaly explorer #74555
Changes from 8 commits
80859ff
9e339c5
245bc8b
73962ef
007e8c0
2d8c52b
ec9f024
d6a9a72
85e2989
99ce32a
ef0a007
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,26 +4,41 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { EuiCard, EuiIcon } from '@elastic/eui'; | ||
import { EuiCard, EuiIcon, EuiButtonEmpty } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import { SetupStatus } from '../../../../../common/log_analysis'; | ||
import { CreateJobButton, RecreateJobButton } from '../../log_analysis_setup/create_job_button'; | ||
import { useLinkProps } from '../../../../hooks/use_link_props'; | ||
|
||
export const LogAnalysisModuleListCard: React.FC<{ | ||
jobId: string; | ||
hasSetupCapabilities: boolean; | ||
moduleDescription: string; | ||
moduleName: string; | ||
moduleStatus: SetupStatus; | ||
onViewSetup: () => void; | ||
}> = ({ hasSetupCapabilities, moduleDescription, moduleName, moduleStatus, onViewSetup }) => { | ||
}> = ({ | ||
jobId, | ||
hasSetupCapabilities, | ||
moduleDescription, | ||
moduleName, | ||
moduleStatus, | ||
onViewSetup, | ||
}) => { | ||
const moduleIcon = | ||
moduleStatus.type === 'required' ? ( | ||
<EuiIcon size="xxl" type="machineLearningApp" /> | ||
) : ( | ||
<EuiIcon color="secondary" size="xxl" type="check" /> | ||
); | ||
|
||
const viewInMlLinkProps = useLinkProps({ | ||
app: 'ml', | ||
hash: '/jobs', | ||
search: { mlManagement: `(jobId:${jobId})` }, | ||
}); | ||
|
||
const moduleSetupButton = | ||
moduleStatus.type === 'required' ? ( | ||
<CreateJobButton hasSetupCapabilities={hasSetupCapabilities} onClick={onViewSetup}> | ||
|
@@ -33,7 +48,15 @@ export const LogAnalysisModuleListCard: React.FC<{ | |
/> | ||
</CreateJobButton> | ||
) : ( | ||
<RecreateJobButton hasSetupCapabilities={hasSetupCapabilities} onClick={onViewSetup} /> | ||
<> | ||
<RecreateJobButton hasSetupCapabilities={hasSetupCapabilities} onClick={onViewSetup} /> | ||
<EuiButtonEmpty {...viewInMlLinkProps}> | ||
<FormattedMessage | ||
id="xpack.infra.logs.analysis.viewInMlButtonLabel" | ||
defaultMessage="View in Machine Learning" | ||
/> | ||
</EuiButtonEmpty> | ||
</> | ||
Comment on lines
+54
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The vertical rhythm is a bit weird. Do we want to insert a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can add it. I could not find the documentation that you mentioned though :/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was referring to the double-row example code on the <EuiCard
icon={<EuiIcon size="xxl" type="savedObjectsApp" />}
title="Save Objects"
description="Example of a short card description."
footer={
<div>
<EuiButton aria-label="Go to Save Objects">Go for it</EuiButton>
<EuiSpacer size="xs" />
<EuiText size="s">
<p>
Or try <EuiLink href="http://google.com">this</EuiLink>
</p>
</EuiText>
</div>
}
/> |
||
); | ||
|
||
return ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use
pathname
instead ofhash
because this seems to be rewritten to/apps/ml/jobs
immediately?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try 👍