forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] Provide single-value functions to show the "First" or "Last" v…
…alue of some field (elastic#83437)
- Loading branch information
Showing
32 changed files
with
1,256 additions
and
127 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...ugins/lens/public/editor_frame_service/editor_frame/workspace_panel/warnings_popover.scss
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,17 @@ | ||
.lnsWorkspaceWarning__button { | ||
color: $euiColorWarningText; | ||
} | ||
|
||
.lnsWorkspaceWarningList { | ||
@include euiYScroll; | ||
max-height: $euiSize * 20; | ||
width: $euiSize * 16; | ||
} | ||
|
||
.lnsWorkspaceWarningList__item { | ||
padding: $euiSize; | ||
|
||
& + & { | ||
border-top: $euiBorderThin; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...lugins/lens/public/editor_frame_service/editor_frame/workspace_panel/warnings_popover.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,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import './workspace_panel_wrapper.scss'; | ||
import './warnings_popover.scss'; | ||
|
||
import React, { useState } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiPopover, EuiText, EuiButtonEmpty } from '@elastic/eui'; | ||
|
||
export const WarningsPopover = ({ | ||
children, | ||
}: { | ||
children?: React.ReactNode | React.ReactNode[]; | ||
}) => { | ||
const [isPopoverOpen, setIsPopoverOpen] = useState(false); | ||
|
||
if (!children) { | ||
return null; | ||
} | ||
|
||
const onButtonClick = () => setIsPopoverOpen((isOpen) => !isOpen); | ||
const closePopover = () => setIsPopoverOpen(false); | ||
const warningsCount = React.Children.count(children); | ||
return ( | ||
<EuiPopover | ||
panelPaddingSize="none" | ||
button={ | ||
<EuiButtonEmpty | ||
onClick={onButtonClick} | ||
iconType="alert" | ||
className="lnsWorkspaceWarning__button" | ||
> | ||
{i18n.translate('xpack.lens.chartWarnings.number', { | ||
defaultMessage: `{warningsCount} {warningsCount, plural, one {warning} other {warnings}}`, | ||
values: { | ||
warningsCount, | ||
}, | ||
})} | ||
</EuiButtonEmpty> | ||
} | ||
isOpen={isPopoverOpen} | ||
closePopover={closePopover} | ||
> | ||
<ul className="lnsWorkspaceWarningList"> | ||
{React.Children.map(children, (child, index) => ( | ||
<li key={index} className="lnsWorkspaceWarningList__item"> | ||
<EuiText size="s">{child}</EuiText> | ||
</li> | ||
))} | ||
</ul> | ||
</EuiPopover> | ||
); | ||
}; |
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
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
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
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.