2019-07-10 17:02:35 +02:00
|
|
|
/*
|
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
2021-02-04 03:12:39 +01:00
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
|
|
* 2.0.
|
2019-07-10 17:02:35 +02:00
|
|
|
*/
|
2019-11-19 01:26:13 +01:00
|
|
|
|
2020-11-09 21:01:22 +01:00
|
|
|
import { KibanaContext } from 'src/plugins/data/common';
|
2019-09-09 20:11:20 +02:00
|
|
|
import {
|
2021-10-07 20:34:36 +02:00
|
|
|
AnyExpressionFunctionDefinition,
|
2019-09-09 20:11:20 +02:00
|
|
|
Datatable,
|
2020-05-04 18:39:09 +02:00
|
|
|
ExpressionValueFilter,
|
2019-09-09 20:11:20 +02:00
|
|
|
ExpressionImage,
|
|
|
|
PointSeries,
|
|
|
|
Render,
|
|
|
|
Style,
|
|
|
|
Range,
|
2020-02-11 19:47:36 +01:00
|
|
|
} from 'src/plugins/expressions';
|
2021-09-09 10:37:18 +02:00
|
|
|
import { Datasource, Model, Transform, View } from '../public/expression_types';
|
2019-09-09 20:11:20 +02:00
|
|
|
import { AssetType } from './assets';
|
|
|
|
import { CanvasWorkpad } from './canvas';
|
2019-07-10 17:02:35 +02:00
|
|
|
|
|
|
|
export enum AppStateKeys {
|
|
|
|
FULLSCREEN = '__fullscreen',
|
|
|
|
REFRESH_INTERVAL = '__refreshInterval',
|
|
|
|
AUTOPLAY_INTERVAL = '__autoplayInterval',
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface AppState {
|
|
|
|
[AppStateKeys.FULLSCREEN]?: boolean;
|
|
|
|
[AppStateKeys.REFRESH_INTERVAL]?: string;
|
|
|
|
[AppStateKeys.AUTOPLAY_INTERVAL]?: string;
|
|
|
|
}
|
2019-09-09 20:11:20 +02:00
|
|
|
|
|
|
|
interface StoreAppState {
|
|
|
|
basePath: string;
|
2021-10-07 20:34:36 +02:00
|
|
|
serverFunctions: AnyExpressionFunctionDefinition[];
|
2019-09-09 20:11:20 +02:00
|
|
|
ready: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ElementStatsType {
|
|
|
|
total: number;
|
|
|
|
ready: number;
|
|
|
|
pending: number;
|
|
|
|
error: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ExpressionType =
|
|
|
|
| Datatable
|
2020-05-04 18:39:09 +02:00
|
|
|
| ExpressionValueFilter
|
2019-09-09 20:11:20 +02:00
|
|
|
| ExpressionImage
|
|
|
|
| KibanaContext
|
|
|
|
| PointSeries
|
|
|
|
| Style
|
2021-09-09 10:37:18 +02:00
|
|
|
| Range
|
|
|
|
| View
|
|
|
|
| Model
|
|
|
|
| Datasource
|
|
|
|
| Transform;
|
2019-09-09 20:11:20 +02:00
|
|
|
|
2021-01-31 15:37:58 +01:00
|
|
|
export interface ExpressionRenderable {
|
2019-09-09 20:11:20 +02:00
|
|
|
state: 'ready' | 'pending';
|
|
|
|
value: Render<ExpressionType> | null;
|
|
|
|
error: null;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface ExpressionContext {
|
2021-09-09 10:37:18 +02:00
|
|
|
state: 'ready' | 'pending' | 'error';
|
2019-09-09 20:11:20 +02:00
|
|
|
value: ExpressionType;
|
2021-09-09 10:37:18 +02:00
|
|
|
error: null | string;
|
2019-09-09 20:11:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ResolvedArgType {
|
2019-10-11 19:15:41 +02:00
|
|
|
expressionRenderable?: ExpressionRenderable;
|
2019-09-09 20:11:20 +02:00
|
|
|
expressionContext: ExpressionContext;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface TransientState {
|
|
|
|
canUserWrite: boolean;
|
|
|
|
zoomScale: number;
|
|
|
|
elementStats: ElementStatsType;
|
|
|
|
fullScreen: boolean;
|
|
|
|
selectedTopLevelNodes: string[];
|
|
|
|
resolvedArgs: { [key: string]: ResolvedArgType | undefined };
|
|
|
|
refresh: {
|
|
|
|
interval: number;
|
|
|
|
};
|
|
|
|
autoplay: {
|
|
|
|
enabled: boolean;
|
|
|
|
interval: number;
|
|
|
|
};
|
|
|
|
inFlight: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface PersistentState {
|
|
|
|
schemaVersion: number;
|
|
|
|
workpad: CanvasWorkpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface State {
|
|
|
|
app: StoreAppState;
|
2021-07-06 17:25:34 +02:00
|
|
|
assets: { [assetKey: string]: AssetType };
|
2019-09-09 20:11:20 +02:00
|
|
|
transient: TransientState;
|
|
|
|
persistent: PersistentState;
|
|
|
|
}
|