-
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
Use push flyout for Discover document flyout #166406
Changes from 19 commits
cadd8d8
23dc630
58cc26e
b164831
cea1288
deaa9ee
70d7127
083921c
54d24b6
a9072e4
b583a9d
ab29999
8e70fb3
0b97736
3b4cb11
28483cd
5e9b816
e8028d9
2d2eb32
ddf3694
dfebc40
9942d54
6ca57ec
a83c461
46d4424
8c1bdec
865fed9
785c75f
a5d409a
8b3d9f8
1de9a94
da63a18
f488e70
816fafc
0156206
8ab3fd7
b268e75
88c7b05
ec72196
e1f6667
8e362f3
42d6612
4e995f7
8cfa359
40be3e2
8866baf
f86a39d
9abcf27
8d69a43
6f462be
f48a840
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.dscGridFlyout { | ||
.euiFlyoutBody__overflowContent { | ||
padding: $euiSize; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ import { | |||||||||||||||||||||||||||||||
keys, | ||||||||||||||||||||||||||||||||
EuiButtonEmpty, | ||||||||||||||||||||||||||||||||
useEuiTheme, | ||||||||||||||||||||||||||||||||
useIsWithinMinBreakpoint, | ||||||||||||||||||||||||||||||||
} from '@elastic/eui'; | ||||||||||||||||||||||||||||||||
import type { Filter, Query, AggregateQuery } from '@kbn/es-query'; | ||||||||||||||||||||||||||||||||
import type { DataTableRecord } from '@kbn/discover-utils/types'; | ||||||||||||||||||||||||||||||||
|
@@ -37,6 +38,7 @@ import { isTextBasedQuery } from '../../application/main/utils/is_text_based_que | |||||||||||||||||||||||||||||||
import { useFlyoutActions } from './use_flyout_actions'; | ||||||||||||||||||||||||||||||||
import { useDiscoverCustomization } from '../../customizations'; | ||||||||||||||||||||||||||||||||
import { DiscoverGridFlyoutActions } from './discover_grid_flyout_actions'; | ||||||||||||||||||||||||||||||||
import './_discover_grid_flyout.scss'; | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
export interface DiscoverGridFlyoutProps { | ||||||||||||||||||||||||||||||||
savedSearchId?: string; | ||||||||||||||||||||||||||||||||
|
@@ -82,8 +84,8 @@ export function DiscoverGridFlyout({ | |||||||||||||||||||||||||||||||
const services = useDiscoverServices(); | ||||||||||||||||||||||||||||||||
const flyoutCustomization = useDiscoverCustomization('flyout'); | ||||||||||||||||||||||||||||||||
const { euiTheme } = useEuiTheme(); | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
const defaultWidth = flyoutCustomization?.size ?? 540; // Give enough room to search bar to not wrap | ||||||||||||||||||||||||||||||||
const isXlScreen = useIsWithinMinBreakpoint('xl'); | ||||||||||||||||||||||||||||||||
const defaultWidth = flyoutCustomization?.size ?? euiTheme.base * 34; // Give enough room to search bar to not wrap | ||||||||||||||||||||||||||||||||
const [flyoutWidth, setFlyoutWidth] = useLocalStorage(FLYOUT_WIDTH_KEY, defaultWidth); | ||||||||||||||||||||||||||||||||
const minWidth = euiTheme.base * 24; | ||||||||||||||||||||||||||||||||
const maxWidth = euiTheme.breakpoint.xl; | ||||||||||||||||||||||||||||||||
|
@@ -230,6 +232,10 @@ export function DiscoverGridFlyout({ | |||||||||||||||||||||||||||||||
minWidth={minWidth} | ||||||||||||||||||||||||||||||||
maxWidth={maxWidth} | ||||||||||||||||||||||||||||||||
onResize={setFlyoutWidth} | ||||||||||||||||||||||||||||||||
css={{ | ||||||||||||||||||||||||||||||||
maxWidth: `${isXlScreen ? `calc(100vw - ${defaultWidth}px)` : '90vw'} !important`, | ||||||||||||||||||||||||||||||||
}} | ||||||||||||||||||||||||||||||||
className="dscGridFlyout" | ||||||||||||||||||||||||||||||||
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. Rather than using a class with a new style, we should be able to instead use |
||||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||
<EuiFlyoutHeader hasBorder> | ||||||||||||||||||||||||||||||||
<EuiFlexGroup | ||||||||||||||||||||||||||||||||
|
@@ -241,7 +247,7 @@ export function DiscoverGridFlyout({ | |||||||||||||||||||||||||||||||
> | ||||||||||||||||||||||||||||||||
<EuiFlexItem grow={false}> | ||||||||||||||||||||||||||||||||
<EuiTitle | ||||||||||||||||||||||||||||||||
size="s" | ||||||||||||||||||||||||||||||||
size="xs" | ||||||||||||||||||||||||||||||||
data-test-subj="docTableRowDetailsTitle" | ||||||||||||||||||||||||||||||||
css={css` | ||||||||||||||||||||||||||||||||
white-space: nowrap; | ||||||||||||||||||||||||||||||||
|
@@ -274,15 +280,11 @@ export function DiscoverGridFlyout({ | |||||||||||||||||||||||||||||||
</EuiFlyoutHeader> | ||||||||||||||||||||||||||||||||
<EuiFlyoutBody>{bodyContent}</EuiFlyoutBody> | ||||||||||||||||||||||||||||||||
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. @lukasolson this comment is referring to the element being rendered in the let's bring this over the finishing line by adjusting the responsiveness of the action column of the kibana/src/plugins/unified_doc_viewer/public/components/doc_viewer_table/table.tsx Lines 111 to 125 in f734170
const { euiTheme } = useEuiTheme();
const [ref, setRef] = useState<HTMLDivElement | HTMLSpanElement | null>(null);
const dimensions = useResizeObserver(ref);
const showActionsInsideTableCell = dimensions?.width
? dimensions.width > euiTheme.breakpoint.m
: false; With Then the action column would no longer be responsive to the window width, but to the flyout width, which is a better pattern anyway. Should we use Thx for the feedback @andreadelrio and 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. One other note: we should also make the single document and surrounding documents buttons responsive based on the flyout width since they currently use the window width too. We should be able to use the same resize observer approach for both the buttons and table actions.
We could use a preset breakpoint, but it might even be better to just use |
||||||||||||||||||||||||||||||||
<EuiFlyoutFooter> | ||||||||||||||||||||||||||||||||
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. From the EUI docs (https://elastic.github.io/eui/#/layout/flyout#push-versus-overlay):
|
||||||||||||||||||||||||||||||||
<EuiFlexGroup> | ||||||||||||||||||||||||||||||||
<EuiFlexItem grow={false}> | ||||||||||||||||||||||||||||||||
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left"> | ||||||||||||||||||||||||||||||||
{i18n.translate('discover.grid.flyout.close', { | ||||||||||||||||||||||||||||||||
defaultMessage: 'Close', | ||||||||||||||||||||||||||||||||
})} | ||||||||||||||||||||||||||||||||
</EuiButtonEmpty> | ||||||||||||||||||||||||||||||||
</EuiFlexItem> | ||||||||||||||||||||||||||||||||
</EuiFlexGroup> | ||||||||||||||||||||||||||||||||
<EuiButtonEmpty iconType="cross" onClick={onClose} flush="left"> | ||||||||||||||||||||||||||||||||
{i18n.translate('discover.grid.flyout.close', { | ||||||||||||||||||||||||||||||||
defaultMessage: 'Close', | ||||||||||||||||||||||||||||||||
})} | ||||||||||||||||||||||||||||||||
</EuiButtonEmpty> | ||||||||||||||||||||||||||||||||
</EuiFlyoutFooter> | ||||||||||||||||||||||||||||||||
</EuiFlyoutResizable> | ||||||||||||||||||||||||||||||||
</EuiPortal> | ||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,7 +133,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
it('a11y test for actions on a field', async () => { | ||
await PageObjects.discover.clickDocViewerTab('doc_view_table'); | ||
if (await testSubjects.exists('openFieldActionsButton-Cancelled')) { | ||
await testSubjects.click('openFieldActionsButton-Cancelled'); | ||
await testSubjects.click('openFieldActionsButton-Cancelled'); // Open the actions | ||
await testSubjects.click('openFieldActionsButton-Cancelled'); // Close the actions | ||
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 think we should close the menu after we call |
||
} else { | ||
await testSubjects.existOrFail('fieldActionsGroup-Cancelled'); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,17 +78,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
it('should display a log level badge when available', async () => { | ||
await dataGrid.clickRowToggle({ columnIndex: 4 }); | ||
await testSubjects.existOrFail('logsExplorerFlyoutLogLevel'); | ||
await dataGrid.closeFlyout(); | ||
}); | ||
|
||
it('should not display a log level badge when not available', async () => { | ||
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. For some reason this test (and the others below) were failing because the web elements had become "stale", and were throwing errors. I'm not sure how the changes in this PR would affect this, but breaking these into separate 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. This PR will actually remove most of these tests after moving the doc view implementation, I'll take care of the conflicts but this LGTM. |
||
await dataGrid.clickRowToggle({ rowIndex: 1, columnIndex: 4 }); | ||
await testSubjects.missingOrFail('logsExplorerFlyoutLogLevel'); | ||
}); | ||
|
||
it('should display a message code block when available', async () => { | ||
await dataGrid.clickRowToggle({ columnIndex: 4 }); | ||
await testSubjects.existOrFail('logsExplorerFlyoutLogMessage'); | ||
await dataGrid.closeFlyout(); | ||
}); | ||
|
||
it('should not display a message code block when not available', async () => { | ||
await dataGrid.clickRowToggle({ rowIndex: 1, columnIndex: 4 }); | ||
await testSubjects.missingOrFail('logsExplorerFlyoutLogMessage'); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,17 +80,19 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { | |
it('should display a log level badge when available', async () => { | ||
await dataGrid.clickRowToggle({ columnIndex: 4 }); | ||
await testSubjects.existOrFail('logsExplorerFlyoutLogLevel'); | ||
await dataGrid.closeFlyout(); | ||
}); | ||
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. Nit: I think the flyouts no longer need to be closed in those tests, since we navigate to Discover before each test |
||
|
||
it('should not display a log level badge when not available', async () => { | ||
await dataGrid.clickRowToggle({ rowIndex: 1, columnIndex: 4 }); | ||
await testSubjects.missingOrFail('logsExplorerFlyoutLogLevel'); | ||
}); | ||
|
||
it('should display a message code block when available', async () => { | ||
await dataGrid.clickRowToggle({ columnIndex: 4 }); | ||
await testSubjects.existOrFail('logsExplorerFlyoutLogMessage'); | ||
await dataGrid.closeFlyout(); | ||
}); | ||
|
||
it('should not display a message code block when not available', async () => { | ||
await dataGrid.clickRowToggle({ rowIndex: 1, columnIndex: 4 }); | ||
await testSubjects.missingOrFail('logsExplorerFlyoutLogMessage'); | ||
}); | ||
|
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 didn't realize this when I originally opened my touchups PR, but there's going to be an issue with using
defaultWidth
here since it could be a string value when overridden by a customization (e.g. Logs Explorer uses60%
). I think we can just split outeuiTheme.base * 34
into a separate const to use here and we should be safe.