forked from opensearch-project/dashboards-flow-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterfaces.ts
104 lines (86 loc) · 2.08 KB
/
interfaces.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { Node, Edge } from 'reactflow';
import { IComponentData } from '../public/component_types';
export type Index = {
name: string;
health: 'green' | 'yellow' | 'red';
};
/**
********** REACTFLOW TYPES/INTERFACES **********
*/
export type ReactFlowComponent = Node<IComponentData>;
// TODO: we may not need this re-defined type here at all, if we don't add
// any special fields/configuration for an edge. Currently this
// is the same as the default Edge type.
export type ReactFlowEdge = Edge<{}> & {};
type ReactFlowViewport = {
x: number;
y: number;
zoom: number;
};
export type WorkspaceFlowState = {
nodes: ReactFlowComponent[];
edges: ReactFlowEdge[];
viewport?: ReactFlowViewport;
};
/**
********** USE CASE TEMPLATE TYPES/INTERFACES **********
*/
export type TemplateNode = {
id: string;
inputs: {};
};
export type TemplateEdge = {
source: string;
target: string;
};
export type TemplateFlow = {
userParams: {};
nodes: TemplateNode[];
edges: TemplateEdge[];
};
export type TemplateFlows = {
provision: TemplateFlow;
ingest: TemplateFlow;
query: TemplateFlow;
};
export type UseCaseTemplate = {
type: string;
name: string;
description: string;
userInputs: {};
workflows: TemplateFlows;
};
export type Workflow = {
id: string;
name: string;
description?: string;
// ReactFlow state may not exist if a workflow is created via API/backend-only.
workspaceFlowState?: WorkspaceFlowState;
template: UseCaseTemplate;
lastUpdated: number;
state: WORKFLOW_STATE;
};
export enum USE_CASE {
SEMANTIC_SEARCH = 'semantic_search',
CUSTOM = 'custom',
}
/**
********** MISC TYPES/INTERFACES ************
*/
// TODO: finalize how we have the launch data model
export type WorkflowLaunch = {
id: string;
state: WORKFLOW_STATE;
lastUpdated: number;
};
// TODO: finalize list of possible workflow states from backend
export enum WORKFLOW_STATE {
SUCCEEDED = 'Succeeded',
FAILED = 'Failed',
IN_PROGRESS = 'In progress',
NOT_STARTED = 'Not started',
}