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

[Metrics UI] Convert layouts to use React components #49134

Merged
merged 18 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
64c250f
Convert layouts to use React compontents
simianhacker Oct 24, 2019
3fcd27a
Renaming layout files; Fixing some types; Removing unused types
simianhacker Oct 28, 2019
01dc2f3
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Oct 28, 2019
3978258
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Oct 29, 2019
50cd9e5
Fixing naming issue
simianhacker Oct 29, 2019
59113ae
Fixing path
simianhacker Oct 29, 2019
9a6a892
Fixing i18n stuff
simianhacker Oct 29, 2019
2280953
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Oct 30, 2019
82f3f16
[Metrics UI] Move toolbars under inventory models
simianhacker Oct 30, 2019
4ebdfbd
Merge branch 'master' into issue-48808-react-layouts
elasticmachine Oct 31, 2019
f725d8a
Fixing imports; wrapping code in useMemo to optimize
simianhacker Oct 31, 2019
506217d
Merge branch 'issue-48808-react-layouts' of github.com:simianhacker/k…
simianhacker Oct 31, 2019
d2d4e68
removing unused imports
simianhacker Oct 31, 2019
928fa26
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Nov 11, 2019
80ed453
Merge branch 'master' into issue-48808-react-layouts
elasticmachine Nov 11, 2019
481db40
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Nov 12, 2019
54637f2
Merge branch 'master' of github.com:elastic/kibana into issue-48808-r…
simianhacker Nov 13, 2019
d541687
Removing prototype page
simianhacker Nov 13, 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 @@ -4,13 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { layout } from './layout';
import { metrics } from './metrics';
import { InventoryModel } from '../types';

