Skip to content

Commit

Permalink
TablePanel: Fixed persisting column resize time series fields (#24505)
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelo committed May 11, 2020
1 parent 34f6193 commit f13a15a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions 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';
Expand All @@ -27,12 +34,12 @@ export class TablePanel extends Component<Props> {
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
Expand All @@ -44,7 +51,7 @@ export class TablePanel extends Component<Props> {
}
} else {
overrides.push({
matcher: { id: matcherId, options: fieldName },
matcher: { id: matcherId, options: fieldDisplayName },
properties: [{ id: propId, value: width }],
});
}
Expand Down

0 comments on commit f13a15a

Please sign in to comment.