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

[Monitoring] [Logstash] Add Config View #18597

Merged
merged 44 commits into from
Jun 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9c4d9d1
Patch ConfigView changes from x-pack-kibana to OSS Kibana.
justinkambic Apr 25, 2018
47e90ba
Remove old css.
justinkambic Apr 26, 2018
d7e8f9c
Update style for queue statement.
justinkambic May 1, 2018
9ccd97d
WIP modifying based on designer feedback.
justinkambic May 10, 2018
7aceaf9
WIP checkin. Modify components to handle flattened object list.
justinkambic May 15, 2018
c27d4b3
Add flatten function and list class.
justinkambic May 15, 2018
208f1cc
Rename functions to be more descriptive.
justinkambic May 15, 2018
f56cfd4
Finish moving flatten logic into classes, add tests.
justinkambic May 17, 2018
7c1c9a1
Simplify flattening, remove non-native dependency. Add more tests.
justinkambic May 18, 2018
096c7da
Add defaults to simplify function call.
justinkambic May 18, 2018
bcdbfa8
Refactor two blocks into a function.
justinkambic May 18, 2018
406d2be
Begin adapting components for list.
justinkambic May 18, 2018
97c7b77
Add collapse functionality.
justinkambic May 23, 2018
6474119
Add expand functionality.
justinkambic May 23, 2018
79b7172
Nested collapsed elements remain collapsed on parent expansion.
justinkambic May 23, 2018
1add4c1
Style section headers.
justinkambic May 23, 2018
ca7d35b
Update Plugin statement styles.
justinkambic May 23, 2018
fcb8407
Add DetailDrawer support.
justinkambic May 23, 2018
f43affe
Update statement formatting.
justinkambic May 24, 2018
7fa88d5
Add stats to plugin element rows.
justinkambic May 24, 2018
c35d134
Resolve conflicts.
justinkambic May 24, 2018
431edbc
Remove obsolete code.
justinkambic May 24, 2018
39459e7
Reorganize code.
justinkambic May 24, 2018
669ca91
Remove warnings.
justinkambic May 24, 2018
a05f5d0
Add PropTypes. Add keys to arrays and iterables.
justinkambic May 25, 2018
4d87d52
Update color for borders/buttons.
justinkambic May 25, 2018
32946d2
Add stat class. Clean up code.
justinkambic May 25, 2018
f3e9927
Convert plugin statement component from class to function.
justinkambic May 26, 2018
5254c70
Update queue metrics message.
justinkambic May 29, 2018
33d6413
Update style to make view more responsive.
justinkambic May 29, 2018
8c7b9e0
Change section heading size.
justinkambic May 29, 2018
a3b9bed
Remove gutter from metrics group.
justinkambic May 29, 2018
0ab6b51
Change name "stat" to "metric".
justinkambic May 29, 2018
56d77f1
Remove obsolete export line, simplify declaration, based on PR feedback.
justinkambic May 31, 2018
fcb2452
Add new functional component in place of model class.
justinkambic May 31, 2018
c580e5e
Add PropTypes to several components. Rename a function. Add keys to m…
justinkambic May 31, 2018
c7a92de
Convert stateless classes to functional components.
justinkambic May 31, 2018
4536b27
Prefer ES6 syntax over bindings for Component methods.
justinkambic May 31, 2018
d845795
Do not render statement section if there are no statements.
justinkambic Jun 5, 2018
1f667cc
design cleanup for pipeline viewer
snide Jun 7, 2018
da426f3
Update CSS to add min-height to page.
justinkambic Jun 7, 2018
1689b94
Rename "elements" to "statements". Delete unused LESS variables.
justinkambic Jun 13, 2018
c991bb1
Revert naming of "statements" to "elements" for StatementList component.
justinkambic Jun 13, 2018
a91dc56
Update jest snapshots for DetailDrawer.
justinkambic Jun 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@ exports[`DetailDrawer component If vertices shows basic info and no stats for if
>
<EuiFlyoutHeader>
<EuiFlexGroup
alignItems="center"
alignItems="baseline"
component="div"
direction="row"
gutterSize="l"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<img
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to use an EuiIcon here? Along with the other areas using ad-hoc omg tags? But that's not a blocking item IMHO and is perhaps better in a followup PR anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll create an issue to track it. These changes are indirect to the scope of this PR, it's based on some cleanup that Dave did after he updated the styles.

EDIT: #20021

className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
Expand All @@ -23,11 +33,6 @@ exports[`DetailDrawer component If vertices shows basic info and no stats for if
size="m"
>
<h2>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
if
</h2>
</EuiTitle>
Expand All @@ -38,7 +43,7 @@ exports[`DetailDrawer component If vertices shows basic info and no stats for if
>
<EuiButtonIcon
aria-label="Close"
color="primary"
color="text"
iconType="cross"
onClick={[MockFunction]}
type="button"
Expand Down Expand Up @@ -78,14 +83,24 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
>
<EuiFlyoutHeader>
<EuiFlexGroup
alignItems="center"
alignItems="baseline"
component="div"
direction="row"
gutterSize="l"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
Expand All @@ -94,11 +109,6 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
size="m"
>
<h2>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
grok filter
</h2>
</EuiTitle>
Expand All @@ -109,7 +119,7 @@ exports[`DetailDrawer component Plugin vertices Plugin does not have explicit ID
>
<EuiButtonIcon
aria-label="Close"
color="primary"
color="text"
iconType="cross"
onClick={[MockFunction]}
type="button"
Expand Down Expand Up @@ -371,14 +381,24 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
>
<EuiFlyoutHeader>
<EuiFlexGroup
alignItems="center"
alignItems="baseline"
component="div"
direction="row"
gutterSize="l"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
Expand All @@ -387,11 +407,6 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
size="m"
>
<h2>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
grok filter
</h2>
</EuiTitle>
Expand All @@ -402,7 +417,7 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
>
<EuiButtonIcon
aria-label="Close"
color="primary"
color="text"
iconType="cross"
onClick={[MockFunction]}
type="button"
Expand All @@ -418,9 +433,12 @@ exports[`DetailDrawer component Plugin vertices Plugin has explicit ID shows bas
This
plugin
's ID is
<strong>
<EuiBadge
color="default"
iconSide="left"
>
parse_apache_logline
</strong>
</EuiBadge>
.
</p>
<EuiTable
Expand Down Expand Up @@ -657,14 +675,24 @@ exports[`DetailDrawer component Queue vertices shows basic info and no stats for
>
<EuiFlyoutHeader>
<EuiFlexGroup
alignItems="center"
alignItems="baseline"
component="div"
direction="row"
gutterSize="l"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
Expand All @@ -673,11 +701,6 @@ exports[`DetailDrawer component Queue vertices shows basic info and no stats for
size="m"
>
<h2>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
queue
</h2>
</EuiTitle>
Expand All @@ -688,7 +711,7 @@ exports[`DetailDrawer component Queue vertices shows basic info and no stats for
>
<EuiButtonIcon
aria-label="Close"
color="primary"
color="text"
iconType="cross"
onClick={[MockFunction]}
type="button"
Expand Down Expand Up @@ -718,28 +741,32 @@ exports[`DetailDrawer component shows vertex title 1`] = `
>
<EuiFlyoutHeader>
<EuiFlexGroup
alignItems="center"
alignItems="baseline"
component="div"
direction="row"
gutterSize="l"
gutterSize="s"
justifyContent="flexStart"
responsive={true}
wrap={false}
>
<EuiFlexItem
component="div"
grow={false}
>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</EuiFlexItem>
<EuiFlexItem
component="div"
grow={true}
>
<EuiTitle
size="m"
>
<h2>
<img
className="lspvDetailDrawerIcon"
height={18}
width={18}
/>
</h2>
<h2 />
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem
Expand All @@ -748,7 +775,7 @@ exports[`DetailDrawer component shows vertex title 1`] = `
>
<EuiButtonIcon
aria-label="Close"
color="primary"
color="text"
iconType="cross"
onClick={[MockFunction]}
type="button"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* 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 React from 'react';
import PropTypes from 'prop-types';

import {
EuiButtonEmpty,
EuiButtonIcon,
EuiCodeBlock,
EuiFlexGroup,
EuiFlexItem
} from '@elastic/eui';

function renderStatementName(name, onVertexSelected) {
return (
<EuiFlexItem
grow={false}
key="statementName"
>
<EuiButtonEmpty
color="text"
size="xs"
onClick={onVertexSelected}
flush="left"
>
<span className="configViewer__conditional">{name}</span>
</EuiButtonEmpty>
</EuiFlexItem>
);
}

function renderIfStatement({ condition }, onVertexSelected) {
return [
renderStatementName('if', onVertexSelected),
(
<EuiFlexItem
key="ifContent"
grow={false}
>
<EuiCodeBlock
fontSize="s"
paddingSize="none"
transparentBackground={true}
>
{condition}
</EuiCodeBlock>
</EuiFlexItem>
)
];
}

function getStatementBody({
isIf,
statement,
statement: { vertex },
onShowVertexDetails
}) {
const showVertexDetailsClicked = () => { onShowVertexDetails(vertex); };

return isIf
? renderIfStatement(statement, showVertexDetailsClicked)
: renderStatementName('else', showVertexDetailsClicked);
}

function getToggleIconType(isCollapsed) {
return isCollapsed ? 'arrowRight' : 'arrowDown';
}

export function CollapsibleStatement(props) {
const {
collapse,
expand,
id,
isCollapsed
} = props;

const toggleClicked = () => {
if (isCollapsed) {
expand(id);
} else {
collapse(id);
}
};

return (
<EuiFlexGroup
responsive={false}
gutterSize="none"
alignItems="center"
className="configViewer__statement"
>
<EuiFlexItem
key={id}
grow={false}
>
<EuiButtonIcon
aria-label
color="text"
iconType={getToggleIconType(isCollapsed)}
onClick={toggleClicked}
size="s"
/>
</EuiFlexItem>
{getStatementBody(props)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of a nice to have, so feel free to push it off to a future PR: It'd be nice if CollapsibleStatement was a standalone "wrapper" or "decorator" component for any statement component that was passed into it. Concretely that could mean using props.children on this line and rendering CollapsibleStatement like so:

<CollapsibleStatement ...>
   <IfStatement .../>
</CollapsibleStatement>

or

<CollapsibleStatement ...>
   <ElseStatement .../>
</CollapsibleStatement>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to do this in a separate PR so we can get these existing changes merged faster, especially since there aren't any functional ramifications.

It's tracked in #19844 and I will update the PR's description to include that in the set of follow-up work.

</EuiFlexGroup>
);
}

CollapsibleStatement.propTypes = {
collapse: PropTypes.func.isRequired,
expand: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
isIf: PropTypes.bool.isRequired,
isCollapsed: PropTypes.bool.isRequired,
onShowVertexDetails: PropTypes.func.isRequired,
statement: PropTypes.object.isRequired,
};