Skip to content

Commit

Permalink
[Monitoring] [Logstash] Add Config View (#18597)
Browse files Browse the repository at this point in the history
* Patch ConfigView changes from x-pack-kibana to OSS Kibana.

* Remove old css.

* Update style for queue statement.

* WIP modifying based on designer feedback.

* Add flatten function and list class.

* Rename functions to be more descriptive.

* WIP checkin. Modify components to handle flattened object list.

* Finish moving flatten logic into classes, add tests.

* Simplify flattening, remove non-native dependency. Add more tests.

* Add defaults to simplify function call.

* Refactor two blocks into a function.

* Begin adapting components for list.

* Add collapse functionality.

* Add expand functionality.

* Nested collapsed elements remain collapsed on parent expansion.

* Style section headers.

* Update Plugin statement styles.

* Add DetailDrawer support.

* Update statement formatting.

* Add stats to plugin element rows.

* Resolve conflicts.

* Remove obsolete code.

* Reorganize code.

* Remove warnings.

* Add PropTypes. Add keys to arrays and iterables.

* Update color for borders/buttons.

* Add stat class. Clean up code.

* Convert plugin statement component from class to function.

* Update queue metrics message.

* Update style to make view more responsive.

* Change section heading size.

* Remove gutter from metrics group.

* Change name "stat" to "metric".

* Remove obsolete export line, simplify declaration, based on PR feedback.

* Add new functional component in place of model class.

* Add PropTypes to several components. Rename a function. Add keys to metrics.

* Convert stateless classes to functional components.

* Prefer ES6 syntax over bindings for Component methods.

* Do not render statement section if there are no statements.

* design cleanup for pipeline viewer

* Update CSS to add min-height to page.

* Rename "elements" to "statements". Delete unused LESS variables.

* Revert naming of "statements" to "elements" for StatementList component.

* Update jest snapshots for DetailDrawer.
  • Loading branch information
justinkambic committed Jun 19, 2018
1 parent 5be1989 commit b01dc53
Show file tree
Hide file tree
Showing 14 changed files with 893 additions and 53 deletions.
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
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)}
</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,
};

0 comments on commit b01dc53

Please sign in to comment.