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

[SIEM] Table Styles & Markup Tweaks #46300

Merged
merged 78 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
5df9bf6
restore conditional space before AS number
MichaelMarcialis Aug 30, 2019
ae46563
touchup table widths and text
MichaelMarcialis Aug 30, 2019
ef9f350
adjust datepicker width
MichaelMarcialis Aug 30, 2019
50a8a1c
refactor matchMedia; set bp to above mbp rez
MichaelMarcialis Aug 30, 2019
51ded2a
timeline table body refactor, first pass
MichaelMarcialis Sep 4, 2019
0b1587a
TruncatableText: rm “width”, added “truncated”
MichaelMarcialis Sep 4, 2019
17fa005
cleanup imports
MichaelMarcialis Sep 4, 2019
d6281b6
cleanup styles
MichaelMarcialis Sep 12, 2019
5b908c5
rm size prop
MichaelMarcialis Sep 12, 2019
2c08e03
swap out div? prob need to fix ref
MichaelMarcialis Sep 12, 2019
22bd360
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 12, 2019
2098355
restore truncation in timeline
MichaelMarcialis Sep 12, 2019
53fc5f5
think i have text overflow and tooltips happy now
MichaelMarcialis Sep 13, 2019
1a8d729
light clean up
MichaelMarcialis Sep 13, 2019
0b1b3a0
single overflow scrolling element
MichaelMarcialis Sep 16, 2019
7b49788
use polished for hex in rgba needs
MichaelMarcialis Sep 16, 2019
16ba724
simplify body markup
MichaelMarcialis Sep 16, 2019
f3a00b9
events table header poc
MichaelMarcialis Sep 17, 2019
41deb63
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 17, 2019
2319781
close button fixes
MichaelMarcialis Sep 17, 2019
84fc6a9
improve sort indicator position
MichaelMarcialis Sep 17, 2019
b5dd8b6
drag handle updates
MichaelMarcialis Sep 17, 2019
6a64a8a
fix fields browser positioning
MichaelMarcialis Sep 17, 2019
373f549
apply aria roles
MichaelMarcialis Sep 17, 2019
64fa92d
fix blown out table width
MichaelMarcialis Sep 17, 2019
02b90f6
localize sorting onClick to header text
MichaelMarcialis Sep 17, 2019
10125f3
correct key placement
MichaelMarcialis Sep 17, 2019
25ea213
prevent hover and click for unsortable and add btn
MichaelMarcialis Sep 17, 2019
b76330f
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 18, 2019
a0ccbd1
rm btn for non aggregatable col headers
MichaelMarcialis Sep 18, 2019
c6d3981
change width/height prop names to avoid html attr
MichaelMarcialis Sep 18, 2019
5fa59bd
fix loading alignment
MichaelMarcialis Sep 18, 2019
7565903
account for action cell width when one action
MichaelMarcialis Sep 18, 2019
f7b11ae
clean up trGroup organization
MichaelMarcialis Sep 18, 2019
a6ce249
imports cleanup
MichaelMarcialis Sep 19, 2019
5f77a5c
fix types and skeleton rows/cells poc
MichaelMarcialis Sep 19, 2019
58a4c60
new skeleton row comp
MichaelMarcialis Sep 19, 2019
724b770
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 19, 2019
d110171
fix column heads not dragging
MichaelMarcialis Sep 19, 2019
81f80d9
supplement row indentation
MichaelMarcialis Sep 19, 2019
752c836
move widths out of styled components for perf
MichaelMarcialis Sep 19, 2019
e2a55e6
inline dynamic width
MichaelMarcialis Sep 19, 2019
8026b1e
account for inline styles with dnd
MichaelMarcialis Sep 19, 2019
80bf9ef
cleanup
MichaelMarcialis Sep 19, 2019
d44ec33
tweak in-page events table styling for consistency
MichaelMarcialis Sep 19, 2019
73f80ad
cleanup
MichaelMarcialis Sep 19, 2019
b982175
make compressed for consistency
MichaelMarcialis Sep 19, 2019
e8801e9
cleanup
MichaelMarcialis Sep 20, 2019
9166ea0
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 20, 2019
a6355a3
update jest tests + change matchMedia to css mq
MichaelMarcialis Sep 20, 2019
adcf736
fix missing grab cursor in IE11
MichaelMarcialis Sep 20, 2019
972e532
fix action td group width in IE11
MichaelMarcialis Sep 20, 2019
5314013
fix columns menu positioning in IE11
MichaelMarcialis Sep 20, 2019
55bca1e
fix collapsing notes in timelines table in IE11
MichaelMarcialis Sep 20, 2019
b293c30
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 20, 2019
639c100
decouple from DroppableWrapper to prevent issues
MichaelMarcialis Sep 20, 2019
be97a1f
update snapshots
MichaelMarcialis Sep 20, 2019
c5a824c
more specific selector
MichaelMarcialis Sep 20, 2019
54dccc2
rm show prop
MichaelMarcialis Sep 21, 2019
6d3c9df
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 26, 2019
10a12fe
add truncate to shouldComponentUpdate
MichaelMarcialis Sep 26, 2019
303e3f9
bulk up `HeaderPanel` unit tests
MichaelMarcialis Sep 26, 2019
2058147
correct conditional styles and add some more tests
MichaelMarcialis Sep 26, 2019
321c5b9
improve SkeletonRow unit tests
MichaelMarcialis Sep 26, 2019
68a5c44
change for loop to map
MichaelMarcialis Sep 26, 2019
080020a
switch from pure to React.memo
MichaelMarcialis Sep 26, 2019
8ccc06f
make SkeletonRow cellCount dynamic
MichaelMarcialis Sep 26, 2019
a7511c5
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 26, 2019
37338be
rm comments
MichaelMarcialis Sep 27, 2019
5c99106
fix buttons not being draggable for col headers
MichaelMarcialis Sep 27, 2019
c4d52ba
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 27, 2019
fc65073
fix for safari position sticky + overflow auto bug
MichaelMarcialis Sep 27, 2019
e7c8c75
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 27, 2019
0ec59a4
correct type errors
MichaelMarcialis Sep 30, 2019
961f792
correct field browser overlap
MichaelMarcialis Sep 30, 2019
adb2de9
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Sep 30, 2019
50f6e2c
missing semicolon
MichaelMarcialis Oct 1, 2019
29ae404
Merge branch 'master' of https://github.com/elastic/kibana into table…
MichaelMarcialis Oct 1, 2019
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 @@ -12,7 +12,6 @@ import { MockedProvider } from 'react-apollo/test-utils';
import { mockBrowserFields, mocksSource } from '../../containers/source/mock';
import { TestProviders } from '../../mock';
import { mockDataProviders } from '../timeline/data_providers/mock/mock_data_providers';

