-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Add sub-menus to Resolver node (for 75% zoom) #63476
Changes from 11 commits
c109f55
14ef3cf
0985e14
b759ea6
6222b00
208ed98
dbc8714
35c2bf5
374296d
4245a82
5abadc9
e2de763
ed4f4fb
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 |
---|---|---|
|
@@ -7,7 +7,13 @@ | |
import React, { useCallback, useMemo } from 'react'; | ||
import styled from 'styled-components'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { htmlIdGenerator, EuiKeyboardAccessible } from '@elastic/eui'; | ||
import { | ||
htmlIdGenerator, | ||
EuiKeyboardAccessible, | ||
EuiButton, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
import { useSelector } from 'react-redux'; | ||
import { applyMatrix3 } from '../lib/vector2'; | ||
import { Vector2, Matrix3, AdjacentProcessMap, ResolverProcessType } from '../types'; | ||
|
@@ -21,40 +27,78 @@ import * as selectors from '../store/selectors'; | |
const nodeAssets = { | ||
runningProcessCube: { | ||
cubeSymbol: `#${SymbolIds.runningProcessCube}`, | ||
labelBackground: NamedColors.fullLabelBackground, | ||
labelBackground: NamedColors.labelBackgroundRunningProcess, | ||
descriptionFill: NamedColors.empty, | ||
descriptionText: i18n.translate('xpack.endpoint.resolver.runningProcess', { | ||
defaultMessage: 'Running Process', | ||
}), | ||
}, | ||
runningTriggerCube: { | ||
cubeSymbol: `#${SymbolIds.runningTriggerCube}`, | ||
labelBackground: NamedColors.fullLabelBackground, | ||
labelBackground: NamedColors.labelBackgroundRunningTrigger, | ||
descriptionFill: NamedColors.empty, | ||
descriptionText: i18n.translate('xpack.endpoint.resolver.runningTrigger', { | ||
defaultMessage: 'Running Trigger', | ||
}), | ||
}, | ||
terminatedProcessCube: { | ||
cubeSymbol: `#${SymbolIds.terminatedProcessCube}`, | ||
labelBackground: NamedColors.fullLabelBackground, | ||
labelBackground: NamedColors.labelBackgroundTerminatedProcess, | ||
descriptionFill: NamedColors.empty, | ||
descriptionText: i18n.translate('xpack.endpoint.resolver.terminatedProcess', { | ||
defaultMessage: 'Terminated Process', | ||
}), | ||
}, | ||
terminatedTriggerCube: { | ||
cubeSymbol: `#${SymbolIds.terminatedTriggerCube}`, | ||
labelBackground: NamedColors.fullLabelBackground, | ||
labelBackground: NamedColors.labelBackgroundTerminatedTrigger, | ||
descriptionFill: NamedColors.empty, | ||
descriptionText: i18n.translate('xpack.endpoint.resolver.terminatedTrigger', { | ||
defaultMessage: 'Terminated Trigger', | ||
}), | ||
}, | ||
}; | ||
|
||
const ChildEventsButton = () => { | ||
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. you can wrap these new components in |
||
return ( | ||
<EuiButton | ||
onClick={(clickEvent: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
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. same thing as below, but could you wrap the function in |
||
clickEvent.preventDefault(); | ||
clickEvent.stopPropagation(); | ||
}} | ||
color="ghost" | ||
size="s" | ||
iconType="arrowDown" | ||
iconSide="right" | ||
tabIndex={-1} | ||
> | ||
{i18n.translate('xpack.endpoint.resolver.relatedEvents', { | ||
defaultMessage: 'Events', | ||
})} | ||
</EuiButton> | ||
); | ||
}; | ||
|
||
const RelatedAlertsButton = () => { | ||
return ( | ||
<EuiButton | ||
onClick={(clickEvent: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
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. can you wrap the functions in useCallback, this way <EuiButton
onClick={useCallback((clickEvent: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
clickEvent.preventDefault();
clickEvent.stopPropagation();
}, [])} |
||
clickEvent.preventDefault(); | ||
clickEvent.stopPropagation(); | ||
}} | ||
color="ghost" | ||
size="s" | ||
tabIndex={-1} | ||
> | ||
{i18n.translate('xpack.endpoint.resolver.relatedAlerts', { | ||
defaultMessage: 'Related Alerts', | ||
})} | ||
</EuiButton> | ||
); | ||
}; | ||
|
||
/** | ||
* A placeholder view for a process node. | ||
* An artefact that represents a process node. | ||
*/ | ||
export const ProcessEventDot = styled( | ||
React.memo( | ||
|
@@ -184,6 +228,7 @@ export const ProcessEventDot = styled( | |
}, | ||
[animationTarget, dispatch, nodeId] | ||
); | ||
|
||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
/** | ||
* Key event handling (e.g. 'Enter'/'Space') is provisioned by the `EuiKeyboardAccessible` component | ||
|
@@ -256,13 +301,17 @@ export const ProcessEventDot = styled( | |
</svg> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexFlow: 'column', | ||
left: '25%', | ||
top: '30%', | ||
position: 'absolute', | ||
width: '50%', | ||
color: 'white', | ||
color: NamedColors.full, | ||
fontSize: `${scaledTypeSize}px`, | ||
lineHeight: '140%', | ||
backgroundColor: NamedColors.resolverBackground, | ||
padding: '.25rem', | ||
}} | ||
> | ||
<div | ||
|
@@ -271,33 +320,50 @@ export const ProcessEventDot = styled( | |
textTransform: 'uppercase', | ||
letterSpacing: '-0.01px', | ||
backgroundColor: NamedColors.resolverBackground, | ||
lineHeight: '1.2', | ||
lineHeight: '1', | ||
fontWeight: 'bold', | ||
fontSize: '.5em', | ||
fontSize: '0.8rem', | ||
width: '100%', | ||
margin: '0 0 .05em 0', | ||
margin: '0', | ||
textAlign: 'left', | ||
padding: '0', | ||
color: NamedColors.empty, | ||
}} | ||
> | ||
{descriptionText} | ||
</div> | ||
<div | ||
className={magFactorX >= 2 ? 'euiButton' : 'euiButton euiButton--small'} | ||
data-test-subject="nodeLabel" | ||
id={labelId} | ||
style={{ | ||
backgroundColor: labelBackground, | ||
padding: '.15em 0', | ||
padding: '.15rem 0', | ||
textAlign: 'center', | ||
maxWidth: '100%', | ||
maxWidth: '20rem', | ||
minWidth: '12rem', | ||
width: '60%', | ||
overflow: 'hidden', | ||
whiteSpace: 'nowrap', | ||
textOverflow: 'ellipsis', | ||
contain: 'content', | ||
margin: '.25rem 0 .35rem 0', | ||
}} | ||
> | ||
{eventModel.eventName(event)} | ||
<span className="euiButton__content"> | ||
<span className="euiButton__text">{eventModel.eventName(event)}</span> | ||
</span> | ||
</div> | ||
{magFactorX >= 2 && ( | ||
bkimmel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<EuiFlexGroup justifyContent="flexStart" gutterSize="xs"> | ||
<EuiFlexItem grow={false}> | ||
<RelatedAlertsButton /> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<ChildEventsButton /> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
)} | ||
</div> | ||
</div> | ||
</EuiKeyboardAccessible> | ||
|
@@ -317,6 +383,8 @@ export const ProcessEventDot = styled( | |
white-space: nowrap; | ||
will-change: left, top, width, height; | ||
contain: strict; | ||
min-width: 280px; | ||
min-height: 90px; | ||
|
||
//dasharray & dashoffset should be equal to "pull" the stroke back | ||
//when it is transitioned. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ async function main() { | |
alertIndex: { | ||
alias: 'ai', | ||
describe: 'index to store alerts in', | ||
default: '.alerts-endpoint-000001', | ||
default: 'events-endpoint-1', | ||
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. @bkimmel I agree that we should probably keep this as @elastic/endpoint-response are you ok with this? |
||
type: 'string', | ||
}, | ||
eventIndex: { | ||
|
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.
Not sure if it's useful but should we add the
data-test-subj
to any of these buttons? @achuguy @IgorGuz2000There 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.
we should add
data-test-subj
attributes in the PR where they are used.