Skip to content

Commit

Permalink
[Pipeline Viewer] [Monitoring] Rename config view to PipelineViewer (#…
Browse files Browse the repository at this point in the history
…20230)

* Rename config view to PipelineViewer.

* Remove unused className.

* Remove unneeded variable.

* Format file with prettier.
  • Loading branch information
justinkambic committed Jun 26, 2018
1 parent 7b0c532 commit 794caae
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { ConfigViewer } from './views/config_viewer';
export { PipelineViewer } from './views';
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function renderStatementName(name, onVertexSelected) {
onClick={onVertexSelected}
flush="left"
>
<span className="configViewer__conditional">{name}</span>
<span className="pipelineViewer__conditional">{name}</span>
</EuiButtonEmpty>
</EuiFlexItem>
);
Expand Down Expand Up @@ -91,7 +91,7 @@ export function CollapsibleStatement(props) {
responsive={false}
gutterSize="none"
alignItems="center"
className="configViewer__statement"
className="pipelineViewer__statement"
>
<EuiFlexItem
key={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { ConfigViewer } from './config_viewer';
export { PipelineViewer } from './pipeline_viewer';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import classNames from 'classnames';
export function Metric({ className, value, warning }) {

const classes = classNames(
'configViewer__metric',
'pipelineViewer__metric',
className,
);

Expand All @@ -38,7 +38,7 @@ export function Metric({ className, value, warning }) {
}
return (
<EuiFlexItem
className="configViewer__metricFlexItem"
className="pipelineViewer__metricFlexItem"
grow={false}
>
{stylizedValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import { DetailDrawer } from '../detail_drawer';
import { DetailDrawer } from './detail_drawer';
import { Queue } from './queue';
import { StatementSection } from './statement_section';
import {
Expand All @@ -15,7 +15,7 @@ import {
EuiPageContent,
} from '@elastic/eui';

export class ConfigViewer extends React.Component {
export class PipelineViewer extends React.Component {
constructor() {
super();
this.state = {
Expand Down Expand Up @@ -70,7 +70,7 @@ export class ConfigViewer extends React.Component {

return (
<EuiPage>
<EuiPageContent verticalPosition="center" horizontalPosition="center" className="configViewer">
<EuiPageContent verticalPosition="center" horizontalPosition="center" className="pipelineViewer">
<StatementSection
iconType="logstashInput"
headingText="Inputs"
Expand Down Expand Up @@ -103,7 +103,7 @@ export class ConfigViewer extends React.Component {
}
}

ConfigViewer.propTypes = {
PipelineViewer.propTypes = {
pipeline: PropTypes.shape({
inputs: PropTypes.array.isRequired,
filters: PropTypes.array.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
EuiFlexItem,
EuiBadge,
} from '@elastic/eui';
import { formatMetric } from '../../../../../lib/format_number';
import { formatMetric } from '../../../../lib/format_number';
import { Metric } from './metric';

function getInputStatementMetrics({ latestEventsPerSecond }) {
return [(
<Metric
key="eventsEmitted"
className="configViewer__metric--eventsEmitted"
className="pipelineViewer__metric--eventsEmitted"
value={formatMetric(latestEventsPerSecond, '0.[00]a', 'e/s emitted')}
/>
)];
Expand All @@ -36,23 +36,23 @@ function getProcessorStatementMetrics(processorVertex) {
(
<Metric
key="cpuMetric"
className="configViewer__metric--cpuTime"
className="pipelineViewer__metric--cpuTime"
warning={processorVertex.isTimeConsuming()}
value={formatMetric(Math.round(percentOfTotalProcessorTime || 0), '0', '%', { prependSpace: false })}
/>
),
(
<Metric
key="eventMillis"
className="configViewer__metric--eventMillis"
className="pipelineViewer__metric--eventMillis"
warning={processorVertex.isSlow()}
value={formatMetric(latestMillisPerEvent, '0.[00]a', 'ms/e')}
/>
),
(
<Metric
key="eventsReceived"
className="configViewer__metric--events"
className="pipelineViewer__metric--events"
value={formatMetric(latestEventsPerSecond, '0.[00]a', 'e/s received')}
/>
)
Expand Down Expand Up @@ -83,7 +83,7 @@ export function PluginStatement({
gutterSize="none"
justifyContent="spaceBetween"
alignItems="center"
className="configViewer__statement"
className="pipelineViewer__statement"
>
<EuiFlexItem grow={false}>
<EuiFlexGroup
Expand All @@ -97,7 +97,7 @@ export function PluginStatement({
color="primary"
iconType="dot"
flush="left"
className="configViewer__plugin"
className="pipelineViewer__plugin"
onClick={onNameButtonClick}
>
<span>{name}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { EuiSpacer, EuiText } from '@elastic/eui';

export function Queue() {
return (
<div className="configStatementList">
<div>
<StatementListHeading
iconType="logstashQueue"
title="Queue"
/>
<EuiSpacer size="s" />
<EuiText className="configViewer__queueMessage">
<EuiText className="pipelineViewer__queueMessage">
Queue metrics not available
</EuiText>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import React from 'react';
import PropTypes from 'prop-types';
import { PluginStatement as PluginStatementModel } from '../../models/pipeline/plugin_statement';
import { PluginStatement as PluginStatementModel } from '../models/pipeline/plugin_statement';
import { CollapsibleStatement } from './collapsible_statement';
import { IfElement } from '../../models/list/if_element';
import { IfElement } from '../models/list/if_element';
import { PluginStatement } from './plugin_statement';

function renderNestingSpacers(depth) {
const spacers = [];
for (let i = 0; i < depth; i += 1) {
spacers.push(<div key={`spacer_${i}`} className="configViewer__spacer" />);
spacers.push(<div key={`spacer_${i}`} className="pipelineViewer__spacer" />);
}
return spacers;
}
Expand Down Expand Up @@ -56,8 +56,8 @@ export function Statement(props) {
const { depth } = props.element;

return (
<li className={`configViewer__listItem`}>
<div className="configViewer__spaceContainer">
<li className={`pipelineViewer__listItem`}>
<div className="pipelineViewer__spaceContainer">
{renderNestingSpacers(depth)}
</div>
{renderStatement(props)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function StatementSection({
if (!elements.length) { return null; }

return (
<div className="configStatementList">
<div>
<StatementListHeading
iconType={iconType}
title={headingText}
Expand Down Expand Up @@ -99,7 +99,7 @@ class StatementList extends React.PureComponent {
const { elements } = this.props;

return (
<ul className="configViewer__list">
<ul className="pipelineViewer__list">
{
elements.map(this.renderStatement)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,40 @@ import React from 'react';
import { render } from 'react-dom';
import moment from 'moment';
import { uiModules } from 'ui/modules';
import { ConfigViewer } from 'plugins/monitoring/components/logstash/pipeline_viewer';
import { PipelineViewer } from 'plugins/monitoring/components/logstash/pipeline_viewer';
import { Pipeline } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/pipeline';
import { List } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/list';
import { PipelineState } from 'plugins/monitoring/components/logstash/pipeline_viewer/models/pipeline_state';

const uiModule = uiModules.get('monitoring/directives', []);
uiModule.directive('monitoringLogstashPipelineViewer', ($injector) => {
uiModule.directive('monitoringLogstashPipelineViewer', $injector => {
const config = $injector.get('config');
const dateFormat = config.get('dateFormat');

const timeseriesTooltipXValueFormatter = xValue => moment(xValue).format(dateFormat);
const timeseriesTooltipXValueFormatter = xValue =>
moment(xValue).format(dateFormat);

return {
restrict: 'E',
scope: {
pipeline: '='
pipeline: '=',
},
link: function (scope, $el) {
link: (scope, $el) => {
const pipelineState = new PipelineState(scope.pipeline);

scope.$watch('pipeline', (updatedPipeline) => {
scope.$watch('pipeline', updatedPipeline => {
pipelineState.update(updatedPipeline);
const configViewer = (
<ConfigViewer
pipeline={
List.fromPipeline(
Pipeline.fromPipelineGraph(
pipelineState.config.graph
)
)
}

render(
<PipelineViewer
pipeline={List.fromPipeline(
Pipeline.fromPipelineGraph(pipelineState.config.graph)
)}
timeseriesTooltipXValueFormatter={timeseriesTooltipXValueFormatter}
/>
/>,
$el[0]
);
render(configViewer, $el[0]);
});
}
},
};
});

This file was deleted.

Loading

0 comments on commit 794caae

Please sign in to comment.