mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Migrate table to cue model (#61852)
* WIP table cue model * WIP table types migration * refactor * WIP table cue * docs * veneer fix, docs * docs
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
keywords:
|
||||||
|
- grafana
|
||||||
|
- schema
|
||||||
|
title: TablePanelCfg kind
|
||||||
|
---
|
||||||
|
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice.
|
||||||
|
|
||||||
|
## TablePanelCfg
|
||||||
|
|
||||||
|
#### Maturity: [experimental](../../../maturity/#experimental)
|
||||||
|
#### Version: 0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
| Property | Type | Required | Description |
|
||||||
|
|----------------|-------------------------|----------|-------------|
|
||||||
|
| `PanelOptions` | [object](#paneloptions) | **Yes** | |
|
||||||
|
|
||||||
|
### PanelOptions
|
||||||
|
|
||||||
|
| Property | Type | Required | Description |
|
||||||
|
|-----------------|---------------------------------------------------|----------|--------------------------------------------------------------------------------------|
|
||||||
|
| `frameIndex` | number | **Yes** | Represents the index of the selected frame Default: `0`. |
|
||||||
|
| `showHeader` | boolean | **Yes** | Controls whether the panel should show the header Default: `true`. |
|
||||||
|
| `footer` | [object](#footer) | No | Controls footer options Default: `map[countRows:false reducer:[] show:false]`. |
|
||||||
|
| `showRowNums` | boolean | No | Controls whether the columns should be numbered Default: `false`. |
|
||||||
|
| `showTypeIcons` | boolean | No | Controls whether the header should show icons for the column types Default: `false`. |
|
||||||
|
| `sortBy` | [TableSortByFieldState](#tablesortbyfieldstate)[] | No | Used to control row sorting |
|
||||||
|
|
||||||
|
### TableSortByFieldState
|
||||||
|
|
||||||
|
Sort by field state
|
||||||
|
|
||||||
|
| Property | Type | Required | Description |
|
||||||
|
|---------------|---------|----------|-----------------------------------------------|
|
||||||
|
| `displayName` | string | **Yes** | Sets the display name of the field to sort by |
|
||||||
|
| `desc` | boolean | No | Flag used to indicate descending sort order |
|
||||||
|
|
||||||
|
### Footer
|
||||||
|
|
||||||
|
Controls footer options
|
||||||
|
|
||||||
|
| Property | Type | Required | Description |
|
||||||
|
|----------|------|----------|-------------|
|
||||||
|
|
||||||
|
|
||||||
@@ -631,13 +631,35 @@ export enum TableCellBackgroundDisplayMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO docs
|
* Sort by field state
|
||||||
*/
|
*/
|
||||||
export interface TableSortByFieldState {
|
export interface TableSortByFieldState {
|
||||||
|
/**
|
||||||
|
* Flag used to indicate descending sort order
|
||||||
|
*/
|
||||||
desc?: boolean;
|
desc?: boolean;
|
||||||
|
/**
|
||||||
|
* Sets the display name of the field to sort by
|
||||||
|
*/
|
||||||
displayName: string;
|
displayName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Footer options
|
||||||
|
*/
|
||||||
|
export interface TableFooterOptions {
|
||||||
|
countRows?: boolean;
|
||||||
|
enablePagination?: boolean;
|
||||||
|
fields?: Array<string>;
|
||||||
|
reducer: Array<string>;
|
||||||
|
show: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultTableFooterOptions: Partial<TableFooterOptions> = {
|
||||||
|
fields: [],
|
||||||
|
reducer: [],
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto mode table cell options
|
* Auto mode table cell options
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,12 +11,23 @@ TableCellDisplayMode: "auto" | "color-text" | "color-background" | "color-backgr
|
|||||||
// or a gradient.
|
// or a gradient.
|
||||||
TableCellBackgroundDisplayMode: "basic" | "gradient" @cuetsy(kind="enum",memberNames="Basic|Gradient")
|
TableCellBackgroundDisplayMode: "basic" | "gradient" @cuetsy(kind="enum",memberNames="Basic|Gradient")
|
||||||
|
|
||||||
// TODO docs
|
// Sort by field state
|
||||||
TableSortByFieldState: {
|
TableSortByFieldState: {
|
||||||
|
// Sets the display name of the field to sort by
|
||||||
displayName: string
|
displayName: string
|
||||||
|
// Flag used to indicate descending sort order
|
||||||
desc?: bool
|
desc?: bool
|
||||||
} @cuetsy(kind="interface")
|
} @cuetsy(kind="interface")
|
||||||
|
|
||||||
|
// Footer options
|
||||||
|
TableFooterOptions: {
|
||||||
|
show: bool
|
||||||
|
reducer: [...string] // actually 1 value
|
||||||
|
fields?: [...string]
|
||||||
|
enablePagination?: bool
|
||||||
|
countRows?: bool
|
||||||
|
} @cuetsy(kind="interface")
|
||||||
|
|
||||||
// Auto mode table cell options
|
// Auto mode table cell options
|
||||||
TableAutoCellOptions: {
|
TableAutoCellOptions: {
|
||||||
type: TableCellDisplayMode & "auto"
|
type: TableCellDisplayMode & "auto"
|
||||||
|
|||||||
@@ -23,3 +23,12 @@ export interface TextDimensionConfig extends BaseDimensionConfig<string>, Omit<r
|
|||||||
export interface ColorDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.ColorDimensionConfig, 'fixed'> {}
|
export interface ColorDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.ColorDimensionConfig, 'fixed'> {}
|
||||||
|
|
||||||
export * from '../common/common.gen';
|
export * from '../common/common.gen';
|
||||||
|
|
||||||
|
// TODO remove when https://github.com/grafana/cuetsy/issues/74 is fixed
|
||||||
|
export const defaultTableFieldOptions: raw.TableFieldOptions = {
|
||||||
|
align: 'auto',
|
||||||
|
inspect: false,
|
||||||
|
cellOptions: {
|
||||||
|
type: raw.TableCellDisplayMode.Auto,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|||||||
@@ -1598,6 +1598,30 @@
|
|||||||
"pluralName": "TableOldPanelCfgs",
|
"pluralName": "TableOldPanelCfgs",
|
||||||
"schemaInterface": "PanelCfg"
|
"schemaInterface": "PanelCfg"
|
||||||
},
|
},
|
||||||
|
"tablepanelcfg": {
|
||||||
|
"category": "composable",
|
||||||
|
"codeowners": [
|
||||||
|
"grafana/grafana-bi-squad"
|
||||||
|
],
|
||||||
|
"currentVersion": [
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"grafanaMaturityCount": 0,
|
||||||
|
"lineageIsGroup": true,
|
||||||
|
"links": {
|
||||||
|
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/composable/tablepanelcfg/schema-reference",
|
||||||
|
"go": "n/a",
|
||||||
|
"schema": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/table/panelcfg.cue",
|
||||||
|
"ts": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/table/panelcfg.gen.ts"
|
||||||
|
},
|
||||||
|
"machineName": "tablepanelcfg",
|
||||||
|
"maturity": "experimental",
|
||||||
|
"name": "TablePanelCfg",
|
||||||
|
"pluralMachineName": "tablepanelcfgs",
|
||||||
|
"pluralName": "TablePanelCfgs",
|
||||||
|
"schemaInterface": "PanelCfg"
|
||||||
|
},
|
||||||
"team": {
|
"team": {
|
||||||
"category": "core",
|
"category": "core",
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
@@ -1972,6 +1996,7 @@
|
|||||||
"statpanelcfg",
|
"statpanelcfg",
|
||||||
"statushistorypanelcfg",
|
"statushistorypanelcfg",
|
||||||
"tableoldpanelcfg",
|
"tableoldpanelcfg",
|
||||||
|
"tablepanelcfg",
|
||||||
"tempodataquery",
|
"tempodataquery",
|
||||||
"tempodatasourcecfg",
|
"tempodatasourcecfg",
|
||||||
"testdatadataquery",
|
"testdatadataquery",
|
||||||
@@ -2031,12 +2056,13 @@
|
|||||||
"statetimelinepanelcfg",
|
"statetimelinepanelcfg",
|
||||||
"statpanelcfg",
|
"statpanelcfg",
|
||||||
"statushistorypanelcfg",
|
"statushistorypanelcfg",
|
||||||
|
"tablepanelcfg",
|
||||||
"tempodataquery",
|
"tempodataquery",
|
||||||
"testdatadataquery",
|
"testdatadataquery",
|
||||||
"textpanelcfg",
|
"textpanelcfg",
|
||||||
"xychartpanelcfg"
|
"xychartpanelcfg"
|
||||||
],
|
],
|
||||||
"count": 25
|
"count": 26
|
||||||
},
|
},
|
||||||
"mature": {
|
"mature": {
|
||||||
"name": "mature",
|
"name": "mature",
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ func corePlugins(rt *thema.Runtime) []pfs.ParsedPlugin {
|
|||||||
parsePluginOrPanic("public/app/plugins/panel/stat", "stat", rt),
|
parsePluginOrPanic("public/app/plugins/panel/stat", "stat", rt),
|
||||||
parsePluginOrPanic("public/app/plugins/panel/state-timeline", "state_timeline", rt),
|
parsePluginOrPanic("public/app/plugins/panel/state-timeline", "state_timeline", rt),
|
||||||
parsePluginOrPanic("public/app/plugins/panel/status-history", "status_history", rt),
|
parsePluginOrPanic("public/app/plugins/panel/status-history", "status_history", rt),
|
||||||
|
parsePluginOrPanic("public/app/plugins/panel/table", "table", rt),
|
||||||
parsePluginOrPanic("public/app/plugins/panel/table-old", "table_old", rt),
|
parsePluginOrPanic("public/app/plugins/panel/table-old", "table_old", rt),
|
||||||
parsePluginOrPanic("public/app/plugins/panel/text", "text", rt),
|
parsePluginOrPanic("public/app/plugins/panel/text", "text", rt),
|
||||||
parsePluginOrPanic("public/app/plugins/panel/traces", "traces", rt),
|
parsePluginOrPanic("public/app/plugins/panel/traces", "traces", rt),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { PanelRenderer } from '@grafana/runtime';
|
|||||||
import { GraphFieldConfig, GraphTresholdsStyleMode } from '@grafana/schema';
|
import { GraphFieldConfig, GraphTresholdsStyleMode } from '@grafana/schema';
|
||||||
import { PanelContext, PanelContextProvider, useStyles2 } from '@grafana/ui';
|
import { PanelContext, PanelContextProvider, useStyles2 } from '@grafana/ui';
|
||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
import { PanelOptions } from 'app/plugins/panel/table/models.gen';
|
import { PanelOptions } from 'app/plugins/panel/table/panelcfg.gen';
|
||||||
|
|
||||||
import { useVizHeight } from '../../hooks/useVizHeight';
|
import { useVizHeight } from '../../hooks/useVizHeight';
|
||||||
import { SupportedPanelPlugins, PanelPluginsButtonGroup } from '../PanelPluginsButtonGroup';
|
import { SupportedPanelPlugins, PanelPluginsButtonGroup } from '../PanelPluginsButtonGroup';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { config, getDataSourceSrv, PanelRenderer } from '@grafana/runtime';
|
import { config, getDataSourceSrv, PanelRenderer } from '@grafana/runtime';
|
||||||
import { Alert, CodeEditor, DateTimePicker, LinkButton, useStyles2, useTheme2 } from '@grafana/ui';
|
import { Alert, CodeEditor, DateTimePicker, LinkButton, useStyles2, useTheme2 } from '@grafana/ui';
|
||||||
import { isExpressionQuery } from 'app/features/expressions/guards';
|
import { isExpressionQuery } from 'app/features/expressions/guards';
|
||||||
import { PanelOptions } from 'app/plugins/panel/table/models.gen';
|
import { PanelOptions } from 'app/plugins/panel/table/panelcfg.gen';
|
||||||
import { AccessControlAction } from 'app/types';
|
import { AccessControlAction } from 'app/types';
|
||||||
import { AlertDataQuery, AlertQuery } from 'app/types/unified-alerting-dto';
|
import { AlertDataQuery, AlertQuery } from 'app/types/unified-alerting-dto';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { RefreshEvent } from '@grafana/runtime';
|
|||||||
import { PanelChrome } from '@grafana/ui';
|
import { PanelChrome } from '@grafana/ui';
|
||||||
import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel';
|
import { applyPanelTimeOverrides } from 'app/features/dashboard/utils/panel';
|
||||||
import { PanelRenderer } from 'app/features/panel/components/PanelRenderer';
|
import { PanelRenderer } from 'app/features/panel/components/PanelRenderer';
|
||||||
import { PanelOptions } from 'app/plugins/panel/table/models.gen';
|
import { PanelOptions } from 'app/plugins/panel/table/panelcfg.gen';
|
||||||
|
|
||||||
import PanelHeaderCorner from '../../dashgrid/PanelHeader/PanelHeaderCorner';
|
import PanelHeaderCorner from '../../dashgrid/PanelHeader/PanelHeaderCorner';
|
||||||
import { getTimeSrv } from '../../services/TimeSrv';
|
import { getTimeSrv } from '../../services/TimeSrv';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { VizPanel, VizPanelState } from '@grafana/scenes';
|
import { VizPanel, VizPanelState } from '@grafana/scenes';
|
||||||
import { GraphFieldConfig, TableFieldOptions } from '@grafana/schema';
|
import { GraphFieldConfig, TableFieldOptions } from '@grafana/schema';
|
||||||
import { PanelOptions as BarGaugePanelOptions } from 'app/plugins/panel/bargauge/panelcfg.gen';
|
import { PanelOptions as BarGaugePanelOptions } from 'app/plugins/panel/bargauge/panelcfg.gen';
|
||||||
import { PanelOptions as TablePanelOptions } from 'app/plugins/panel/table/models.gen';
|
import { PanelOptions as TablePanelOptions } from 'app/plugins/panel/table/panelcfg.gen';
|
||||||
import { TimeSeriesOptions } from 'app/plugins/panel/timeseries/types';
|
import { TimeSeriesOptions } from 'app/plugins/panel/timeseries/types';
|
||||||
|
|
||||||
export type TypedVizPanelState<TOptions, TFieldConfig> = Omit<
|
export type TypedVizPanelState<TOptions, TFieldConfig> = Omit<
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
var skipPlugins = map[string]bool{
|
var skipPlugins = map[string]bool{
|
||||||
"canvas": true,
|
"canvas": true,
|
||||||
"candlestick": true,
|
"candlestick": true,
|
||||||
"table": true,
|
|
||||||
"timeseries": true,
|
"timeseries": true,
|
||||||
"influxdb": true, // plugin.json fails validation (defaultMatchFormat)
|
"influxdb": true, // plugin.json fails validation (defaultMatchFormat)
|
||||||
"mixed": true, // plugin.json fails validation (mixed)
|
"mixed": true, // plugin.json fails validation (mixed)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Select, Table, usePanelContext, useTheme2 } from '@grafana/ui';
|
|||||||
import { TableSortByFieldState } from '@grafana/ui/src/components/Table/types';
|
import { TableSortByFieldState } from '@grafana/ui/src/components/Table/types';
|
||||||
import { OPTIONAL_ROW_NUMBER_COLUMN_WIDTH } from '@grafana/ui/src/components/Table/utils';
|
import { OPTIONAL_ROW_NUMBER_COLUMN_WIDTH } from '@grafana/ui/src/components/Table/utils';
|
||||||
|
|
||||||
import { PanelOptions } from './models.gen';
|
import { PanelOptions } from './panelcfg.gen';
|
||||||
|
|
||||||
interface Props extends PanelProps<PanelOptions> {}
|
interface Props extends PanelProps<PanelOptions> {}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { ReduceTransformerOptions } from '@grafana/data/src/transformations/transformers/reduce';
|
import { ReduceTransformerOptions } from '@grafana/data/src/transformations/transformers/reduce';
|
||||||
|
|
||||||
import { PanelOptions } from './models.gen';
|
import { PanelOptions } from './panelcfg.gen';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* At 7.0, the `table` panel was swapped from an angular implementation to a react one.
|
* At 7.0, the `table` panel was swapped from an angular implementation to a react one.
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// NOTE: This file will be auto generated from models.cue
|
|
||||||
// It is currenty hand written but will serve as the target for cuetsy
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
import { TableCellDisplayMode, TableSortByFieldState, TableFooterCalc } from '@grafana/ui';
|
|
||||||
import { TableFieldOptions } from '@grafana/schema';
|
|
||||||
|
|
||||||
// Only the latest schema version is translated to TypeScript, on the premise
|
|
||||||
// that either the dashboard loading process, or (eventually) CUE-defined
|
|
||||||
// migrations ensure that bulk of the frontend application only ever
|
|
||||||
// need directly consider the most recent version of the schema.
|
|
||||||
export const modelVersion = Object.freeze([1, 0]);
|
|
||||||
|
|
||||||
export interface PanelOptions {
|
|
||||||
frameIndex: number;
|
|
||||||
showHeader: boolean;
|
|
||||||
showRowNums?: boolean;
|
|
||||||
showTypeIcons?: boolean;
|
|
||||||
sortBy?: TableSortByFieldState[];
|
|
||||||
footer?: TableFooterCalc; // TODO: should be array (options builder is limited)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const defaultPanelOptions: PanelOptions = {
|
|
||||||
frameIndex: 0,
|
|
||||||
showHeader: true,
|
|
||||||
showRowNums: false,
|
|
||||||
showTypeIcons: false,
|
|
||||||
footer: {
|
|
||||||
show: false,
|
|
||||||
reducer: [],
|
|
||||||
countRows: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const defaultPanelFieldConfig: TableFieldOptions = {
|
|
||||||
align: 'auto',
|
|
||||||
cellOptions: {
|
|
||||||
type: TableCellDisplayMode.Auto,
|
|
||||||
},
|
|
||||||
inspect: false,
|
|
||||||
};
|
|
||||||
@@ -7,13 +7,13 @@ import {
|
|||||||
standardEditorsRegistry,
|
standardEditorsRegistry,
|
||||||
identityOverrideProcessor,
|
identityOverrideProcessor,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { TableFieldOptions, TableCellOptions, TableCellDisplayMode } from '@grafana/schema';
|
import { TableFieldOptions, TableCellOptions, TableCellDisplayMode, defaultTableFieldOptions } from '@grafana/schema';
|
||||||
|
|
||||||
import { PaginationEditor } from './PaginationEditor';
|
import { PaginationEditor } from './PaginationEditor';
|
||||||
import { TableCellOptionEditor } from './TableCellOptionEditor';
|
import { TableCellOptionEditor } from './TableCellOptionEditor';
|
||||||
import { TablePanel } from './TablePanel';
|
import { TablePanel } from './TablePanel';
|
||||||
import { tableMigrationHandler, tablePanelChangedHandler } from './migrations';
|
import { tableMigrationHandler, tablePanelChangedHandler } from './migrations';
|
||||||
import { PanelOptions, defaultPanelOptions, defaultPanelFieldConfig } from './models.gen';
|
import { PanelOptions, defaultPanelOptions } from './panelcfg.gen';
|
||||||
import { TableSuggestionsSupplier } from './suggestions';
|
import { TableSuggestionsSupplier } from './suggestions';
|
||||||
|
|
||||||
const footerCategory = 'Table footer';
|
const footerCategory = 'Table footer';
|
||||||
@@ -35,7 +35,7 @@ export const plugin = new PanelPlugin<PanelOptions, TableFieldOptions>(TablePane
|
|||||||
max: 500,
|
max: 500,
|
||||||
},
|
},
|
||||||
shouldApply: () => true,
|
shouldApply: () => true,
|
||||||
defaultValue: defaultPanelFieldConfig.minWidth,
|
defaultValue: defaultTableFieldOptions.minWidth,
|
||||||
})
|
})
|
||||||
.addNumberInput({
|
.addNumberInput({
|
||||||
path: 'width',
|
path: 'width',
|
||||||
@@ -46,7 +46,7 @@ export const plugin = new PanelPlugin<PanelOptions, TableFieldOptions>(TablePane
|
|||||||
max: 300,
|
max: 300,
|
||||||
},
|
},
|
||||||
shouldApply: () => true,
|
shouldApply: () => true,
|
||||||
defaultValue: defaultPanelFieldConfig.width,
|
defaultValue: defaultTableFieldOptions.width,
|
||||||
})
|
})
|
||||||
.addRadio({
|
.addRadio({
|
||||||
path: 'align',
|
path: 'align',
|
||||||
@@ -59,7 +59,7 @@ export const plugin = new PanelPlugin<PanelOptions, TableFieldOptions>(TablePane
|
|||||||
{ label: 'right', value: 'right' },
|
{ label: 'right', value: 'right' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
defaultValue: defaultPanelFieldConfig.align,
|
defaultValue: defaultTableFieldOptions.align,
|
||||||
})
|
})
|
||||||
.addCustomEditor<void, TableCellOptions>({
|
.addCustomEditor<void, TableCellOptions>({
|
||||||
id: 'cellOptions',
|
id: 'cellOptions',
|
||||||
@@ -67,7 +67,7 @@ export const plugin = new PanelPlugin<PanelOptions, TableFieldOptions>(TablePane
|
|||||||
name: 'Cell Type',
|
name: 'Cell Type',
|
||||||
editor: TableCellOptionEditor,
|
editor: TableCellOptionEditor,
|
||||||
override: TableCellOptionEditor,
|
override: TableCellOptionEditor,
|
||||||
defaultValue: defaultPanelFieldConfig.cellOptions,
|
defaultValue: defaultTableFieldOptions.cellOptions,
|
||||||
process: identityOverrideProcessor,
|
process: identityOverrideProcessor,
|
||||||
category: cellCategory,
|
category: cellCategory,
|
||||||
shouldApply: () => true,
|
shouldApply: () => true,
|
||||||
@@ -91,7 +91,7 @@ export const plugin = new PanelPlugin<PanelOptions, TableFieldOptions>(TablePane
|
|||||||
path: 'filterable',
|
path: 'filterable',
|
||||||
name: 'Column filter',
|
name: 'Column filter',
|
||||||
description: 'Enables/disables field filters in table',
|
description: 'Enables/disables field filters in table',
|
||||||
defaultValue: defaultPanelFieldConfig.filterable,
|
defaultValue: defaultTableFieldOptions.filterable,
|
||||||
})
|
})
|
||||||
.addBooleanSwitch({
|
.addBooleanSwitch({
|
||||||
path: 'hidden',
|
path: 'hidden',
|
||||||
|
|||||||
@@ -15,23 +15,37 @@
|
|||||||
package grafanaplugin
|
package grafanaplugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/grafana/grafana/packages/grafana-schema/src/common"
|
ui "github.com/grafana/grafana/packages/grafana-schema/src/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
composableKinds: PanelCfg: {
|
composableKinds: PanelCfg: {
|
||||||
|
maturity: "experimental"
|
||||||
lineage: {
|
lineage: {
|
||||||
seqs: [
|
seqs: [
|
||||||
{
|
{
|
||||||
schemas: [
|
schemas: [
|
||||||
{
|
{
|
||||||
PanelOptions: {
|
PanelOptions: {
|
||||||
|
// Represents the index of the selected frame
|
||||||
frameIndex: number | *0
|
frameIndex: number | *0
|
||||||
|
// Controls whether the panel should show the header
|
||||||
showHeader: bool | *true
|
showHeader: bool | *true
|
||||||
showTypeIcons: bool | *false
|
// Controls whether the columns should be numbered
|
||||||
showRowNums?: bool | *false
|
showRowNums?: bool | *false
|
||||||
sortBy?: [...common.TableSortByFieldState]
|
// Controls whether the header should show icons for the column types
|
||||||
|
showTypeIcons?: bool | *false
|
||||||
|
// Used to control row sorting
|
||||||
|
sortBy?: [...ui.TableSortByFieldState]
|
||||||
|
// Controls footer options
|
||||||
|
footer?: ui.TableFooterOptions | *{
|
||||||
|
// Controls whether the footer should be shown
|
||||||
|
show: false
|
||||||
|
// Controls whether the footer should show the total number of rows on Count calculation
|
||||||
|
countRows: false
|
||||||
|
// Represents the selected calculations
|
||||||
|
reducer: []
|
||||||
|
}
|
||||||
} @cuetsy(kind="interface")
|
} @cuetsy(kind="interface")
|
||||||
PanelFieldConfig: common.TableFieldOptions & {} @cuetsy(kind="interface")
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
62
public/app/plugins/panel/table/panelcfg.gen.ts
Normal file
62
public/app/plugins/panel/table/panelcfg.gen.ts
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||||
|
//
|
||||||
|
// Generated by:
|
||||||
|
// public/app/plugins/gen.go
|
||||||
|
// Using jennies:
|
||||||
|
// TSTypesJenny
|
||||||
|
// PluginTSTypesJenny
|
||||||
|
//
|
||||||
|
// Run 'make gen-cue' from repository root to regenerate.
|
||||||
|
|
||||||
|
import * as ui from '@grafana/schema';
|
||||||
|
|
||||||
|
export const PanelCfgModelVersion = Object.freeze([0, 0]);
|
||||||
|
|
||||||
|
export interface PanelOptions {
|
||||||
|
/**
|
||||||
|
* Controls footer options
|
||||||
|
*/
|
||||||
|
footer?: ui.TableFooterOptions;
|
||||||
|
/**
|
||||||
|
* Represents the index of the selected frame
|
||||||
|
*/
|
||||||
|
frameIndex: number;
|
||||||
|
/**
|
||||||
|
* Controls whether the panel should show the header
|
||||||
|
*/
|
||||||
|
showHeader: boolean;
|
||||||
|
/**
|
||||||
|
* Controls whether the columns should be numbered
|
||||||
|
*/
|
||||||
|
showRowNums?: boolean;
|
||||||
|
/**
|
||||||
|
* Controls whether the header should show icons for the column types
|
||||||
|
*/
|
||||||
|
showTypeIcons?: boolean;
|
||||||
|
/**
|
||||||
|
* Used to control row sorting
|
||||||
|
*/
|
||||||
|
sortBy?: Array<ui.TableSortByFieldState>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultPanelOptions: Partial<PanelOptions> = {
|
||||||
|
footer: {
|
||||||
|
/**
|
||||||
|
* Controls whether the footer should be shown
|
||||||
|
*/
|
||||||
|
show: false,
|
||||||
|
/**
|
||||||
|
* Controls whether the footer should show the total number of rows on Count calculation
|
||||||
|
*/
|
||||||
|
countRows: false,
|
||||||
|
/**
|
||||||
|
* Represents the selected calculations
|
||||||
|
*/
|
||||||
|
reducer: [],
|
||||||
|
},
|
||||||
|
frameIndex: 0,
|
||||||
|
showHeader: true,
|
||||||
|
showRowNums: false,
|
||||||
|
showTypeIcons: false,
|
||||||
|
sortBy: [],
|
||||||
|
};
|
||||||
@@ -3,11 +3,6 @@
|
|||||||
"name": "Table",
|
"name": "Table",
|
||||||
"id": "table",
|
"id": "table",
|
||||||
|
|
||||||
"models": {
|
|
||||||
"version": [1, 0],
|
|
||||||
"changed": "2021/03/30"
|
|
||||||
},
|
|
||||||
|
|
||||||
"info": {
|
"info": {
|
||||||
"description": "Supports many column styles",
|
"description": "Supports many column styles",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { VisualizationSuggestionsBuilder } from '@grafana/data';
|
|||||||
import { TableFieldOptions } from '@grafana/schema';
|
import { TableFieldOptions } from '@grafana/schema';
|
||||||
import { SuggestionName } from 'app/types/suggestions';
|
import { SuggestionName } from 'app/types/suggestions';
|
||||||
|
|
||||||
import { PanelOptions } from './models.gen';
|
import { PanelOptions } from './panelcfg.gen';
|
||||||
|
|
||||||
export class TableSuggestionsSupplier {
|
export class TableSuggestionsSupplier {
|
||||||
getSuggestionsForData(builder: VisualizationSuggestionsBuilder) {
|
getSuggestionsForData(builder: VisualizationSuggestionsBuilder) {
|
||||||
|
|||||||
Reference in New Issue
Block a user