@operato/flow 9.0.0 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/src/api/tasks.d.ts +7 -0
- package/dist/src/api/tasks.js +2517 -0
- package/dist/src/api/tasks.js.map +1 -0
- package/dist/src/base/anchor-instance.d.ts +30 -0
- package/dist/src/base/anchor-instance.js +82 -0
- package/dist/src/base/anchor-instance.js.map +1 -0
- package/dist/src/base/flow-edge-instance.d.ts +31 -0
- package/dist/src/base/flow-edge-instance.js +170 -0
- package/dist/src/base/flow-edge-instance.js.map +1 -0
- package/dist/src/base/flow-node-abstract.d.ts +49 -0
- package/dist/src/base/flow-node-abstract.js +199 -0
- package/dist/src/base/flow-node-abstract.js.map +1 -0
- package/dist/src/components/flow-debug-panel.d.ts +22 -0
- package/dist/src/components/flow-debug-panel.js +156 -0
- package/dist/src/components/flow-debug-panel.js.map +1 -0
- package/dist/src/components/flow-executor.d.ts +29 -0
- package/dist/src/components/flow-executor.js +88 -0
- package/dist/src/components/flow-executor.js.map +1 -0
- package/dist/src/components/flow-options-builder.d.ts +18 -0
- package/dist/src/components/flow-options-builder.js +145 -0
- package/dist/src/components/flow-options-builder.js.map +1 -0
- package/dist/src/components/flow-properties-panel.d.ts +22 -0
- package/dist/src/components/flow-properties-panel.js +232 -0
- package/dist/src/components/flow-properties-panel.js.map +1 -0
- package/dist/src/components/flow-side-panel.d.ts +9 -0
- package/dist/src/components/flow-side-panel.js +83 -0
- package/dist/src/components/flow-side-panel.js.map +1 -0
- package/dist/src/components/flow-sidebar.d.ts +7 -0
- package/dist/src/components/flow-sidebar.js +84 -0
- package/dist/src/components/flow-sidebar.js.map +1 -0
- package/dist/src/components/flow-toolbar.d.ts +15 -0
- package/dist/src/components/flow-toolbar.js +161 -0
- package/dist/src/components/flow-toolbar.js.map +1 -0
- package/dist/src/components/property-editor.d.ts +35 -0
- package/dist/src/components/property-editor.js +78 -0
- package/dist/src/components/property-editor.js.map +1 -0
- package/dist/src/components/property-panel/data-mapper-popup.d.ts +11 -0
- package/dist/src/components/property-panel/data-mapper-popup.js +86 -0
- package/dist/src/components/property-panel/data-mapper-popup.js.map +1 -0
- package/dist/src/components/property-panel/task-selection-popup.d.ts +10 -0
- package/dist/src/components/property-panel/task-selection-popup.js +106 -0
- package/dist/src/components/property-panel/task-selection-popup.js.map +1 -0
- package/dist/src/context/flow-context.d.ts +21 -0
- package/dist/src/context/flow-context.js +3 -0
- package/dist/src/context/flow-context.js.map +1 -0
- package/dist/src/context/flow-debug-context.d.ts +16 -0
- package/dist/src/context/flow-debug-context.js +3 -0
- package/dist/src/context/flow-debug-context.js.map +1 -0
- package/dist/src/context/flow-edit-context.d.ts +11 -0
- package/dist/src/context/flow-edit-context.js +3 -0
- package/dist/src/context/flow-edit-context.js.map +1 -0
- package/dist/src/handlers/dnd-event-handler.d.ts +9 -0
- package/dist/src/handlers/dnd-event-handler.js +41 -0
- package/dist/src/handlers/dnd-event-handler.js.map +1 -0
- package/dist/src/handlers/flow-event-handler.d.ts +20 -0
- package/dist/src/handlers/flow-event-handler.js +75 -0
- package/dist/src/handlers/flow-event-handler.js.map +1 -0
- package/dist/src/handlers/keydown-event-handler.d.ts +6 -0
- package/dist/src/handlers/keydown-event-handler.js +24 -0
- package/dist/src/handlers/keydown-event-handler.js.map +1 -0
- package/dist/src/handlers/pointer-event-handler.d.ts +9 -0
- package/dist/src/handlers/pointer-event-handler.js +118 -0
- package/dist/src/handlers/pointer-event-handler.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/nodes/decision.d.ts +16 -0
- package/dist/src/nodes/decision.js +43 -0
- package/dist/src/nodes/decision.js.map +1 -0
- package/dist/src/nodes/end-event.d.ts +14 -0
- package/dist/src/nodes/end-event.js +47 -0
- package/dist/src/nodes/end-event.js.map +1 -0
- package/dist/src/nodes/index.d.ts +5 -0
- package/dist/src/nodes/index.js +19 -0
- package/dist/src/nodes/index.js.map +1 -0
- package/dist/src/nodes/intermediate-event.d.ts +14 -0
- package/dist/src/nodes/intermediate-event.js +52 -0
- package/dist/src/nodes/intermediate-event.js.map +1 -0
- package/dist/src/nodes/iterator.d.ts +12 -0
- package/dist/src/nodes/iterator.js +29 -0
- package/dist/src/nodes/iterator.js.map +1 -0
- package/dist/src/nodes/select.d.ts +17 -0
- package/dist/src/nodes/select.js +71 -0
- package/dist/src/nodes/select.js.map +1 -0
- package/dist/src/nodes/start-event.d.ts +15 -0
- package/dist/src/nodes/start-event.js +46 -0
- package/dist/src/nodes/start-event.js.map +1 -0
- package/dist/src/nodes/subflow.d.ts +12 -0
- package/dist/src/nodes/subflow.js +30 -0
- package/dist/src/nodes/subflow.js.map +1 -0
- package/dist/src/nodes/task.d.ts +17 -0
- package/dist/src/nodes/task.js +60 -0
- package/dist/src/nodes/task.js.map +1 -0
- package/dist/src/ox-flow-editor.d.ts +94 -0
- package/dist/src/ox-flow-editor.js +426 -0
- package/dist/src/ox-flow-editor.js.map +1 -0
- package/dist/src/ox-flow-monitor.d.ts +24 -0
- package/dist/src/ox-flow-monitor.js +117 -0
- package/dist/src/ox-flow-monitor.js.map +1 -0
- package/dist/src/property-editors/ox-input-anchors.d.ts +12 -0
- package/dist/src/property-editors/ox-input-anchors.js +163 -0
- package/dist/src/property-editors/ox-input-anchors.js.map +1 -0
- package/dist/src/property-editors/ox-property-editor-anchors.d.ts +6 -0
- package/dist/src/property-editors/ox-property-editor-anchors.js +25 -0
- package/dist/src/property-editors/ox-property-editor-anchors.js.map +1 -0
- package/dist/src/types.d.ts +97 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/generate-mapping-scheme.d.ts +6 -0
- package/dist/src/utils/generate-mapping-scheme.js +50 -0
- package/dist/src/utils/generate-mapping-scheme.js.map +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import './components/flow-sidebar.js';
|
|
4
|
+
import './components/flow-toolbar.js';
|
|
5
|
+
import './components/flow-side-panel.js';
|
|
6
|
+
import { LitElement, html, svg, css, nothing } from 'lit';
|
|
7
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
|
+
import dagre from 'dagre-esm';
|
|
9
|
+
import { provide } from '@lit/context';
|
|
10
|
+
import { OxPopup } from '@operato/popup';
|
|
11
|
+
import { FlowExecutor } from './components/flow-executor.js';
|
|
12
|
+
import { flowContext } from './context/flow-context.js';
|
|
13
|
+
import { flowDebugContext } from './context/flow-debug-context.js';
|
|
14
|
+
import { flowEditContext } from './context/flow-edit-context.js';
|
|
15
|
+
import { FlowNodeAbstract } from './base/flow-node-abstract.js';
|
|
16
|
+
import { FlowEdgeInstance } from './base/flow-edge-instance.js';
|
|
17
|
+
import { PointerEventHandler } from './handlers/pointer-event-handler.js';
|
|
18
|
+
import { KeydownEventHandler } from './handlers/keydown-event-handler.js';
|
|
19
|
+
import { DndEventHandler } from './handlers/dnd-event-handler.js';
|
|
20
|
+
import { TaskTypes } from './api/tasks.js';
|
|
21
|
+
let OxFlowEditor = class OxFlowEditor extends LitElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.availableNodeTypes = {};
|
|
25
|
+
this.model = { nodes: [], edges: [] };
|
|
26
|
+
this.mode = 'edit';
|
|
27
|
+
this.logs = [];
|
|
28
|
+
this.edgeGuide = null;
|
|
29
|
+
this._nodes = [];
|
|
30
|
+
this._edges = [];
|
|
31
|
+
this._selected = null;
|
|
32
|
+
this.pointerEventHandler = new PointerEventHandler(this);
|
|
33
|
+
this.keydownEventHandler = new KeydownEventHandler(this);
|
|
34
|
+
this.dndEventHandler = new DndEventHandler(this);
|
|
35
|
+
this.flowContext = {
|
|
36
|
+
nodes: this.nodes,
|
|
37
|
+
edges: this.edges,
|
|
38
|
+
mode: this.mode,
|
|
39
|
+
setMode: mode => this.setMode(mode),
|
|
40
|
+
addLog: log => this.addLog(log),
|
|
41
|
+
logs: this.logs,
|
|
42
|
+
availableNodeTypes: this.availableNodeTypes || {},
|
|
43
|
+
setAvailableNodeTypes: (availableNodeTypes) => this.setAvailableNodeTypes(availableNodeTypes),
|
|
44
|
+
selected: this.selected,
|
|
45
|
+
getTaskTypes() {
|
|
46
|
+
return TaskTypes;
|
|
47
|
+
},
|
|
48
|
+
getTaskType(taskType) {
|
|
49
|
+
return TaskTypes.find(type => type.name == taskType);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.flowEditContext = {
|
|
53
|
+
runLayout: () => this.runLayout(),
|
|
54
|
+
updateEntity: (entity, model) => {
|
|
55
|
+
entity.update(model);
|
|
56
|
+
this.requestUpdate();
|
|
57
|
+
},
|
|
58
|
+
updateOptions: (entity, options) => {
|
|
59
|
+
entity.updateOptions(options);
|
|
60
|
+
this.requestUpdate();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.flowDebugContext = {
|
|
64
|
+
executeFlow: () => this.executeFlow(),
|
|
65
|
+
pauseFlow: () => this.pauseFlow(),
|
|
66
|
+
stopFlow: () => this.stopFlow(),
|
|
67
|
+
stepOver: () => this.stepOver(),
|
|
68
|
+
stepInto: () => this.stepInto(),
|
|
69
|
+
stepOut: () => this.stepOut(),
|
|
70
|
+
continueExecution: () => this.continueExecution(),
|
|
71
|
+
setBreakpoint: nodeId => this.toggleBreakpoint(nodeId),
|
|
72
|
+
breakpoints: new Set(),
|
|
73
|
+
currentExecutionNode: null,
|
|
74
|
+
setCurrentExecutionNode: nodeId => this.setCurrentExecutionNode(nodeId)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static getUniqueId() {
|
|
78
|
+
return Math.random().toString(36).substring(2, 9);
|
|
79
|
+
}
|
|
80
|
+
/** 렌더링 */
|
|
81
|
+
render() {
|
|
82
|
+
return html `
|
|
83
|
+
<flow-sidebar></flow-sidebar>
|
|
84
|
+
|
|
85
|
+
<div class="editor">
|
|
86
|
+
<flow-toolbar></flow-toolbar>
|
|
87
|
+
|
|
88
|
+
<svg @dblclick=${this.onDblClick}>
|
|
89
|
+
${this.edges.map(edge => edge.render())}
|
|
90
|
+
${this.edgeGuide
|
|
91
|
+
? svg `<path d="M ${this.edgeGuide.fromX},${this.edgeGuide.fromY} L ${this.edgeGuide.toX},${this.edgeGuide.toY}"
|
|
92
|
+
stroke="#aaa" stroke-dasharray="5,5" stroke-width="2" fill="none"
|
|
93
|
+
/>`
|
|
94
|
+
: nothing}
|
|
95
|
+
${this.nodes.map(node => node.render())}
|
|
96
|
+
</svg>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<flow-side-panel></flow-side-panel>
|
|
100
|
+
`;
|
|
101
|
+
}
|
|
102
|
+
connectedCallback() {
|
|
103
|
+
super.connectedCallback();
|
|
104
|
+
this.pointerEventHandler.addEventListeners();
|
|
105
|
+
this.keydownEventHandler.addEventListeners();
|
|
106
|
+
this.dndEventHandler.addEventListeners();
|
|
107
|
+
this.flowContext = {
|
|
108
|
+
...this.flowContext,
|
|
109
|
+
availableNodeTypes: this.availableNodeTypes
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
disconnectedCallback() {
|
|
113
|
+
super.disconnectedCallback();
|
|
114
|
+
this.keydownEventHandler.removeEventListeners();
|
|
115
|
+
this.pointerEventHandler.removeEventListeners();
|
|
116
|
+
this.dndEventHandler.removeEventListeners();
|
|
117
|
+
}
|
|
118
|
+
updated(changes) {
|
|
119
|
+
if (changes.has('model')) {
|
|
120
|
+
const { edges = [], nodes = [] } = this.model;
|
|
121
|
+
this._nodes = nodes
|
|
122
|
+
.map(node => {
|
|
123
|
+
const clazz = this.availableNodeTypes[node.type];
|
|
124
|
+
if (clazz) {
|
|
125
|
+
return new clazz(node);
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
.filter(Boolean);
|
|
129
|
+
this._edges = edges
|
|
130
|
+
.map(edge => {
|
|
131
|
+
const { from, to } = edge;
|
|
132
|
+
const fromNode = this._nodes.find(node => node.id == from.nodeId);
|
|
133
|
+
const toNode = this._nodes.find(node => node.id == to.nodeId);
|
|
134
|
+
const fromAnchor = fromNode === null || fromNode === void 0 ? void 0 : fromNode.findAnchor(from.anchorId);
|
|
135
|
+
const toAnchor = toNode === null || toNode === void 0 ? void 0 : toNode.findAnchor(to.anchorId);
|
|
136
|
+
if (fromAnchor && toAnchor) {
|
|
137
|
+
return new FlowEdgeInstance(edge, fromNode, toNode);
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.filter(Boolean);
|
|
141
|
+
this.flowContext = {
|
|
142
|
+
...this.flowContext,
|
|
143
|
+
nodes: this._nodes,
|
|
144
|
+
edges: this._edges
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
setAvailableNodeTypes(availableNodeTypes) {
|
|
149
|
+
this.availableNodeTypes = availableNodeTypes;
|
|
150
|
+
this.flowContext = {
|
|
151
|
+
...this.flowContext,
|
|
152
|
+
availableNodeTypes
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
get context() {
|
|
156
|
+
return this.flowContext;
|
|
157
|
+
}
|
|
158
|
+
getModel() {
|
|
159
|
+
return {
|
|
160
|
+
nodes: this.nodes.map(node => {
|
|
161
|
+
const { id, label, type, pos, size, options } = node;
|
|
162
|
+
return { id, label, type, pos, size, options };
|
|
163
|
+
}),
|
|
164
|
+
edges: this.edges.map(edge => {
|
|
165
|
+
const { id, label, from, to, weight } = edge;
|
|
166
|
+
return { id, label, from, to, weight };
|
|
167
|
+
})
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
get nodes() {
|
|
171
|
+
return this._nodes;
|
|
172
|
+
}
|
|
173
|
+
set nodes(nodes) {
|
|
174
|
+
this._nodes = nodes;
|
|
175
|
+
}
|
|
176
|
+
get edges() {
|
|
177
|
+
return this._edges;
|
|
178
|
+
}
|
|
179
|
+
set edges(edges) {
|
|
180
|
+
this._edges = edges;
|
|
181
|
+
}
|
|
182
|
+
get selected() {
|
|
183
|
+
return this._selected;
|
|
184
|
+
}
|
|
185
|
+
updateFlowContext(partial) {
|
|
186
|
+
this.flowContext = {
|
|
187
|
+
...this.flowContext,
|
|
188
|
+
...partial
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
set selected(selected) {
|
|
192
|
+
this._selected = selected;
|
|
193
|
+
this.nodes.forEach(node => (node.selected = node.id == (selected === null || selected === void 0 ? void 0 : selected.id)));
|
|
194
|
+
this.edges.forEach(edge => (edge.selected = edge.id == (selected === null || selected === void 0 ? void 0 : selected.id)));
|
|
195
|
+
this.updateFlowContext({ selected });
|
|
196
|
+
}
|
|
197
|
+
addFlowNode(node, withSelect = true) {
|
|
198
|
+
this.nodes = [...this.nodes, node];
|
|
199
|
+
if (withSelect) {
|
|
200
|
+
this.selected = node;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
addFlowEdge(edge, withSelect = true) {
|
|
204
|
+
this.edges = [...this.edges, edge];
|
|
205
|
+
if (withSelect) {
|
|
206
|
+
this.selected = edge;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
drawEdgeGuide(edgeGuide) {
|
|
210
|
+
this.edgeGuide = edgeGuide;
|
|
211
|
+
this.requestUpdate();
|
|
212
|
+
}
|
|
213
|
+
/** 노드 삭제 */
|
|
214
|
+
deleteEntity(target) {
|
|
215
|
+
this.nodes = this.nodes.filter(node => node.id !== target.id);
|
|
216
|
+
this.edges = this.edges.filter(edge => edge.id !== target.id && edge.from.nodeId !== target.id && edge.to.nodeId !== target.id);
|
|
217
|
+
this.selected = null;
|
|
218
|
+
}
|
|
219
|
+
setMode(mode) {
|
|
220
|
+
this.mode = mode;
|
|
221
|
+
this.flowContext = {
|
|
222
|
+
...this.flowContext,
|
|
223
|
+
mode
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** 플로우 실행 */
|
|
227
|
+
executeFlow() {
|
|
228
|
+
if (!this.flowExecutor) {
|
|
229
|
+
this.flowExecutor = new FlowExecutor(this.nodes, this.edges);
|
|
230
|
+
}
|
|
231
|
+
this.flowExecutor.run();
|
|
232
|
+
this.addLog('Flow execution started.');
|
|
233
|
+
}
|
|
234
|
+
/** 플로우 일시정지 */
|
|
235
|
+
pauseFlow() {
|
|
236
|
+
var _a;
|
|
237
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.pause();
|
|
238
|
+
this.addLog('Flow execution paused.');
|
|
239
|
+
}
|
|
240
|
+
/** 플로우 정지 */
|
|
241
|
+
stopFlow() {
|
|
242
|
+
var _a;
|
|
243
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.stop();
|
|
244
|
+
this.addLog('Flow execution stopped.');
|
|
245
|
+
}
|
|
246
|
+
stepOver() {
|
|
247
|
+
var _a;
|
|
248
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.stepOver();
|
|
249
|
+
this.addLog('Flow execution stepOver');
|
|
250
|
+
}
|
|
251
|
+
stepInto() {
|
|
252
|
+
var _a;
|
|
253
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.stepInto();
|
|
254
|
+
this.addLog('Flow execution stepInto');
|
|
255
|
+
}
|
|
256
|
+
stepOut() {
|
|
257
|
+
var _a;
|
|
258
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.stepOut();
|
|
259
|
+
this.addLog('Flow execution stepOut');
|
|
260
|
+
}
|
|
261
|
+
continueExecution() {
|
|
262
|
+
var _a;
|
|
263
|
+
(_a = this.flowExecutor) === null || _a === void 0 ? void 0 : _a.continueExecution();
|
|
264
|
+
this.addLog('Flow execution continueExecution');
|
|
265
|
+
}
|
|
266
|
+
onNodeUpdated(updatedNode) {
|
|
267
|
+
this.nodes = this.nodes.map(node => (node.id === updatedNode.id ? updatedNode : node));
|
|
268
|
+
this.requestUpdate();
|
|
269
|
+
}
|
|
270
|
+
addLog(log) {
|
|
271
|
+
this.logs = [...this.logs, log];
|
|
272
|
+
}
|
|
273
|
+
toggleBreakpoint(nodeId) {
|
|
274
|
+
if (this.flowDebugContext.breakpoints.has(nodeId)) {
|
|
275
|
+
this.flowDebugContext.breakpoints.delete(nodeId);
|
|
276
|
+
this.addLog(`Breakpoint removed from ${nodeId}`);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.flowDebugContext.breakpoints.add(nodeId);
|
|
280
|
+
this.addLog(`Breakpoint added to ${nodeId}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
setCurrentExecutionNode(nodeId) {
|
|
284
|
+
this.flowDebugContext.currentExecutionNode = nodeId;
|
|
285
|
+
this.requestUpdate();
|
|
286
|
+
}
|
|
287
|
+
runLayout() {
|
|
288
|
+
const g = new dagre.graphlib.Graph();
|
|
289
|
+
g.setGraph({ rankdir: 'TB', nodesep: 20, ranksep: 100 });
|
|
290
|
+
g.setDefaultEdgeLabel(() => ({}));
|
|
291
|
+
this.nodes.forEach(node => {
|
|
292
|
+
g.setNode(node.id, { width: 120, height: 40 });
|
|
293
|
+
});
|
|
294
|
+
/* 밸런스 배치를 위한 소팅 */
|
|
295
|
+
this.edges = this.edges.sort((a, b) => { var _a, _b; return ((_a = a.weight) !== null && _a !== void 0 ? _a : 0) - ((_b = b.weight) !== null && _b !== void 0 ? _b : 0); });
|
|
296
|
+
this.edges.forEach(edge => {
|
|
297
|
+
g.setEdge(edge.from.nodeId, edge.to.nodeId, { weight: edge.weight });
|
|
298
|
+
});
|
|
299
|
+
dagre.layout(g);
|
|
300
|
+
const offsetX = 200;
|
|
301
|
+
const offsetY = 100;
|
|
302
|
+
g.nodes().forEach((nodeId) => {
|
|
303
|
+
const node = this.nodes.find(n => n.id === nodeId);
|
|
304
|
+
const nodeData = g.node(nodeId);
|
|
305
|
+
if (node && nodeData) {
|
|
306
|
+
node.pos = { x: nodeData.x + offsetX, y: nodeData.y + offsetY };
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
this.requestUpdate();
|
|
310
|
+
}
|
|
311
|
+
onDblClick(e) {
|
|
312
|
+
const edgeElement = e.target.closest('.edge');
|
|
313
|
+
if (!edgeElement) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const id = edgeElement.dataset.id;
|
|
317
|
+
const edge = this.edges.find(edge => edge.id == id);
|
|
318
|
+
if (!edge) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const popup = OxPopup.open({
|
|
322
|
+
template: html `
|
|
323
|
+
<data-mapper-popup
|
|
324
|
+
.nodes=${this.flowContext.nodes}
|
|
325
|
+
.edge=${edge}
|
|
326
|
+
@change=${(e) => {
|
|
327
|
+
e.stopPropagation();
|
|
328
|
+
const model = { dataMappings: e.detail };
|
|
329
|
+
this.flowEditContext.updateEntity(edge, model);
|
|
330
|
+
popup.close();
|
|
331
|
+
this.requestUpdate();
|
|
332
|
+
}}
|
|
333
|
+
></data-mapper-popup>
|
|
334
|
+
`,
|
|
335
|
+
style: 'width: 80vw; height: 80vh;',
|
|
336
|
+
preventCloseOnBlur: true,
|
|
337
|
+
backdrop: true
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
OxFlowEditor.styles = [
|
|
342
|
+
css `
|
|
343
|
+
:host {
|
|
344
|
+
display: flex;
|
|
345
|
+
position: relative;
|
|
346
|
+
width: 100%;
|
|
347
|
+
height: 100%;
|
|
348
|
+
box-sizing: border-box;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
flow-sidebar {
|
|
352
|
+
position: absolute;
|
|
353
|
+
left: 0;
|
|
354
|
+
top: 0;
|
|
355
|
+
margin: 10px;
|
|
356
|
+
background-color: #f0f0f0;
|
|
357
|
+
border-right: 1px solid #ccc;
|
|
358
|
+
border-radius: 6px;
|
|
359
|
+
z-index: 1;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
flow-toolbar {
|
|
363
|
+
position: absolute;
|
|
364
|
+
display: flex;
|
|
365
|
+
flex-direction: column;
|
|
366
|
+
top: 10px;
|
|
367
|
+
gap: 10px;
|
|
368
|
+
right: 10px;
|
|
369
|
+
z-index: 1;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.editor {
|
|
373
|
+
flex: 1;
|
|
374
|
+
position: relative;
|
|
375
|
+
background-color: #f9f9f9;
|
|
376
|
+
overflow: hidden;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
svg {
|
|
380
|
+
width: 100%;
|
|
381
|
+
height: 100%;
|
|
382
|
+
background-image: radial-gradient(circle, #ccc 1px, transparent 1px);
|
|
383
|
+
background-size: 20px 20px;
|
|
384
|
+
}
|
|
385
|
+
`,
|
|
386
|
+
FlowNodeAbstract.styles,
|
|
387
|
+
FlowEdgeInstance.styles
|
|
388
|
+
];
|
|
389
|
+
__decorate([
|
|
390
|
+
property({ type: Object })
|
|
391
|
+
], OxFlowEditor.prototype, "availableNodeTypes", void 0);
|
|
392
|
+
__decorate([
|
|
393
|
+
property({ type: Object })
|
|
394
|
+
], OxFlowEditor.prototype, "model", void 0);
|
|
395
|
+
__decorate([
|
|
396
|
+
state()
|
|
397
|
+
], OxFlowEditor.prototype, "mode", void 0);
|
|
398
|
+
__decorate([
|
|
399
|
+
state()
|
|
400
|
+
], OxFlowEditor.prototype, "logs", void 0);
|
|
401
|
+
__decorate([
|
|
402
|
+
state()
|
|
403
|
+
], OxFlowEditor.prototype, "edgeGuide", void 0);
|
|
404
|
+
__decorate([
|
|
405
|
+
state()
|
|
406
|
+
], OxFlowEditor.prototype, "_nodes", void 0);
|
|
407
|
+
__decorate([
|
|
408
|
+
state()
|
|
409
|
+
], OxFlowEditor.prototype, "_edges", void 0);
|
|
410
|
+
__decorate([
|
|
411
|
+
state()
|
|
412
|
+
], OxFlowEditor.prototype, "_selected", void 0);
|
|
413
|
+
__decorate([
|
|
414
|
+
provide({ context: flowContext })
|
|
415
|
+
], OxFlowEditor.prototype, "flowContext", void 0);
|
|
416
|
+
__decorate([
|
|
417
|
+
provide({ context: flowEditContext })
|
|
418
|
+
], OxFlowEditor.prototype, "flowEditContext", void 0);
|
|
419
|
+
__decorate([
|
|
420
|
+
provide({ context: flowDebugContext })
|
|
421
|
+
], OxFlowEditor.prototype, "flowDebugContext", void 0);
|
|
422
|
+
OxFlowEditor = __decorate([
|
|
423
|
+
customElement('ox-flow-editor')
|
|
424
|
+
], OxFlowEditor);
|
|
425
|
+
export { OxFlowEditor };
|
|
426
|
+
//# sourceMappingURL=ox-flow-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-flow-editor.js","sourceRoot":"","sources":["../../src/ox-flow-editor.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAY5D,OAAO,EAAE,WAAW,EAAmB,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,gBAAgB,EAAwB,MAAM,iCAAiC,CAAA;AACxF,OAAO,EAAE,eAAe,EAAuB,MAAM,gCAAgC,CAAA;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAE/D,OAAO,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K,EAAE;+CAA4C;AAO5C;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;iDAkBjC;AAGO;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;qDAarC;AAGO;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;sDActC;AAhIU,YAAY;IADxB,aAAa,CAAC,gBAAgB,CAAC;GACnB,YAAY,CA0bxB","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport './components/flow-sidebar.js'\nimport './components/flow-toolbar.js'\nimport './components/flow-side-panel.js'\n\nimport { LitElement, html, svg, css, PropertyValues, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport dagre from 'dagre-esm'\nimport { provide } from '@lit/context'\nimport { OxPopup } from '@operato/popup'\n\nimport { FlowExecutor } from './components/flow-executor.js'\nimport {\n FlowNodeImplementation,\n FlowNode,\n FlowEdge,\n EditorMode,\n FlowNodeModel,\n FlowEdgeModel,\n FlowEntity,\n FlowEntityModel,\n TaskType\n} from './types.js'\nimport { flowContext, FlowContextType } from './context/flow-context.js'\nimport { flowDebugContext, FlowDebugContextType } from './context/flow-debug-context.js'\nimport { flowEditContext, FlowEditContextType } from './context/flow-edit-context.js'\nimport { FlowNodeAbstract } from './base/flow-node-abstract.js'\nimport { FlowEdgeInstance } from './base/flow-edge-instance.js'\n\nimport { PointerEventHandler } from './handlers/pointer-event-handler.js'\nimport { KeydownEventHandler } from './handlers/keydown-event-handler.js'\nimport { DndEventHandler } from './handlers/dnd-event-handler.js'\n\nimport { TaskTypes } from './api/tasks.js'\nimport { Task } from './nodes/task.js'\n\n@customElement('ox-flow-editor')\nexport class OxFlowEditor extends LitElement {\n static styles = [\n css`\n :host {\n display: flex;\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n }\n\n flow-sidebar {\n position: absolute;\n left: 0;\n top: 0;\n margin: 10px;\n background-color: #f0f0f0;\n border-right: 1px solid #ccc;\n border-radius: 6px;\n z-index: 1;\n }\n\n flow-toolbar {\n position: absolute;\n display: flex;\n flex-direction: column;\n top: 10px;\n gap: 10px;\n right: 10px;\n z-index: 1;\n }\n\n .editor {\n flex: 1;\n position: relative;\n background-color: #f9f9f9;\n overflow: hidden;\n }\n\n svg {\n width: 100%;\n height: 100%;\n background-image: radial-gradient(circle, #ccc 1px, transparent 1px);\n background-size: 20px 20px;\n }\n `,\n FlowNodeAbstract.styles,\n FlowEdgeInstance.styles\n ]\n\n static getUniqueId() {\n return Math.random().toString(36).substring(2, 9)\n }\n\n @property({ type: Object }) availableNodeTypes: { [type: string]: FlowNodeImplementation } = {}\n @property({ type: Object }) model: { nodes: FlowNodeModel[]; edges: FlowEdgeModel[] } = { nodes: [], edges: [] }\n\n @state() private mode: EditorMode = 'edit'\n @state() private logs: string[] = []\n @state() private edgeGuide: {\n fromX: number\n fromY: number\n toX: number\n toY: number\n weight?: number\n label?: string\n } | null = null\n\n private flowExecutor?: FlowExecutor\n\n @state() private _nodes: FlowNode[] = []\n @state() private _edges: FlowEdge[] = []\n\n @state() private _selected: FlowEntity | null = null\n\n private pointerEventHandler = new PointerEventHandler(this)\n private keydownEventHandler = new KeydownEventHandler(this)\n private dndEventHandler = new DndEventHandler(this)\n\n @provide({ context: flowContext })\n private flowContext: FlowContextType = {\n nodes: this.nodes,\n edges: this.edges,\n mode: this.mode,\n setMode: mode => this.setMode(mode),\n addLog: log => this.addLog(log),\n logs: this.logs,\n availableNodeTypes: this.availableNodeTypes || {},\n setAvailableNodeTypes: (availableNodeTypes: { [type: string]: FlowNodeImplementation }) =>\n this.setAvailableNodeTypes(availableNodeTypes),\n selected: this.selected,\n getTaskTypes(): TaskType[] {\n return TaskTypes\n },\n getTaskType(taskType: string): TaskType {\n return TaskTypes.find(type => type.name == taskType)!\n }\n }\n\n @provide({ context: flowEditContext })\n private flowEditContext: FlowEditContextType = {\n runLayout: () => this.runLayout(),\n\n updateEntity: (entity: FlowEntity, model: Partial<FlowEntityModel>) => {\n entity.update(model)\n this.requestUpdate()\n },\n\n updateOptions: (entity: FlowEntity, options: { [key: string]: any }) => {\n entity.updateOptions(options)\n this.requestUpdate()\n }\n }\n\n @provide({ context: flowDebugContext })\n private flowDebugContext: FlowDebugContextType = {\n executeFlow: () => this.executeFlow(),\n pauseFlow: () => this.pauseFlow(),\n stopFlow: () => this.stopFlow(),\n stepOver: () => this.stepOver(),\n stepInto: () => this.stepInto(),\n stepOut: () => this.stepOut(),\n continueExecution: () => this.continueExecution(),\n\n setBreakpoint: nodeId => this.toggleBreakpoint(nodeId),\n breakpoints: new Set(),\n currentExecutionNode: null,\n setCurrentExecutionNode: nodeId => this.setCurrentExecutionNode(nodeId)\n }\n\n /** 렌더링 */\n render() {\n return html`\n <flow-sidebar></flow-sidebar>\n\n <div class=\"editor\">\n <flow-toolbar></flow-toolbar>\n\n <svg @dblclick=${this.onDblClick}>\n ${this.edges.map(edge => edge.render())}\n ${this.edgeGuide\n ? svg`<path d=\"M ${this.edgeGuide.fromX},${this.edgeGuide.fromY} L ${this.edgeGuide.toX},${this.edgeGuide.toY}\"\n stroke=\"#aaa\" stroke-dasharray=\"5,5\" stroke-width=\"2\" fill=\"none\" \n />`\n : nothing}\n ${this.nodes.map(node => node.render())}\n </svg>\n </div>\n\n <flow-side-panel></flow-side-panel>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.pointerEventHandler.addEventListeners()\n this.keydownEventHandler.addEventListeners()\n this.dndEventHandler.addEventListeners()\n\n this.flowContext = {\n ...this.flowContext,\n availableNodeTypes: this.availableNodeTypes\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.keydownEventHandler.removeEventListeners()\n this.pointerEventHandler.removeEventListeners()\n this.dndEventHandler.removeEventListeners()\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('model')) {\n const { edges = [], nodes = [] } = this.model\n\n this._nodes = nodes\n .map(node => {\n const clazz = this.availableNodeTypes[node.type]\n\n if (clazz) {\n return new clazz(node)\n }\n })\n .filter(Boolean) as FlowNode[]\n\n this._edges = edges\n .map(edge => {\n const { from, to } = edge\n const fromNode = this._nodes.find(node => node.id == from.nodeId)\n const toNode = this._nodes.find(node => node.id == to.nodeId)\n const fromAnchor = fromNode?.findAnchor(from.anchorId)\n const toAnchor = toNode?.findAnchor(to.anchorId)\n\n if (fromAnchor && toAnchor) {\n return new FlowEdgeInstance(edge, fromNode!, toNode!)\n }\n })\n .filter(Boolean) as FlowEdge[]\n\n this.flowContext = {\n ...this.flowContext,\n nodes: this._nodes,\n edges: this._edges\n }\n }\n }\n\n setAvailableNodeTypes(availableNodeTypes: { [type: string]: FlowNodeImplementation }) {\n this.availableNodeTypes = availableNodeTypes\n\n this.flowContext = {\n ...this.flowContext,\n availableNodeTypes\n }\n }\n\n get context() {\n return this.flowContext\n }\n\n getModel() {\n return {\n nodes: this.nodes.map(node => {\n const { id, label, type, pos, size, options } = node\n return { id, label, type, pos, size, options }\n }),\n edges: this.edges.map(edge => {\n const { id, label, from, to, weight } = edge\n return { id, label, from, to, weight }\n })\n }\n }\n\n get nodes() {\n return this._nodes\n }\n\n set nodes(nodes) {\n this._nodes = nodes\n }\n\n get edges() {\n return this._edges\n }\n\n set edges(edges) {\n this._edges = edges\n }\n\n get selected(): FlowEntity | null {\n return this._selected\n }\n\n updateFlowContext(partial: Partial<FlowContextType>) {\n this.flowContext = {\n ...this.flowContext,\n ...partial\n }\n }\n\n set selected(selected: FlowEntity | null) {\n this._selected = selected\n\n this.nodes.forEach(node => (node.selected = node.id == selected?.id))\n this.edges.forEach(edge => (edge.selected = edge.id == selected?.id))\n\n this.updateFlowContext({ selected })\n }\n\n addFlowNode(node: FlowNode, withSelect: boolean = true) {\n this.nodes = [...this.nodes, node]\n if (withSelect) {\n this.selected = node\n }\n }\n\n addFlowEdge(edge: FlowEdge, withSelect: boolean = true) {\n this.edges = [...this.edges, edge]\n if (withSelect) {\n this.selected = edge\n }\n }\n\n drawEdgeGuide(edgeGuide: any) {\n this.edgeGuide = edgeGuide\n this.requestUpdate()\n }\n\n /** 노드 삭제 */\n public deleteEntity(target: FlowEntity) {\n this.nodes = this.nodes.filter(node => node.id !== target.id)\n this.edges = this.edges.filter(\n edge => edge.id !== target.id && edge.from.nodeId !== target.id && edge.to.nodeId !== target.id\n )\n\n this.selected = null\n }\n\n private setMode(mode: EditorMode) {\n this.mode = mode\n\n this.flowContext = {\n ...this.flowContext,\n mode\n }\n }\n\n /** 플로우 실행 */\n private executeFlow() {\n if (!this.flowExecutor) {\n this.flowExecutor = new FlowExecutor(this.nodes, this.edges)\n }\n this.flowExecutor.run()\n this.addLog('Flow execution started.')\n }\n\n /** 플로우 일시정지 */\n private pauseFlow() {\n this.flowExecutor?.pause()\n this.addLog('Flow execution paused.')\n }\n\n /** 플로우 정지 */\n private stopFlow() {\n this.flowExecutor?.stop()\n this.addLog('Flow execution stopped.')\n }\n\n private stepOver() {\n this.flowExecutor?.stepOver()\n this.addLog('Flow execution stepOver')\n }\n\n private stepInto() {\n this.flowExecutor?.stepInto()\n this.addLog('Flow execution stepInto')\n }\n\n private stepOut() {\n this.flowExecutor?.stepOut()\n this.addLog('Flow execution stepOut')\n }\n\n private continueExecution() {\n this.flowExecutor?.continueExecution()\n this.addLog('Flow execution continueExecution')\n }\n\n public onNodeUpdated(updatedNode: FlowNode) {\n this.nodes = this.nodes.map(node => (node.id === updatedNode.id ? updatedNode : node))\n this.requestUpdate()\n }\n\n public addLog(log: string) {\n this.logs = [...this.logs, log]\n }\n\n private toggleBreakpoint(nodeId: string) {\n if (this.flowDebugContext.breakpoints.has(nodeId)) {\n this.flowDebugContext.breakpoints.delete(nodeId)\n this.addLog(`Breakpoint removed from ${nodeId}`)\n } else {\n this.flowDebugContext.breakpoints.add(nodeId)\n this.addLog(`Breakpoint added to ${nodeId}`)\n }\n }\n\n private setCurrentExecutionNode(nodeId: string | null) {\n this.flowDebugContext.currentExecutionNode = nodeId\n this.requestUpdate()\n }\n\n private runLayout() {\n const g = new dagre.graphlib.Graph()\n\n g.setGraph({ rankdir: 'TB', nodesep: 20, ranksep: 100 })\n g.setDefaultEdgeLabel(() => ({}))\n\n this.nodes.forEach(node => {\n g.setNode(node.id, { width: 120, height: 40 })\n })\n\n /* 밸런스 배치를 위한 소팅 */\n this.edges = this.edges.sort((a, b) => (a.weight ?? 0) - (b.weight ?? 0))\n\n this.edges.forEach(edge => {\n g.setEdge(edge.from.nodeId, edge.to.nodeId, { weight: edge.weight })\n })\n\n dagre.layout(g)\n\n const offsetX = 200\n const offsetY = 100\n\n g.nodes().forEach((nodeId: string) => {\n const node = this.nodes.find(n => n.id === nodeId)\n const nodeData = g.node(nodeId)\n if (node && nodeData) {\n node.pos = { x: nodeData.x + offsetX, y: nodeData.y + offsetY }\n }\n })\n\n this.requestUpdate()\n }\n\n private onDblClick(e: PointerEvent) {\n const edgeElement = (e.target as HTMLElement).closest('.edge') as HTMLElement\n if (!edgeElement) {\n return\n }\n\n const id = edgeElement.dataset.id\n const edge = this.edges.find(edge => edge!.id == id)\n\n if (!edge) {\n return\n }\n\n const popup = OxPopup.open({\n template: html`\n <data-mapper-popup\n .nodes=${this.flowContext.nodes}\n .edge=${edge}\n @change=${(e: CustomEvent) => {\n e.stopPropagation()\n const model: Partial<FlowEdgeModel> = { dataMappings: e.detail }\n this.flowEditContext!.updateEntity(edge, model)\n\n popup.close()\n\n this.requestUpdate()\n }}\n ></data-mapper-popup>\n `,\n style: 'width: 80vw; height: 80vh;',\n preventCloseOnBlur: true,\n backdrop: true\n })\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
interface NodeExecutionStatus {
|
|
3
|
+
nodeId: string;
|
|
4
|
+
status: 'idle' | 'running' | 'success' | 'error';
|
|
5
|
+
logs: string[];
|
|
6
|
+
}
|
|
7
|
+
interface EdgeExecutionStatus {
|
|
8
|
+
edgeId: string;
|
|
9
|
+
status: 'active' | 'inactive';
|
|
10
|
+
}
|
|
11
|
+
export declare class OxFlowMonitor extends LitElement {
|
|
12
|
+
static styles: import("lit").CSSResult;
|
|
13
|
+
/** 실행 상태 */
|
|
14
|
+
nodeStatuses: NodeExecutionStatus[];
|
|
15
|
+
edgeStatuses: EdgeExecutionStatus[];
|
|
16
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
17
|
+
/** 노드 상태 렌더링 */
|
|
18
|
+
private renderNodeStatus;
|
|
19
|
+
/** 외부에서 실행 상태 업데이트 */
|
|
20
|
+
updateNodeStatus(nodeId: string, status: NodeExecutionStatus['status'], log?: string): void;
|
|
21
|
+
/** 엣지 활성화 상태 업데이트 */
|
|
22
|
+
updateEdgeStatus(edgeId: string, status: EdgeExecutionStatus['status']): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { LitElement, html, css } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
let OxFlowMonitor = class OxFlowMonitor extends LitElement {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
/** 실행 상태 */
|
|
8
|
+
this.nodeStatuses = [];
|
|
9
|
+
this.edgeStatuses = [];
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
return html `
|
|
13
|
+
<div class="monitor-header">Flow Execution Monitor</div>
|
|
14
|
+
<div class="execution-list">${this.nodeStatuses.map(status => this.renderNodeStatus(status))}</div>
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
/** 노드 상태 렌더링 */
|
|
18
|
+
renderNodeStatus(status) {
|
|
19
|
+
return html `
|
|
20
|
+
<div class="node-status ${status.status}">
|
|
21
|
+
<strong>Node: ${status.nodeId}</strong> — <em>${status.status}</em>
|
|
22
|
+
${status.logs.map(log => html `<div class="log">${log}</div>`)}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
/** 외부에서 실행 상태 업데이트 */
|
|
27
|
+
updateNodeStatus(nodeId, status, log) {
|
|
28
|
+
const index = this.nodeStatuses.findIndex(s => s.nodeId === nodeId);
|
|
29
|
+
if (index !== -1) {
|
|
30
|
+
const updatedStatus = { ...this.nodeStatuses[index] };
|
|
31
|
+
updatedStatus.status = status;
|
|
32
|
+
if (log)
|
|
33
|
+
updatedStatus.logs.push(log);
|
|
34
|
+
this.nodeStatuses = [...this.nodeStatuses.slice(0, index), updatedStatus, ...this.nodeStatuses.slice(index + 1)];
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.nodeStatuses = [...this.nodeStatuses, { nodeId, status, logs: log ? [log] : [] }];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** 엣지 활성화 상태 업데이트 */
|
|
41
|
+
updateEdgeStatus(edgeId, status) {
|
|
42
|
+
const index = this.edgeStatuses.findIndex(e => e.edgeId === edgeId);
|
|
43
|
+
if (index !== -1) {
|
|
44
|
+
const updatedEdge = { ...this.edgeStatuses[index], status };
|
|
45
|
+
this.edgeStatuses = [...this.edgeStatuses.slice(0, index), updatedEdge, ...this.edgeStatuses.slice(index + 1)];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.edgeStatuses = [...this.edgeStatuses, { edgeId, status }];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
OxFlowMonitor.styles = css `
|
|
53
|
+
:host {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
border: 1px solid #ccc;
|
|
59
|
+
font-family: Arial, sans-serif;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.monitor-header {
|
|
63
|
+
padding: 10px;
|
|
64
|
+
background-color: #f0f0f0;
|
|
65
|
+
border-bottom: 1px solid #ddd;
|
|
66
|
+
font-weight: bold;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.execution-list {
|
|
70
|
+
flex: 1;
|
|
71
|
+
overflow: auto;
|
|
72
|
+
padding: 10px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.node-status {
|
|
76
|
+
padding: 8px;
|
|
77
|
+
border: 1px solid #ddd;
|
|
78
|
+
border-radius: 4px;
|
|
79
|
+
margin-bottom: 8px;
|
|
80
|
+
background-color: #fff;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.node-status.running {
|
|
84
|
+
border-color: #007acc;
|
|
85
|
+
background-color: #e3f2fd;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.node-status.success {
|
|
89
|
+
border-color: #4caf50;
|
|
90
|
+
background-color: #e8f5e9;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.node-status.error {
|
|
94
|
+
border-color: #f44336;
|
|
95
|
+
background-color: #ffebee;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.log {
|
|
99
|
+
font-size: 12px;
|
|
100
|
+
background-color: #f9f9f9;
|
|
101
|
+
padding: 5px;
|
|
102
|
+
border-radius: 3px;
|
|
103
|
+
margin-top: 5px;
|
|
104
|
+
white-space: pre-wrap;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Array })
|
|
109
|
+
], OxFlowMonitor.prototype, "nodeStatuses", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: Array })
|
|
112
|
+
], OxFlowMonitor.prototype, "edgeStatuses", void 0);
|
|
113
|
+
OxFlowMonitor = __decorate([
|
|
114
|
+
customElement('ox-flow-monitor')
|
|
115
|
+
], OxFlowMonitor);
|
|
116
|
+
export { OxFlowMonitor };
|
|
117
|
+
//# sourceMappingURL=ox-flow-monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ox-flow-monitor.js","sourceRoot":"","sources":["../../src/ox-flow-monitor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE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;mDAAyC;AACxC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAAyC;AA3DxD,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAqGzB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { provide, consume } from '@lit/context'\n\ninterface NodeExecutionStatus {\n nodeId: string\n status: 'idle' | 'running' | 'success' | 'error'\n logs: string[]\n}\n\ninterface EdgeExecutionStatus {\n edgeId: string\n status: 'active' | 'inactive'\n}\n\n@customElement('ox-flow-monitor')\nexport class OxFlowMonitor extends LitElement {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n border: 1px solid #ccc;\n font-family: Arial, sans-serif;\n }\n\n .monitor-header {\n padding: 10px;\n background-color: #f0f0f0;\n border-bottom: 1px solid #ddd;\n font-weight: bold;\n }\n\n .execution-list {\n flex: 1;\n overflow: auto;\n padding: 10px;\n }\n\n .node-status {\n padding: 8px;\n border: 1px solid #ddd;\n border-radius: 4px;\n margin-bottom: 8px;\n background-color: #fff;\n }\n\n .node-status.running {\n border-color: #007acc;\n background-color: #e3f2fd;\n }\n\n .node-status.success {\n border-color: #4caf50;\n background-color: #e8f5e9;\n }\n\n .node-status.error {\n border-color: #f44336;\n background-color: #ffebee;\n }\n\n .log {\n font-size: 12px;\n background-color: #f9f9f9;\n padding: 5px;\n border-radius: 3px;\n margin-top: 5px;\n white-space: pre-wrap;\n }\n `\n\n /** 실행 상태 */\n @property({ type: Array }) nodeStatuses: NodeExecutionStatus[] = []\n @property({ type: Array }) edgeStatuses: EdgeExecutionStatus[] = []\n\n render() {\n return html`\n <div class=\"monitor-header\">Flow Execution Monitor</div>\n <div class=\"execution-list\">${this.nodeStatuses.map(status => this.renderNodeStatus(status))}</div>\n `\n }\n\n /** 노드 상태 렌더링 */\n private renderNodeStatus(status: NodeExecutionStatus) {\n return html`\n <div class=\"node-status ${status.status}\">\n <strong>Node: ${status.nodeId}</strong> — <em>${status.status}</em>\n ${status.logs.map(log => html`<div class=\"log\">${log}</div>`)}\n </div>\n `\n }\n\n /** 외부에서 실행 상태 업데이트 */\n public updateNodeStatus(nodeId: string, status: NodeExecutionStatus['status'], log?: string) {\n const index = this.nodeStatuses.findIndex(s => s.nodeId === nodeId)\n if (index !== -1) {\n const updatedStatus = { ...this.nodeStatuses[index] }\n updatedStatus.status = status\n if (log) updatedStatus.logs.push(log)\n this.nodeStatuses = [...this.nodeStatuses.slice(0, index), updatedStatus, ...this.nodeStatuses.slice(index + 1)]\n } else {\n this.nodeStatuses = [...this.nodeStatuses, { nodeId, status, logs: log ? [log] : [] }]\n }\n }\n\n /** 엣지 활성화 상태 업데이트 */\n public updateEdgeStatus(edgeId: string, status: EdgeExecutionStatus['status']) {\n const index = this.edgeStatuses.findIndex(e => e.edgeId === edgeId)\n if (index !== -1) {\n const updatedEdge = { ...this.edgeStatuses[index], status }\n this.edgeStatuses = [...this.edgeStatuses.slice(0, index), updatedEdge, ...this.edgeStatuses.slice(index + 1)]\n } else {\n this.edgeStatuses = [...this.edgeStatuses, { edgeId, status }]\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import '@material/web/icon/icon.js';
|
|
5
|
+
import { OxFormField } from '@operato/input';
|
|
6
|
+
import { AnchorModel } from '../types';
|
|
7
|
+
export declare class OxInputAnchors extends OxFormField<AnchorModel[]> {
|
|
8
|
+
static styles: import("lit").CSSResult[];
|
|
9
|
+
value: AnchorModel[];
|
|
10
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
onClick(e: MouseEvent): void;
|
|
12
|
+
}
|