-
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
[ML] Update the Overview page #159609
Merged
Merged
[ML] Update the Overview page #159609
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
5cfa6a8
collapsible_panel.tsx, store state in the local storage
darnautov b29f998
group actions
darnautov aac5aac
analytics_panel
darnautov f0f3572
hide keys when total is 0
darnautov 869774d
DFA empty prompt
darnautov e95c488
AD empty prompt
darnautov 150d8a5
dfa panel title, fix i18n
darnautov bacdda5
Nodes panel
darnautov 5241992
panel border
darnautov 0380da1
refactor
darnautov 8851411
update jest tests
darnautov 9ca5a6e
mlTotalNodesCount test
darnautov 3e95834
Update x-pack/plugins/ml/public/application/data_frame_analytics/page…
darnautov 0efb240
Update x-pack/plugins/ml/public/application/data_frame_analytics/page…
darnautov 49ec04c
Update x-pack/plugins/ml/public/application/jobs/jobs_list/components…
darnautov 0852e67
Update x-pack/plugins/ml/public/application/jobs/jobs_list/components…
darnautov b644503
Update x-pack/plugins/ml/public/application/data_frame_analytics/page…
darnautov 4d2ded2
refactor, remove ts-ignore
darnautov 5049b99
Merge remote-tracking branch 'origin/ml-154294-overview-page' into ml…
darnautov f846d55
css panel border
darnautov 06ef28a
Merge remote-tracking branch 'origin/main' into ml-154294-overview-page
darnautov 1d15f22
enable accessibility tests
darnautov ab49032
Revert "enable accessibility tests"
darnautov 6486ff9
Merge branch 'main' into ml-154294-overview-page
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
x-pack/plugins/ml/public/application/components/collapsible_panel/collapsible_panel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/* | ||
* 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 { | ||
EuiBadge, | ||
EuiButtonIcon, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiSplitPanel, | ||
EuiText, | ||
EuiTitle, | ||
} from '@elastic/eui'; | ||
import React, { type FC } from 'react'; | ||
import { css } from '@emotion/react/dist/emotion-react.cjs'; | ||
import { useCurrentThemeVars } from '../../contexts/kibana'; | ||
|
||
export interface CollapsiblePanelProps { | ||
isOpen: boolean; | ||
onToggle: (isOpen: boolean) => void; | ||
|
||
header: React.ReactElement; | ||
headerItems?: React.ReactElement[]; | ||
} | ||
|
||
export const CollapsiblePanel: FC<CollapsiblePanelProps> = ({ | ||
isOpen, | ||
onToggle, | ||
children, | ||
header, | ||
headerItems, | ||
}) => { | ||
const { euiTheme } = useCurrentThemeVars(); | ||
|
||
return ( | ||
<EuiSplitPanel.Outer grow hasShadow={false} hasBorder={isOpen}> | ||
<EuiSplitPanel.Inner color={isOpen ? 'plain' : 'subdued'}> | ||
<EuiFlexGroup justifyContent={'spaceBetween'} alignItems={'center'}> | ||
<EuiFlexItem grow={false}> | ||
<EuiFlexGroup gutterSize={'s'}> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonIcon | ||
color={'text'} | ||
iconType={isOpen ? 'arrowDown' : 'arrowRight'} | ||
onClick={() => { | ||
onToggle(!isOpen); | ||
}} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiTitle size="xxs"> | ||
<h2>{header}</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
{headerItems ? ( | ||
<EuiFlexItem grow={false}> | ||
<EuiFlexGroup gutterSize={'l'} alignItems={'center'}> | ||
{headerItems.map((item, i) => { | ||
return ( | ||
<EuiFlexItem key={i} grow={false}> | ||
<div | ||
css={ | ||
i < headerItems?.length - 1 | ||
? css` | ||
border-right: ${euiTheme.euiBorderWidthThin} solid | ||
${euiTheme.euiBorderColor}; | ||
padding-right: ${euiTheme.euiPanelPaddingModifiers.paddingLarge}; | ||
` | ||
: null | ||
} | ||
> | ||
{item} | ||
</div> | ||
</EuiFlexItem> | ||
); | ||
})} | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
) : null} | ||
</EuiFlexGroup> | ||
</EuiSplitPanel.Inner> | ||
{isOpen ? ( | ||
<EuiSplitPanel.Inner | ||
css={{ borderTop: `${euiTheme.euiBorderWidthThin} solid ${euiTheme.euiBorderColor}` }} | ||
grow={false} | ||
> | ||
{children} | ||
</EuiSplitPanel.Inner> | ||
) : null} | ||
</EuiSplitPanel.Outer> | ||
); | ||
}; | ||
|
||
export interface OverviewStatsBarProps { | ||
inputStats: Array<{ label: string; value: number }>; | ||
dataTestSub?: string; | ||
} | ||
|
||
export const OverviewStatsBar: FC<OverviewStatsBarProps> = ({ inputStats, dataTestSub }) => { | ||
return ( | ||
<EuiFlexGroup data-test-subj={dataTestSub} alignItems={'center'} gutterSize={'m'}> | ||
{inputStats.map(({ value, label }) => { | ||
return ( | ||
<EuiFlexItem grow={false} key={label}> | ||
<EuiFlexGroup alignItems={'center'} gutterSize={'s'}> | ||
<EuiFlexItem grow={false}> | ||
<EuiText size={'s'}>{label}:</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiBadge>{value}</EuiBadge> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
); | ||
})} | ||
</EuiFlexGroup> | ||
); | ||
}; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/ml/public/application/components/collapsible_panel/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { CollapsiblePanel } from './collapsible_panel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit, if you expand and collapse these sections they resize by 1px because of the lack of border.
Adding a border when they are collapsed looks a bit nicer and is less flickery.
Something like this,
euiColorLightestShade
is the closest shade I could find.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.
Fixed in f846d55
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.
I'm being very nitty now :D
The problem with using
transparent
rather than matching the color of the background means that the panels are all 1px smaller all the way around when collapsed. This is obvious to me when using a low res screen.But normal people might not care.