From f13a15ae48d8fed899cda40723256414e6940815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 11 May 2020 14:25:26 +0200 Subject: [PATCH] TablePanel: Fixed persisting column resize time series fields (#24505) --- public/app/plugins/panel/table/TablePanel.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/panel/table/TablePanel.tsx b/public/app/plugins/panel/table/TablePanel.tsx index 67be8764ce6..2a53e5d2cfc 100644 --- a/public/app/plugins/panel/table/TablePanel.tsx +++ b/public/app/plugins/panel/table/TablePanel.tsx @@ -1,7 +1,14 @@ import React, { Component } from 'react'; import { Table, Select } from '@grafana/ui'; -import { FieldMatcherID, PanelProps, DataFrame, SelectableValue, getFrameDisplayTitle } from '@grafana/data'; +import { + FieldMatcherID, + PanelProps, + DataFrame, + SelectableValue, + getFrameDisplayTitle, + getFieldTitle, +} from '@grafana/data'; import { Options } from './types'; import { css } from 'emotion'; import { config } from 'app/core/config'; @@ -27,12 +34,12 @@ export class TablePanel extends Component { return; } - const fieldName = field.name; + const fieldDisplayName = getFieldTitle(field, frame, data.series); const matcherId = FieldMatcherID.byName; const propId = 'custom.width'; // look for existing override - const override = overrides.find(o => o.matcher.id === matcherId && o.matcher.options === fieldName); + const override = overrides.find(o => o.matcher.id === matcherId && o.matcher.options === fieldDisplayName); if (override) { // look for existing property @@ -44,7 +51,7 @@ export class TablePanel extends Component { } } else { overrides.push({ - matcher: { id: matcherId, options: fieldName }, + matcher: { id: matcherId, options: fieldDisplayName }, properties: [{ id: propId, value: width }], }); }