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

[Stack Monitoring] Visual refresh changes #204258

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
188a75e
refactor(monitoring): replace euiStyled with css from @emotion/react
weronikaolejniczak Dec 12, 2024
1ed7345
chore(monitoring): extend emotion.d.ts in tsconfig.json
weronikaolejniczak Dec 12, 2024
f86f46c
fix(monitoring): use euiTheme instead of theme.eui
weronikaolejniczak Dec 12, 2024
15e2eb2
feat(monitoring): replace euiThemeVars with euiTheme context
weronikaolejniczak Dec 12, 2024
75ecf79
refactor(monitoring): migrate Sass to @emotion/react
weronikaolejniczak Dec 13, 2024
9fe776e
chore(monitoring): remove redundant comment
weronikaolejniczak Dec 16, 2024
caa4759
fix(monitoring): add missing theme variables
weronikaolejniczak Dec 16, 2024
ae0ad27
chore(monitoring): update test snapshots
weronikaolejniczak Dec 16, 2024
89a7460
refactor(monitoring): simplify passing boolean prop
weronikaolejniczak Dec 16, 2024
3910c8b
chore(monitoring): disable jsx-a11y eslint error
weronikaolejniczak Dec 16, 2024
604193c
fix(monitoring): address feedback from PR
weronikaolejniczak Dec 16, 2024
6e00934
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 16, 2024
3599076
chore(monitoring): revert removing JSDoc comments
weronikaolejniczak Dec 17, 2024
c03c5ea
fix(monitoring): address PR feedback
weronikaolejniczak Dec 17, 2024
be1259e
fix(monitoring): import logicalCSS function
weronikaolejniczak Dec 17, 2024
537c102
fix(monitoring): remove div wrapping setup mode badge
weronikaolejniczak Dec 17, 2024
4d9caf0
chore: remove @elastic/observability-design from x-pack/plugins/monit…
weronikaolejniczak Dec 17, 2024
ac73699
refactor(monitoring): destructure euiTheme
weronikaolejniczak Dec 17, 2024
2b5a670
fix(monitoring: fix euiFontSize usages
weronikaolejniczak Dec 17, 2024
bdf91ff
fix(monitoring): remove important flag
weronikaolejniczak Dec 17, 2024
2625905
chore(monitoring): update test snapshots
weronikaolejniczak Dec 17, 2024
7da0729
fix(monitoring): add data-test-subj props to tables
weronikaolejniczak Dec 23, 2024
d9fd8c3
chore(monitoring): update test snapshots
weronikaolejniczak Dec 23, 2024
a64a966
refactor(monitoring): remove redundant divs
weronikaolejniczak Dec 26, 2024
5fb0911
fix(monitoring): fix wrong file extensions after conflicts
weronikaolejniczak Dec 26, 2024
355892b
fix(monitoring): fix typings emotion.d.ts path
weronikaolejniczak Dec 26, 2024
9b4df66
fix(monitoring): move data-test-subj to avoid overwriting
weronikaolejniczak Dec 29, 2024
3fd6f04
Merge branch 'main' into feat/monitoring-visual-refresh
elasticmachine Dec 29, 2024
d9929ef
Merge branch 'main' into feat/monitoring-visual-refresh
weronikaolejniczak Jan 2, 2025
13e889d
fix(monitoring): update tests to use data-test-subj
weronikaolejniczak Jan 2, 2025
7b3b9dd
Merge branch 'main' into feat/monitoring-visual-refresh
weronikaolejniczak Jan 2, 2025
ed2da63
fix(monitoring): update snapshot tests
weronikaolejniczak Jan 3, 2025
4c5601b
fix(monitoring): fix FTR test assertion
weronikaolejniczak Jan 3, 2025
5fb6cea
fix(monitoring): fix failing FTR and snapshot tests
weronikaolejniczak Jan 3, 2025
972ab09
Merge branch 'main' into feat/monitoring-visual-refresh
elasticmachine Jan 6, 2025
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
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2542,7 +2542,6 @@ x-pack/solutions/security/plugins/security_solution/server/lib/security_integrat

# Observability design
/x-pack/platform/plugins/shared/fleet/**/*.scss @elastic/observability-design
/x-pack/platform/plugins/private/monitoring/**/*.scss @elastic/observability-design

# Ent. Search design
/x-pack/solutions/search/plugins/enterprise_search/**/*.scss @elastic/search-design
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const LogStashNodePipelinesPage: React.FC<ComponentProps> = ({ clusters }
{data.pipelines && (
<div data-test-subj="logstashPipelinesListing">
<PipelineListing
className="monitoringLogstashPipelinesTable"
data-test-subj="monitoringLogstashPipelinesTable"
onBrush={onBrush}
zoomInfo={zoomInfo}
stats={data.nodeSummary}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const LogStashPipelinesPage: React.FC<ComponentProps> = ({ clusters }) =>
const upgradeMessage = pageData ? makeUpgradeMessage(clusterStatus.versions) : null;
return (
<PipelineListing
className="monitoringLogstashPipelinesTable"
data-test-subj="monitoringLogstashPipelinesTable"
onBrush={(xaxis: any) => onBrush({ xaxis })}
stats={clusterStatus}
data={pipelines}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ function getColumns(setupMode: SetupMode, cgroup: unknown) {
};

setupModeStatus = (
<div className="monTableCell__setupModeStatus">
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={APM_SYSTEM_ID}
/>
</div>
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={APM_SYSTEM_ID}
/>
);
}

Expand Down Expand Up @@ -187,7 +185,7 @@ export function ApmServerInstances({ apms, setupMode, alerts }: Props) {
<EuiPanel>
{setupModeCallout}
<EuiMonitoringTable
className="apmInstancesTable"
data-test-subj="apmInstancesTable"
rows={data.apms}
columns={getColumns(setupMode, data.cgroup)}
sorting={sorting}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ export class Listing extends PureComponent {
};

setupModeStatus = (
<div className="monTableCell__setupModeStatus">
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={BEATS_SYSTEM_ID}
/>
</div>
<SetupModeBadge
setupMode={setupMode}
status={status}
instance={instance}
productName={BEATS_SYSTEM_ID}
/>
);
}

Expand Down Expand Up @@ -161,7 +159,7 @@ export class Listing extends PureComponent {
<EuiPanel>
{setupModeCallOut}
<EuiMonitoringTable
className="beatsTable"
data-test-subj="beatsTable"
rows={data}
setupMode={setupMode}
productName={BEATS_SYSTEM_ID}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,86 @@
* 2.0.
*/

import React from 'react';
import React, { MouseEvent } from 'react';
import {
EuiFlexItem,
EuiFlexGroup,
EuiIcon,
UseEuiTheme,
euiFontSize,
logicalCSS,
} from '@elastic/eui';
import { css } from '@emotion/react';
import { includes, isFunction } from 'lodash';
import { EuiFlexItem, EuiFlexGroup, EuiIcon } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import './horizontal_legend.scss';

export class HorizontalLegend extends React.Component {
constructor() {
super();
const legendItemStyle = (isDisabled: boolean) => (theme: UseEuiTheme) =>
css`
display: flex;
font-size: ${euiFontSize(theme, 'xs').fontSize};
cursor: pointer;
color: ${theme.euiTheme.colors.textParagraph};
display: flex;
flex-direction: row;
align-items: center;
${isDisabled ? 'opacity: 0.5;' : ''}
`;

const legendHorizontalStyle = ({ euiTheme }: UseEuiTheme) => css`
${logicalCSS('margin-top', euiTheme.size.xs)}
`;

const legendLabelStyle = css`
overflow: hidden;
white-space: nowrap;
display: flex;
flex-direction: row;
align-items: center;
`;

const legendValueStyle = ({ euiTheme }: UseEuiTheme) => css`
overflow: hidden;
white-space: nowrap;
${logicalCSS('margin-left', euiTheme.size.xs)}
`;

interface Row {
id: string;
label: string;
legend?: boolean;
color?: string;
tickFormatter?: (arg: number) => number;
}

interface Props {
series: Row[];
seriesValues: { [key: string]: number };
seriesFilter: string[];
onToggle: (event: MouseEvent<HTMLButtonElement>, id: string) => void;
legendFormatter?: (value: number) => number;
tickFormatter?: (value: number) => number;
}

export class HorizontalLegend extends React.Component<Props> {
constructor(props: Props) {
super(props);
this.formatter = this.formatter.bind(this);
this.createSeries = this.createSeries.bind(this);
}

/**
* @param {Number} value Final value to display
*/
displayValue(value) {
return <span className="monRhythmChart__legendValue">{value}</span>;
displayValue(value: number) {
return <span css={legendValueStyle}>{value}</span>;
}

/**
* @param {Number} value True if value is falsy and/or not a number
*/
validValue(value) {
validValue(value: number) {
return value !== null && value !== undefined && (typeof value === 'string' || !isNaN(value));
}

Expand All @@ -38,7 +93,7 @@ export class HorizontalLegend extends React.Component {
* A null means no data for the time bucket and will be formatted as 'N/A'
* @param {Object} row Props passed form a parent by row index
*/
formatter(value, row) {
formatter(value: number, row: Row) {
if (!this.validValue(value)) {
return (
<FormattedMessage
Expand All @@ -48,7 +103,7 @@ export class HorizontalLegend extends React.Component {
);
}

if (row && row.tickFormatter) {
if (row?.tickFormatter) {
return this.displayValue(row.tickFormatter(value));
}

Expand All @@ -60,25 +115,19 @@ export class HorizontalLegend extends React.Component {
return this.displayValue(value);
}

createSeries(row, rowIdx) {
const classes = ['monRhythmChart__legendItem'];

if (!includes(this.props.seriesFilter, row.id)) {
classes.push('monRhythmChart__legendItem-isDisabled');
}
createSeries(row: Row, rowIdx: number) {
if (!row.label || row.legend === false) {
return <div key={rowIdx} style={{ display: 'none' }} />;
}

return (
<EuiFlexItem grow={false} key={rowIdx}>
<button
className={classes.join(' ')}
css={legendItemStyle(!includes(this.props.seriesFilter, row.id))}
onClick={(event) => this.props.onToggle(event, row.id)}
>
<span className="monRhythmChart__legendLabel">
<span css={legendLabelStyle}>
<EuiIcon
className="monRhythmChart__legendIndicator"
aria-label={i18n.translate(
'xpack.monitoring.chart.horizontalLegend.toggleButtonAriaLabel',
{ defaultMessage: 'toggle button' }
Expand All @@ -87,7 +136,7 @@ export class HorizontalLegend extends React.Component {
type="dot"
color={row.color}
/>
{' ' + row.label + ' '}
{` ${row.label} `}
</span>
{this.formatter(this.props.seriesValues[row.id], row)}
</button>
Expand All @@ -99,8 +148,8 @@ export class HorizontalLegend extends React.Component {
const rows = this.props.series.map(this.createSeries);

return (
<div className="monRhythmChart__legendHorizontal">
<EuiFlexGroup wrap={true} gutterSize="s" className="monRhythmChart__legendSeries">
<div css={legendHorizontalStyle}>
<EuiFlexGroup wrap={true} gutterSize="s">
{rows}
</EuiFlexGroup>
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,36 @@
*/

import React from 'react';
import { css } from '@emotion/react';
import { euiFontSize, UseEuiTheme } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n-react';
import './info_tooltip.scss';

export function InfoTooltip({ series, bucketSize }) {
import { Series } from './types';

const tooltipLabelStyle = (theme: UseEuiTheme) => css`
text-align: left;
font-size: ${euiFontSize(theme, 'xs').fontSize};
padding: ${theme.euiTheme.size.xs};
word-wrap: break-word;
white-space: normal;
font-weight: ${theme.euiTheme.font.weight.bold};
`;

const tooltipValueStyle = (theme: UseEuiTheme) => css`
text-align: left;
font-size: ${euiFontSize(theme, 'xs').fontSize};
padding: ${theme.euiTheme.size.xs};
word-wrap: break-word;
white-space: normal;
`;

interface Props {
series: Series[];
bucketSize?: string;
}

export function InfoTooltip({ series, bucketSize }: Props) {
const tableRows = series.map((item, index) => {
return (
<tr
Expand All @@ -19,8 +45,8 @@ export function InfoTooltip({ series, bucketSize }) {
data-debug-metric-is-derivative={item.metric.isDerivative}
data-debug-metric-has-calculation={item.metric.hasCalculation}
>
<td className="monChart__tooltipLabel">{item.metric.label}</td>
<td className="monChart__tooltipValue">{item.metric.description}</td>
<td css={tooltipLabelStyle}>{item.metric.label}</td>
<td css={tooltipValueStyle}>{item.metric.description}</td>
</tr>
);
});
Expand All @@ -29,13 +55,13 @@ export function InfoTooltip({ series, bucketSize }) {
<table>
<tbody>
<tr>
<td className="monChart__tooltipLabel">
<td css={tooltipLabelStyle}>
<FormattedMessage
id="xpack.monitoring.chart.infoTooltip.intervalLabel"
defaultMessage="Interval"
/>
</td>
<td className="monChart__tooltipValue">{bucketSize}</td>
<td css={tooltipValueStyle}>{bucketSize}</td>
</tr>
{tableRows}
</tbody>
Expand Down

This file was deleted.

Loading
Loading