From 1ccde2a17363827dcd4206e23a1732e917266973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 15 Jan 2021 15:17:46 +0100 Subject: [PATCH] AngularGraph: Fixes issues with legend wrapping after legend refactoring (#30283) --- .../panel/graph/Legend/LegendSeriesItem.tsx | 20 ++++++++++--------- public/sass/components/_panel_graph.scss | 20 +++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/public/app/plugins/panel/graph/Legend/LegendSeriesItem.tsx b/public/app/plugins/panel/graph/Legend/LegendSeriesItem.tsx index 31f4a11ff1f..b028cf88c63 100644 --- a/public/app/plugins/panel/graph/Legend/LegendSeriesItem.tsx +++ b/public/app/plugins/panel/graph/Legend/LegendSeriesItem.tsx @@ -1,7 +1,7 @@ import React, { PureComponent } from 'react'; import classNames from 'classnames'; import { TimeSeries } from 'app/core/core'; -import { Icon, SeriesColorPicker } from '@grafana/ui'; +import { SeriesColorPicker, SeriesIcon } from '@grafana/ui'; import { selectors } from '@grafana/e2e-selectors'; export const LEGEND_STATS = ['min', 'max', 'avg', 'current', 'total']; @@ -105,7 +105,9 @@ export class LegendItem extends PureComponent if (asTable) { return ( - {seriesLabel} + +
{seriesLabel}
+ {valueItems} ); @@ -170,10 +172,6 @@ interface LegendSeriesIconState { color: string; } -function SeriesIcon({ color }: { color: string }) { - return ; -} - class LegendSeriesIcon extends PureComponent { static defaultProps: Partial = { yaxis: undefined, @@ -197,9 +195,13 @@ class LegendSeriesIcon extends PureComponent {({ ref, showColorPicker, hideColorPicker }) => ( - - - + )} ); diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 80ea878574d..82f9397d5e9 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -76,7 +76,7 @@ display: inline; cursor: pointer; white-space: nowrap; - font-size: 85%; + font-size: 12px; text-align: left; &.current::before { content: 'Current: '; @@ -105,6 +105,8 @@ float: left; white-space: nowrap; padding-left: 10px; + display: flex; + align-items: center; &--right-y { float: right; @@ -146,17 +148,12 @@ float: none; display: table-cell; white-space: nowrap; - padding: 2px 10px; + padding: 2px; text-align: right; } .graph-legend-icon { - width: 5px; - padding: 0; - top: 0; - .fa { - top: 4px; - } + cursor: pointer; } .graph-legend-value { @@ -164,9 +161,7 @@ } .graph-legend-alias { - padding-left: 7px; text-align: left; - width: 95%; max-width: 650px; text-overflow: ellipsis; overflow: hidden; @@ -198,6 +193,11 @@ } } +.graph-legend-series__table-name { + display: flex; + align-items: center; +} + .graph-legend-series-hidden { .graph-legend-value, .graph-legend-alias {