export const container: InventoryModel = {
id: 'container',
requiredModules: ['docker'],
layout,
metrics,
requiredMetrics: [
'containerOverview',
'containerCpuUsage',
'containerMemory',
'containerNetworkTraffic',
'containerDiskIOBytes',
'containerDiskIOOps',
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,32 @@
* 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 { i18n } from '@kbn/i18n';
import { InventoryDetailLayoutCreator } from '../types';
import { nginxLayoutCreator } from '../shared/layouts/nginx';
import { LayoutPropsWithTheme } from '../../../public/pages/metrics/types';
import { Section } from '../../../public/pages/metrics/components/section';
import { SubSection } from '../../../public/pages/metrics/components/sub_section';
import { GaugesSectionVis } from '../../../public/pages/metrics/components/gauges_section_vis';
import { ChartSectionVis } from '../../../public/pages/metrics/components/chart_section_vis';
import { withTheme } from '../../../../../common/eui_styled_components';

export const layout: InventoryDetailLayoutCreator = theme => [
{
id: 'containerOverview',
label: i18n.translate('xpack.infra.metricDetailPage.containerMetricsLayout.layoutLabel', {
defaultMessage: 'Container',
}),
sections: [
{
id: 'containerOverview',
label: i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.overviewSection.sectionLabel',
{
defaultMessage: 'Overview',
}
),
requires: ['docker.cpu', 'docker.memory', 'docker.network'],
type: 'gauges',
visConfig: {
seriesOverrides: {
export const Layout = withTheme(({ metrics, theme }: LayoutPropsWithTheme) => (
<React.Fragment>
<Section
navLabel={i18n.translate('xpack.infra.metricDetailPage.containerMetricsLayout.layoutLabel', {
defaultMessage: 'Container',
})}
sectionLabel={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.overviewSection.sectionLabel',
{
defaultMessage: 'Container Overview',
}
)}
metrics={metrics}
>
<SubSection id="containerOverview">
<GaugesSectionVis
seriesOverrides={{
cpu: {
name: i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.overviewSection.cpuUsageSeriesLabel',
Expand Down Expand Up @@ -71,62 +73,59 @@ export const layout: InventoryDetailLayoutCreator = theme => [
formatter: 'bits',
formatterTemplate: '{{value}}/s',
},
},
},
},
{
id: 'containerCpuUsage',
label: i18n.translate(
}}
/>
</SubSection>
<SubSection
id="containerCpuUsage"
label={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.cpuUsageSection.sectionLabel',
{
defaultMessage: 'CPU Usage',
}
),
requires: ['docker.cpu'],
type: 'chart',
visConfig: {
stacked: true,
type: 'area',
formatter: 'percent',
seriesOverrides: {
)}
>
<ChartSectionVis
stacked={true}
type="area"
formatter="percent"
seriesOverrides={{
cpu: { color: theme.eui.euiColorVis1 },
},
},
},
{
id: 'containerMemory',
label: i18n.translate(
}}
/>
</SubSection>
<SubSection
id="containerMemory"
label={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.memoryUsageSection.sectionLabel',
{
defaultMessage: 'Memory Usage',
}
),
requires: ['docker.memory'],
type: 'chart',
visConfig: {
stacked: true,
type: 'area',
formatter: 'percent',
seriesOverrides: {
)}
>
<ChartSectionVis
stacked={true}
type="area"
formatter="percent"
seriesOverrides={{
memory: { color: theme.eui.euiColorVis1 },
},
},
},
{
id: 'containerNetworkTraffic',
label: i18n.translate(
}}
/>
</SubSection>
<SubSection
id="containerNetworkTraffic"
label={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.networkTrafficSection.sectionLabel',
{
defaultMessage: 'Network Traffic',
}
),
requires: ['docker.network'],
type: 'chart',
visConfig: {
formatter: 'bits',
formatterTemplate: '{{value}}/s',
type: 'area',
seriesOverrides: {
)}
>
<ChartSectionVis
formatter="bits"
formatterTemplate="{{value}}/s"
type="area"
seriesOverrides={{
rx: {
color: theme.eui.euiColorVis1,
name: i18n.translate(
Expand All @@ -145,24 +144,23 @@ export const layout: InventoryDetailLayoutCreator = theme => [
}
),
},
},
},
},
{
id: 'containerDiskIOOps',
label: i18n.translate(
}}
/>
</SubSection>
<SubSection
id="containerDiskIOOps"
label={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.diskIoOpsSection.sectionLabel',
{
defaultMessage: 'Disk IO (Ops)',
}
),
requires: ['docker.diskio'],
type: 'chart',
visConfig: {
formatter: 'number',
formatterTemplate: '{{value}}/s',
type: 'area',
seriesOverrides: {
)}
>
<ChartSectionVis
type="area"
formatterTemplate="{{value}}/s"
formatter="number"
seriesOverrides={{
read: {
color: theme.eui.euiColorVis1,
name: i18n.translate(
Expand All @@ -181,24 +179,23 @@ export const layout: InventoryDetailLayoutCreator = theme => [
}
),
},
},
},
},
{
id: 'containerDiskIOBytes',
label: i18n.translate(
}}
/>
</SubSection>
<SubSection
id="containerDiskIOBytes"
label={i18n.translate(
'xpack.infra.metricDetailPage.containerMetricsLayout.diskIoBytesSection.sectionLabel',
{
defaultMessage: 'Disk IO (Bytes)',
}
),
requires: ['docker.diskio'],
type: 'chart',
visConfig: {
formatter: 'bytes',
formatterTemplate: '{{value}}/s',
type: 'area',
seriesOverrides: {
)}
>
<ChartSectionVis
type="area"
formatter="bytes"
formatterTemplate="{{value}}/s"
seriesOverrides={{
read: {
color: theme.eui.euiColorVis1,
name: i18n.translate(
Expand All @@ -217,10 +214,9 @@ export const layout: InventoryDetailLayoutCreator = theme => [
}
),
},
},
},
},
],
},
...nginxLayoutCreator(theme),
];
}}
/>
</SubSection>
</Section>
</React.Fragment>
));
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ export const metrics: InventoryMetrics = {
containerMemory,
},
snapshot: { cpu, memory, rx, tx },
defaultSnapshot: 'cpu',
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

import React, { useMemo } from 'react';
import { EuiFlexItem } from '@elastic/eui';
import { ToolbarProps } from './toolbar';
import { WaffleMetricControls } from '../../waffle/waffle_metric_controls';
import { WaffleGroupByControls } from '../../waffle/waffle_group_by_controls';
import { InfraSnapshotMetricType } from '../../../graphql/types';
import { toMetricOpt, toGroupByOpt } from './toolbar_wrapper';
import { ToolbarProps } from '../../../public/components/inventory/toolbars/toolbar';
import { WaffleMetricControls } from '../../../public/components/waffle/waffle_metric_controls';
import { WaffleGroupByControls } from '../../../public/components/waffle/waffle_group_by_controls';
import { InfraSnapshotMetricType } from '../../../public/graphql/types';
import {
toMetricOpt,
toGroupByOpt,
} from '../../../public/components/inventory/toolbars/toolbar_wrapper';

export const ContainerToolbarItems = (props: ToolbarProps) => {
const options = useMemo(
Expand Down
Loading