Frontend changes for library panels feature (#30653)

Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com>
This commit is contained in:
kay delaney
2021-02-25 10:26:28 +00:00
committed by GitHub
parent 0bb4cbdb68
commit 47d2a8085b
27 changed files with 1326 additions and 362 deletions

View File

@@ -36,6 +36,7 @@ import {
isStandardFieldProp,
restoreCustomOverrideRules,
} from './getPanelOptionsWithDefaults';
import { LibraryPanelDTO } from 'app/features/library-panels/state/api';
export interface GridPos {
x: number;
@@ -98,6 +99,7 @@ const mustKeepProps: { [str: string]: boolean } = {
maxDataPoints: true,
interval: true,
replaceVariables: true,
libraryPanel: true,
};
const defaults: any = {
@@ -149,6 +151,8 @@ export class PanelModel implements DataConfigSource {
links?: DataLink[];
transparent: boolean;
libraryPanel?: { uid: undefined; name: string } | Pick<LibraryPanelDTO, 'uid' | 'name' | 'meta'>;
// non persisted
isViewing: boolean;
isEditing: boolean;
@@ -531,6 +535,10 @@ function getPluginVersion(plugin: PanelPlugin): string {
return plugin && plugin.meta.info.version ? plugin.meta.info.version : config.buildInfo.version;
}
export function isLibraryPanel(panel: PanelModel): panel is PanelModel & Required<Pick<PanelModel, 'libraryPanel'>> {
return panel.libraryPanel !== undefined;
}
interface PanelOptionsCache {
properties: any;
fieldConfig: FieldConfigSource;