Skip to content
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

[UnifiedDocViewer] Redesign header and make actions responsive #173780

Merged
merged 32 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
53d96e1
[UnifiedDocViewer] Update design of DocViewer header
jughosta Dec 20, 2023
6ff2ea3
[UnifiedDocViewer] Restore styles
jughosta Dec 20, 2023
4e0c420
[UnifiedDocViewer] Clean up
jughosta Dec 20, 2023
465596f
[UnifiedDocViewer] Responsive actions
jughosta Dec 20, 2023
93d3a07
Merge branch 'main' into 164660-doc-viewer-header
jughosta Dec 20, 2023
0082173
[UnifiedDocViewer] Add context menu for remaining actions
jughosta Dec 21, 2023
8bb08d1
[UnifiedDocViewer] Add tests
jughosta Dec 21, 2023
690c38e
[UnifiedDocViewer] Update example plugin
jughosta Dec 21, 2023
d57f705
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 2, 2024
121b810
Merge branch 'main' into 164660-doc-viewer-header
jughosta Jan 2, 2024
fe78d50
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Jan 2, 2024
0e57f87
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Jan 2, 2024
5013ba2
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 3, 2024
5aea973
Merge branch 'main' into 164660-doc-viewer-header
jughosta Jan 3, 2024
150cb32
[Discover] Address PR comments
jughosta Jan 3, 2024
5bc3a75
Merge remote-tracking branch 'origin/164660-doc-viewer-header' into 1…
jughosta Jan 3, 2024
6bca18f
[Discover] Cleanup
jughosta Jan 3, 2024
f210bf2
[Discover] Fix spacing
jughosta Jan 3, 2024
0804964
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 5, 2024
9d9fa29
[Discover] Address PR comments
jughosta Jan 5, 2024
58ba789
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 5, 2024
9c4d60a
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 5, 2024
d85d5f9
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 5, 2024
fd72647
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 5, 2024
7d08583
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 8, 2024
edf8a3d
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 9, 2024
ef10dff
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 10, 2024
499c184
[Discover] Add help text
jughosta Jan 10, 2024
180445a
[Discover] Restore translations
jughosta Jan 10, 2024
05ec043
[Discover] Cleanup translations
jughosta Jan 10, 2024
20264a6
Update src/plugins/discover/public/components/discover_grid_flyout/di…
jughosta Jan 10, 2024
4c15b53
Merge branch 'main' into 163239-doc-viewer-actions
jughosta Jan 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import React, { useState } from 'react';
import { i18n } from '@kbn/i18n';
import { slice } from 'lodash';
import { css } from '@emotion/react';
import {
EuiFlexGroup,
EuiFlexItem,
Expand All @@ -22,6 +23,7 @@ import {
EuiButtonIcon,
EuiPopoverProps,
EuiToolTip,
useEuiTheme,
} from '@elastic/eui';
import type { FlyoutActionItem } from '../../customizations';

Expand All @@ -32,7 +34,9 @@ export interface DiscoverGridFlyoutActionsProps {
}

export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutActionsProps) {
const [isMoreFlyoutActionsPopoverOpen, setIsMoreFlyoutActionsPopover] = useState<boolean>(false);
const { euiTheme } = useEuiTheme();
const [isMoreFlyoutActionsPopoverOpen, setIsMoreFlyoutActionsPopoverOpen] =
useState<boolean>(false);
const isMobileScreen = useIsWithinBreakpoints(['xs', 's']);
const isLargeScreen = useIsWithinBreakpoints(['xl']);

Expand All @@ -48,15 +52,15 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
iconSide="right"
flush="left"
data-test-subj="docViewerMobileActionsButton"
onClick={() => setIsMoreFlyoutActionsPopover(!isMoreFlyoutActionsPopoverOpen)}
onClick={() => setIsMoreFlyoutActionsPopoverOpen(!isMoreFlyoutActionsPopoverOpen)}
>
{i18n.translate('discover.grid.tableRow.mobileFlyoutActionsButton', {
defaultMessage: 'Actions',
})}
</EuiButtonEmpty>
}
isOpen={isMoreFlyoutActionsPopoverOpen}
closePopover={() => setIsMoreFlyoutActionsPopover(false)}
closePopover={() => setIsMoreFlyoutActionsPopoverOpen(false)}
/>
);
}
Expand All @@ -75,8 +79,15 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
responsive={false}
wrap={true}
alignItems="center"
gutterSize={showFlyoutIconsOnly ? 'none' : 's'}
gutterSize="none"
data-test-subj="docViewerFlyoutActions"
css={
showFlyoutIconsOnly
? undefined
: css`
gap: ${(euiTheme.base / 4) * 3}px;
`
}
>
<EuiFlexItem grow={false}>
<EuiText size="s">
Expand All @@ -91,7 +102,9 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
{visibleFlyoutActions.map((action) => (
<EuiFlexItem key={action.id} grow={false}>
{showFlyoutIconsOnly ? (
<EuiToolTip content={action.label}>
<EuiToolTip
content={`${action.helpText ? `${action.label} - ${action.helpText}` : action.label}`}
jughosta marked this conversation as resolved.
Show resolved Hide resolved
>
<EuiButtonIcon
size="s"
iconType={action.iconType}
Expand All @@ -102,18 +115,20 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
/>
</EuiToolTip>
) : (
// eslint-disable-next-line @elastic/eui/href-or-on-click
<EuiButtonEmpty
size="s"
iconSize="s"
flush="left"
iconType={action.iconType}
data-test-subj={action.dataTestSubj}
href={action.href}
onClick={action.onClick}
>
{action.label}
</EuiButtonEmpty>
<EuiToolTip content={action.helpText} delay="long">
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
<EuiButtonEmpty
size="s"
iconSize="s"
flush="both"
iconType={action.iconType}
data-test-subj={action.dataTestSubj}
href={action.href}
onClick={action.onClick}
>
{action.label}
</EuiButtonEmpty>
</EuiToolTip>
)}
</EuiFlexItem>
))}
Expand All @@ -134,12 +149,12 @@ export function DiscoverGridFlyoutActions({ flyoutActions }: DiscoverGridFlyoutA
aria-label={i18n.translate('discover.grid.tableRow.moreFlyoutActionsButton', {
defaultMessage: 'More actions',
})}
onClick={() => setIsMoreFlyoutActionsPopover(!isMoreFlyoutActionsPopoverOpen)}
onClick={() => setIsMoreFlyoutActionsPopoverOpen(!isMoreFlyoutActionsPopoverOpen)}
/>
</EuiToolTip>
}
isOpen={isMoreFlyoutActionsPopoverOpen}
closePopover={() => setIsMoreFlyoutActionsPopover(false)}
closePopover={() => setIsMoreFlyoutActionsPopoverOpen(false)}
/>
</EuiFlexItem>
)}
Expand Down Expand Up @@ -174,6 +189,7 @@ function FlyoutActionsPopover({
key={action.id}
icon={action.iconType as EuiContextMenuItemIcon}
data-test-subj={action.dataTestSubj}
href={action.href}
onClick={action.onClick}

This comment was marked as resolved.

>
{action.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export const useFlyoutActions = ({
label: i18n.translate('discover.grid.tableRow.viewSurroundingDocumentsLinkLabel', {
defaultMessage: 'View surrounding documents',
}),
helpText: i18n.translate('discover.grid.tableRow.viewSurroundingDocumentsHover', {
defaultMessage:
'Inspect documents that occurred before and after this document. Only pinned filters remain active in the Surrounding documents view.',
}),
},
...customActions,
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface FlyoutActionItem {
id: string;
enabled: boolean;
label: string;
helpText?: string;
iconType: IconType;
onClick: (() => void) | MouseEventHandler;
href?: string;
Expand Down
Loading