mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: reuse table merge from table panel
- Extracted table panel's merge logic to combine multiple tables into one - Put the merge logic into the table model as it merges multiple table models - make use of merge in Explore's table query response handler - copied tests over to table model spec, kept essential tests in transformer spec
This commit is contained in:
@@ -5,6 +5,8 @@ import ReactTable from 'react-table';
|
||||
import TableModel from 'app/core/table_model';
|
||||
|
||||
const EMPTY_TABLE = new TableModel();
|
||||
// Identify columns that contain values
|
||||
const VALUE_REGEX = /^[Vv]alue #\d+/;
|
||||
|
||||
interface TableProps {
|
||||
data: TableModel;
|
||||
@@ -34,6 +36,7 @@ export default class Table extends PureComponent<TableProps> {
|
||||
const columns = tableModel.columns.map(({ filterable, text }) => ({
|
||||
Header: text,
|
||||
accessor: text,
|
||||
className: VALUE_REGEX.test(text) ? 'text-right' : '',
|
||||
show: text !== 'Time',
|
||||
Cell: row => <span className={filterable ? 'link' : ''}>{row.value}</span>,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user