import { DragDropContextWrapper } from './drag_drop_context_wrapper';
import { DraggableWrapper } from './draggable_wrapper';

Expand Down Expand Up @@ -50,14 +49,12 @@ describe('DraggableWrapper', () => {
});

describe('text truncation styling', () => {
test('it applies text truncation styling when a width IS specified (implicit: and the user is not dragging)', () => {
const width = '100px';

test('it applies text truncation styling when truncate IS specified (implicit: and the user is not dragging)', () => {
const wrapper = mount(
<TestProviders>
<MockedProvider mocks={mocksSource} addTypename={false}>
<DragDropContextWrapper browserFields={mockBrowserFields}>
<DraggableWrapper dataProvider={dataProvider} width={width} render={() => message} />
<DraggableWrapper dataProvider={dataProvider} render={() => message} truncate />
</DragDropContextWrapper>
</MockedProvider>
</TestProviders>
Expand All @@ -68,7 +65,7 @@ describe('DraggableWrapper', () => {
);
});

test('it does NOT apply text truncation styling when a width is NOT specified', () => {
test('it does NOT apply text truncation styling when truncate is NOT specified', () => {
const wrapper = mount(
<TestProviders>
<MockedProvider mocks={mocksSource} addTypename={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { dragAndDropActions } from '../../store/drag_and_drop';
import { DataProvider } from '../timeline/data_providers/data_provider';
import { STATEFUL_EVENT_CSS_CLASS_NAME } from '../timeline/helpers';
import { TruncatableText } from '../truncatable_text';

import { getDraggableId, getDroppableId } from './helpers';

// As right now, we do not know what we want there, we will keep it as a placeholder
Expand All @@ -29,41 +28,28 @@ export const DragEffects = styled.div``;
DragEffects.displayName = 'DragEffects';

const Wrapper = styled.div`
.euiPageBody & {
display: inline-block;
}
display: inline-block;
max-width: 100%;
`;

Wrapper.displayName = 'Wrapper';

const ProviderContainer = styled.div<{ isDragging: boolean }>`
${({ theme, isDragging }) => css`
// ALL DRAGGABLES
&,
&::before,
&::after {
transition: background ${theme.eui.euiAnimSpeedFast} ease,
color ${theme.eui.euiAnimSpeedFast} ease;
}
.euiBadge,
.euiBadge__text {
cursor: grab;
}
// PAGE DRAGGABLES
${!isDragging &&
`
.euiPageBody & {
z-index: ${theme.eui.euiZLevel0} !important;
}
{
& {
border-radius: 2px;
padding: 0 4px 0 8px;
position: relative;
z-index: ${theme.eui.euiZLevel0} !important;
&::before {
background-image: linear-gradient(
Expand All @@ -86,6 +72,14 @@ const ProviderContainer = styled.div<{ isDragging: boolean }>`
}
}
&:hover {
&,
& .euiBadge,
& .euiBadge__text {
cursor: move; //Fallback for IE11
cursor: grab;
}
}
.${STATEFUL_EVENT_CSS_CLASS_NAME}:hover &,
tr:hover & {
Expand All @@ -112,7 +106,8 @@ const ProviderContainer = styled.div<{ isDragging: boolean }>`
background-color: ${theme.eui.euiColorPrimary};
&,
& a {
& a,
& a:hover {
color: ${theme.eui.euiColorEmptyShade};
}
Expand All @@ -131,9 +126,10 @@ const ProviderContainer = styled.div<{ isDragging: boolean }>`
${isDragging &&
`
.euiPageBody & {
& {
z-index: ${theme.eui.euiZLevel9} !important;
`}
}
`}
`}
`;

Expand All @@ -147,7 +143,7 @@ interface OwnProps {
provided: DraggableProvided,
state: DraggableStateSnapshot
) => React.ReactNode;
width?: string;
truncate?: boolean;
}

interface DispatchProps {
Expand All @@ -166,10 +162,10 @@ type Props = OwnProps & DispatchProps;
* data provider associated with the item being dropped
*/
class DraggableWrapperComponent extends React.Component<Props> {
public shouldComponentUpdate = ({ dataProvider, render, width }: Props) =>
public shouldComponentUpdate = ({ dataProvider, render, truncate }: Props) =>
isEqual(dataProvider, this.props.dataProvider) &&
render !== this.props.render &&
width === this.props.width
MichaelMarcialis marked this conversation as resolved.
Show resolved Hide resolved
truncate === this.props.truncate
? false
: true;

Expand All @@ -186,7 +182,7 @@ class DraggableWrapperComponent extends React.Component<Props> {
}

public render() {
const { dataProvider, render, width } = this.props;
const { dataProvider, render, truncate } = this.props;

return (
<Wrapper data-test-subj="draggableWrapperDiv">
Expand All @@ -198,34 +194,28 @@ class DraggableWrapperComponent extends React.Component<Props> {
index={0}
key={getDraggableId(dataProvider.id)}
>
{(provided, snapshot) => {
return (
<ProviderContainer
{...provided.draggableProps}
{...provided.dragHandleProps}
innerRef={provided.innerRef}
data-test-subj="providerContainer"
isDragging={snapshot.isDragging}
style={{
...provided.draggableProps.style,
}}
>
{width != null && !snapshot.isDragging ? (
<TruncatableText
data-test-subj="draggable-truncatable-content"
size="xs"
width={width}
>
{render(dataProvider, provided, snapshot)}
</TruncatableText>
) : (
<span data-test-subj={`draggable-content-${dataProvider.queryMatch.field}`}>
{render(dataProvider, provided, snapshot)}
</span>
)}
</ProviderContainer>
);
}}
{(provided, snapshot) => (
<ProviderContainer
{...provided.draggableProps}
{...provided.dragHandleProps}
innerRef={provided.innerRef}
data-test-subj="providerContainer"
isDragging={snapshot.isDragging}
style={{
...provided.draggableProps.style,
}}
>
{truncate && !snapshot.isDragging ? (
<TruncatableText data-test-subj="draggable-truncatable-content">
{render(dataProvider, provided, snapshot)}
</TruncatableText>
) : (
<span data-test-subj={`draggable-content-${dataProvider.queryMatch.field}`}>
{render(dataProvider, provided, snapshot)}
</span>
)}
</ProviderContainer>
)}
</Draggable>
{droppableProvided.placeholder}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { rgba } from 'polished';
import * as React from 'react';
import { Droppable } from 'react-beautiful-dnd';
import { pure } from 'recompose';
import styled from 'styled-components';

import { THIRTY_PERCENT_ALPHA_HEX_SUFFIX, TWENTY_PERCENT_ALPHA_HEX_SUFFIX } from './helpers';

interface Props {
children?: React.ReactNode;
droppableId: string;
Expand All @@ -34,22 +33,22 @@ const ReactDndDropTarget = styled.div<{ isDraggingOver: boolean; height: string
? `
.drop-and-provider-timeline {
&:hover {
background-color: ${props.theme.eui.euiColorSuccess}${THIRTY_PERCENT_ALPHA_HEX_SUFFIX};
background-color: ${rgba(props.theme.eui.euiColorSuccess, 0.3)};
}
}
.drop-and-provider-timeline:hover {
background-color: ${props.theme.eui.euiColorSuccess}${THIRTY_PERCENT_ALPHA_HEX_SUFFIX};
background-color: ${rgba(props.theme.eui.euiColorSuccess, 0.3)};
}
> div.timeline-drop-area-empty {
color: ${props.theme.eui.euiColorSuccess}
background-color: ${props.theme.eui.euiColorSuccess}${TWENTY_PERCENT_ALPHA_HEX_SUFFIX};
background-color: ${rgba(props.theme.eui.euiColorSuccess, 0.2)};
& .euiTextColor--subdued {
color: ${props.theme.eui.euiColorSuccess};
}
}
> div.timeline-drop-area {
background-color: ${props.theme.eui.euiColorSuccess}${TWENTY_PERCENT_ALPHA_HEX_SUFFIX};
background-color: ${rgba(props.theme.eui.euiColorSuccess, 0.2)};
.provider-item-filter-container div:first-child{
// Override dragNdrop beautiful so we do not have our droppable moving around for no good reason
transform: none !important;
Expand Down Expand Up @@ -86,7 +85,6 @@ const ReactDndDropTarget = styled.div<{ isDraggingOver: boolean; height: string
}
}
`;

ReactDndDropTarget.displayName = 'ReactDndDropTarget';

export const DroppableWrapper = pure<Props>(
Expand Down Expand Up @@ -118,5 +116,4 @@ export const DroppableWrapper = pure<Props>(
</Droppable>
)
);

DroppableWrapper.displayName = 'DroppableWrapper';
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,3 @@ export const DRAG_TYPE_FIELD = 'drag-type-field';

/** This class is added to the document body while dragging */
export const IS_DRAGGING_CLASS_NAME = 'is-dragging';

/** A hex alpha channel suffix representing 10% for the `AA` in `#RRGGBBAA` */
export const TEN_PERCENT_ALPHA_HEX_SUFFIX = '1A';

/** A hex alpha channel suffix representing 20% for the `AA` in `#RRGGBBAA` */
export const TWENTY_PERCENT_ALPHA_HEX_SUFFIX = '33';

/** A hex alpha channel suffix representing 30% for the `AA` in `#RRGGBBAA` */
export const THIRTY_PERCENT_ALPHA_HEX_SUFFIX = '4d';
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,37 @@
* you may not use this file except in compliance with the Elastic License.
*/

import {
EuiBadge,
EuiFlexGroup,
EuiFlexItem,
// @ts-ignore
EuiHighlight,
} from '@elastic/eui';
import { rgba } from 'polished';
import * as React from 'react';
import { pure } from 'recompose';
import styled from 'styled-components';

const FieldBadgeFlexGroup = styled(EuiFlexGroup)`
height: 38px;
`;

FieldBadgeFlexGroup.displayName = 'FieldBadgeFlexGroup';

const FieldBadgeFlexItem = styled(EuiFlexItem)`
font-weight: bold;
`;

FieldBadgeFlexItem.displayName = 'FieldBadgeFlexItem';

/**
* The name of a (draggable) field
*/
export const FieldNameContainer = styled.div`
padding: 5px;
&:hover {
transition: background-color 0.7s ease;
background-color: #000;
color: #fff;
}
import styled, { css } from 'styled-components';

const Field = styled.div`
${({ theme }) => css`
background-color: ${theme.eui.euiColorEmptyShade};
border: ${theme.eui.euiBorderThin};
box-shadow: 0 2px 2px -1px ${rgba(theme.eui.euiColorMediumShade, 0.3)},
0 1px 5px -2px ${rgba(theme.eui.euiColorMediumShade, 0.3)};
font-size: ${theme.eui.euiFontSizeXS};
font-weight: ${theme.eui.euiFontWeightSemiBold};
line-height: ${theme.eui.euiLineHeight};
padding: ${theme.eui.paddingSizes.xs};
`}
`;

FieldNameContainer.displayName = 'FieldNameContainer';
Field.displayName = 'Field';

/**
* Renders a field (e.g. `event.action`) as a draggable badge
*/
export const DraggableFieldBadge = pure<{ fieldId: string }>(({ fieldId }) => (
<EuiBadge color="#000">
<FieldBadgeFlexGroup alignItems="center" justifyContent="center" gutterSize="none">
<FieldBadgeFlexItem data-test-subj="field" grow={false}>
{fieldId}
</FieldBadgeFlexItem>
</FieldBadgeFlexGroup>
</EuiBadge>
));

// Passing the styles directly to the component because the width is
// being calculated and is recommended by Styled Components for performance
// https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
export const DraggableFieldBadge = pure<{ fieldId: string; fieldWidth?: string }>(
({ fieldId, fieldWidth }) => (
<Field data-test-subj="field" style={{ width: fieldWidth }}>
{fieldId}
</Field>
)
);
DraggableFieldBadge.displayName = 'DraggableFieldBadge';
Loading