* Move away from lib/workpad_service * Adds stubs * Fix types. Swap fetching zip to workpad service * Fix types Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
101 lines
2.1 KiB
TypeScript
101 lines
2.1 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* 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.
|
|
*/
|
|
|
|
import { KibanaContext } from 'src/plugins/data/common';
|
|
import {
|
|
Datatable,
|
|
ExpressionValueFilter,
|
|
ExpressionImage,
|
|
ExpressionFunction,
|
|
PointSeries,
|
|
Render,
|
|
Style,
|
|
Range,
|
|
} from 'src/plugins/expressions';
|
|
import { AssetType } from './assets';
|
|
import { CanvasWorkpad } from './canvas';
|
|
|
|
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;
|
|
}
|
|
|
|
interface StoreAppState {
|
|
basePath: string;
|
|
serverFunctions: ExpressionFunction[];
|
|
ready: boolean;
|
|
}
|
|
|
|
interface ElementStatsType {
|
|
total: number;
|
|
ready: number;
|
|
pending: number;
|
|
error: number;
|
|
}
|
|
|
|
type ExpressionType =
|
|
| Datatable
|
|
| ExpressionValueFilter
|
|
| ExpressionImage
|
|
| KibanaContext
|
|
| PointSeries
|
|
| Style
|
|
| Range;
|
|
|
|
export interface ExpressionRenderable {
|
|
state: 'ready' | 'pending';
|
|
value: Render<ExpressionType> | null;
|
|
error: null;
|
|
}
|
|
|
|
export interface ExpressionContext {
|
|
state: 'ready' | 'pending';
|
|
value: ExpressionType;
|
|
error: null;
|
|
}
|
|
|
|
export interface ResolvedArgType {
|
|
expressionRenderable?: ExpressionRenderable;
|
|
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;
|
|
assets: { [assetKey: string]: AssetType };
|
|
transient: TransientState;
|
|
persistent: PersistentState;
|
|
}
|