@things-factory/labeling 10.1.256 → 10.1.257
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/dist-client/pages/labeling-workflow-builder.d.ts +7 -10
- package/dist-client/pages/labeling-workflow-builder.js +91 -139
- package/dist-client/pages/labeling-workflow-builder.js.map +1 -1
- package/dist-client/pages/labeling-workflow-list.d.ts +9 -4
- package/dist-client/pages/labeling-workflow-list.js +72 -121
- package/dist-client/pages/labeling-workflow-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { PageView } from '@operato/shell';
|
|
2
|
-
/**
|
|
3
|
-
* Workflow Builder Page
|
|
4
|
-
*
|
|
5
|
-
* Generic workflow builder UI for creating and editing labeling workflows
|
|
6
|
-
*/
|
|
7
2
|
export declare class LabelingWorkflowBuilderPage extends PageView {
|
|
8
3
|
static styles: import("lit").CSSResult[];
|
|
9
4
|
workflowId?: string;
|
|
10
|
-
workflow: any;
|
|
11
5
|
selectedStepIndex: number;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
private workflowRead;
|
|
7
|
+
private updating;
|
|
8
|
+
private creating;
|
|
9
|
+
private draft;
|
|
10
|
+
get workflow(): any;
|
|
11
|
+
get loading(): boolean;
|
|
12
|
+
get error(): "" | "Failed to load workflow. Please try again." | "Failed to save workflow. Please check your inputs and try again.";
|
|
16
13
|
saveWorkflow(): Promise<void>;
|
|
17
14
|
addStep(): void;
|
|
18
15
|
removeStep(index: number): void;
|
|
@@ -12,21 +12,64 @@ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
|
12
12
|
*
|
|
13
13
|
* Generic workflow builder UI for creating and editing labeling workflows
|
|
14
14
|
*/
|
|
15
|
+
/** What a new workflow starts from. */
|
|
16
|
+
const NEW_WORKFLOW = {
|
|
17
|
+
name: '',
|
|
18
|
+
description: '',
|
|
19
|
+
projectId: null,
|
|
20
|
+
triggerType: 'manual',
|
|
21
|
+
triggerConfig: '',
|
|
22
|
+
steps: [],
|
|
23
|
+
autoStart: false
|
|
24
|
+
};
|
|
15
25
|
let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shell_1.PageView {
|
|
16
26
|
constructor() {
|
|
17
27
|
super(...arguments);
|
|
18
|
-
this.workflow = {
|
|
19
|
-
name: '',
|
|
20
|
-
description: '',
|
|
21
|
-
projectId: null,
|
|
22
|
-
triggerType: 'manual',
|
|
23
|
-
triggerConfig: '',
|
|
24
|
-
steps: [],
|
|
25
|
-
autoStart: false
|
|
26
|
-
};
|
|
27
28
|
this.selectedStepIndex = -1;
|
|
28
|
-
|
|
29
|
-
this.
|
|
29
|
+
/* The workflow being edited (ADR-0190). */
|
|
30
|
+
this.workflowRead = new graphql_1.QueryController(this, (0, graphql_tag_1.default) `
|
|
31
|
+
query GetWorkflow($workflowId: String!) {
|
|
32
|
+
labelingWorkflow(workflowId: $workflowId) {
|
|
33
|
+
id
|
|
34
|
+
name
|
|
35
|
+
description
|
|
36
|
+
projectId
|
|
37
|
+
triggerType
|
|
38
|
+
triggerConfig
|
|
39
|
+
steps {
|
|
40
|
+
name
|
|
41
|
+
type
|
|
42
|
+
order
|
|
43
|
+
config
|
|
44
|
+
continueOnError
|
|
45
|
+
}
|
|
46
|
+
status
|
|
47
|
+
autoStart
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`, { variables: () => (this.workflowId ? { workflowId: this.workflowId } : undefined) });
|
|
51
|
+
/* The form says a failed save itself. */
|
|
52
|
+
this.updating = new graphql_1.MutationController(this, (0, graphql_tag_1.default) `
|
|
53
|
+
mutation UpdateWorkflow($workflowId: String!, $input: UpdateWorkflowRequest!) {
|
|
54
|
+
updateLabelingWorkflow(workflowId: $workflowId, input: $input) {
|
|
55
|
+
id
|
|
56
|
+
name
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`, { showsError: true });
|
|
60
|
+
this.creating = new graphql_1.MutationController(this, (0, graphql_tag_1.default) `
|
|
61
|
+
mutation CreateWorkflow($input: CreateWorkflowRequest!) {
|
|
62
|
+
createLabelingWorkflow(input: $input) {
|
|
63
|
+
id
|
|
64
|
+
name
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`, { showsError: true });
|
|
68
|
+
/* The workflow as changed here over the one read, or a new one. */
|
|
69
|
+
this.draft = new shell_1.DraftController(this, {
|
|
70
|
+
read: () => this.workflowRead.data?.labelingWorkflow ?? NEW_WORKFLOW,
|
|
71
|
+
key: () => this.workflowId
|
|
72
|
+
});
|
|
30
73
|
}
|
|
31
74
|
static { this.styles = [
|
|
32
75
|
(0, lit_1.css) `
|
|
@@ -240,101 +283,40 @@ let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shel
|
|
|
240
283
|
}
|
|
241
284
|
`
|
|
242
285
|
]; }
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
await this.loadWorkflow();
|
|
246
|
-
}
|
|
286
|
+
get workflow() {
|
|
287
|
+
return { ...(this.workflowRead.data?.labelingWorkflow ?? NEW_WORKFLOW), ...this.draft.edits };
|
|
247
288
|
}
|
|
248
|
-
|
|
249
|
-
this.loading
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
name
|
|
258
|
-
description
|
|
259
|
-
projectId
|
|
260
|
-
triggerType
|
|
261
|
-
triggerConfig
|
|
262
|
-
steps {
|
|
263
|
-
name
|
|
264
|
-
type
|
|
265
|
-
order
|
|
266
|
-
config
|
|
267
|
-
continueOnError
|
|
268
|
-
}
|
|
269
|
-
status
|
|
270
|
-
autoStart
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
`,
|
|
274
|
-
variables: { workflowId: this.workflowId }
|
|
275
|
-
});
|
|
276
|
-
this.workflow = response.data.labelingWorkflow;
|
|
277
|
-
}
|
|
278
|
-
catch (error) {
|
|
279
|
-
console.error('Failed to load workflow:', error);
|
|
280
|
-
this.error = 'Failed to load workflow. Please try again.';
|
|
281
|
-
}
|
|
282
|
-
finally {
|
|
283
|
-
this.loading = false;
|
|
284
|
-
}
|
|
289
|
+
get loading() {
|
|
290
|
+
return this.workflowRead.loading || this.updating.pending || this.creating.pending;
|
|
291
|
+
}
|
|
292
|
+
get error() {
|
|
293
|
+
if (this.workflowRead.error)
|
|
294
|
+
return 'Failed to load workflow. Please try again.';
|
|
295
|
+
if (this.updating.error || this.creating.error)
|
|
296
|
+
return 'Failed to save workflow. Please check your inputs and try again.';
|
|
297
|
+
return '';
|
|
285
298
|
}
|
|
286
299
|
async saveWorkflow() {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const variables = {
|
|
308
|
-
input: {
|
|
309
|
-
name: this.workflow.name,
|
|
310
|
-
description: this.workflow.description,
|
|
311
|
-
projectId: parseInt(this.workflow.projectId),
|
|
312
|
-
triggerType: this.workflow.triggerType,
|
|
313
|
-
triggerConfig: this.workflow.triggerConfig,
|
|
314
|
-
steps: this.workflow.steps.map((step, index) => ({
|
|
315
|
-
name: step.name,
|
|
316
|
-
type: step.type,
|
|
317
|
-
order: index + 1,
|
|
318
|
-
config: step.config,
|
|
319
|
-
continueOnError: step.continueOnError || false
|
|
320
|
-
})),
|
|
321
|
-
autoStart: this.workflow.autoStart
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
if (this.workflowId) {
|
|
325
|
-
variables.workflowId = this.workflowId;
|
|
326
|
-
}
|
|
327
|
-
await graphql_1.client.mutate({ mutation, variables });
|
|
328
|
-
alert('Workflow saved successfully!');
|
|
329
|
-
history.back();
|
|
330
|
-
}
|
|
331
|
-
catch (error) {
|
|
332
|
-
console.error('Failed to save workflow:', error);
|
|
333
|
-
this.error = 'Failed to save workflow. Please check your inputs and try again.';
|
|
334
|
-
}
|
|
335
|
-
finally {
|
|
336
|
-
this.loading = false;
|
|
337
|
-
}
|
|
300
|
+
const input = {
|
|
301
|
+
name: this.workflow.name,
|
|
302
|
+
description: this.workflow.description,
|
|
303
|
+
projectId: parseInt(this.workflow.projectId),
|
|
304
|
+
triggerType: this.workflow.triggerType,
|
|
305
|
+
triggerConfig: this.workflow.triggerConfig,
|
|
306
|
+
steps: this.workflow.steps.map((step, index) => ({
|
|
307
|
+
name: step.name,
|
|
308
|
+
type: step.type,
|
|
309
|
+
order: index + 1,
|
|
310
|
+
config: step.config,
|
|
311
|
+
continueOnError: step.continueOnError || false
|
|
312
|
+
})),
|
|
313
|
+
autoStart: this.workflow.autoStart
|
|
314
|
+
};
|
|
315
|
+
const saved = await this.draft.submit(() => this.workflowId ? this.updating.run({ workflowId: this.workflowId, input }) : this.creating.run({ input }));
|
|
316
|
+
if (!saved)
|
|
317
|
+
return;
|
|
318
|
+
alert('Workflow saved successfully!');
|
|
319
|
+
history.back();
|
|
338
320
|
}
|
|
339
321
|
addStep() {
|
|
340
322
|
const newStep = {
|
|
@@ -343,20 +325,14 @@ let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shel
|
|
|
343
325
|
config: '{}',
|
|
344
326
|
continueOnError: false
|
|
345
327
|
};
|
|
346
|
-
this.workflow
|
|
347
|
-
...this.workflow,
|
|
348
|
-
steps: [...this.workflow.steps, newStep]
|
|
349
|
-
};
|
|
328
|
+
this.draft.set('steps', [...this.workflow.steps, newStep]);
|
|
350
329
|
this.selectedStepIndex = this.workflow.steps.length - 1;
|
|
351
330
|
}
|
|
352
331
|
removeStep(index) {
|
|
353
332
|
if (confirm('Are you sure you want to remove this step?')) {
|
|
354
333
|
const steps = [...this.workflow.steps];
|
|
355
334
|
steps.splice(index, 1);
|
|
356
|
-
this.
|
|
357
|
-
...this.workflow,
|
|
358
|
-
steps
|
|
359
|
-
};
|
|
335
|
+
this.draft.set('steps', steps);
|
|
360
336
|
if (this.selectedStepIndex === index) {
|
|
361
337
|
this.selectedStepIndex = -1;
|
|
362
338
|
}
|
|
@@ -372,10 +348,7 @@ let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shel
|
|
|
372
348
|
const temp = steps[index];
|
|
373
349
|
steps[index] = steps[index - 1];
|
|
374
350
|
steps[index - 1] = temp;
|
|
375
|
-
this.
|
|
376
|
-
...this.workflow,
|
|
377
|
-
steps
|
|
378
|
-
};
|
|
351
|
+
this.draft.set('steps', steps);
|
|
379
352
|
if (this.selectedStepIndex === index) {
|
|
380
353
|
this.selectedStepIndex = index - 1;
|
|
381
354
|
}
|
|
@@ -390,10 +363,7 @@ let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shel
|
|
|
390
363
|
const temp = steps[index];
|
|
391
364
|
steps[index] = steps[index + 1];
|
|
392
365
|
steps[index + 1] = temp;
|
|
393
|
-
this.
|
|
394
|
-
...this.workflow,
|
|
395
|
-
steps
|
|
396
|
-
};
|
|
366
|
+
this.draft.set('steps', steps);
|
|
397
367
|
if (this.selectedStepIndex === index) {
|
|
398
368
|
this.selectedStepIndex = index + 1;
|
|
399
369
|
}
|
|
@@ -410,16 +380,10 @@ let LabelingWorkflowBuilderPage = class LabelingWorkflowBuilderPage extends shel
|
|
|
410
380
|
...steps[index],
|
|
411
381
|
[field]: value
|
|
412
382
|
};
|
|
413
|
-
this.
|
|
414
|
-
...this.workflow,
|
|
415
|
-
steps
|
|
416
|
-
};
|
|
383
|
+
this.draft.set('steps', steps);
|
|
417
384
|
}
|
|
418
385
|
updateWorkflow(field, value) {
|
|
419
|
-
this.
|
|
420
|
-
...this.workflow,
|
|
421
|
-
[field]: value
|
|
422
|
-
};
|
|
386
|
+
this.draft.set(field, value);
|
|
423
387
|
}
|
|
424
388
|
renderStepEditor() {
|
|
425
389
|
if (this.selectedStepIndex === -1 || !this.workflow.steps[this.selectedStepIndex]) {
|
|
@@ -614,22 +578,10 @@ tslib_1.__decorate([
|
|
|
614
578
|
(0, decorators_js_1.property)({ type: String }),
|
|
615
579
|
tslib_1.__metadata("design:type", String)
|
|
616
580
|
], LabelingWorkflowBuilderPage.prototype, "workflowId", void 0);
|
|
617
|
-
tslib_1.__decorate([
|
|
618
|
-
(0, decorators_js_1.state)(),
|
|
619
|
-
tslib_1.__metadata("design:type", Object)
|
|
620
|
-
], LabelingWorkflowBuilderPage.prototype, "workflow", void 0);
|
|
621
581
|
tslib_1.__decorate([
|
|
622
582
|
(0, decorators_js_1.state)(),
|
|
623
583
|
tslib_1.__metadata("design:type", Number)
|
|
624
584
|
], LabelingWorkflowBuilderPage.prototype, "selectedStepIndex", void 0);
|
|
625
|
-
tslib_1.__decorate([
|
|
626
|
-
(0, decorators_js_1.state)(),
|
|
627
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
628
|
-
], LabelingWorkflowBuilderPage.prototype, "loading", void 0);
|
|
629
|
-
tslib_1.__decorate([
|
|
630
|
-
(0, decorators_js_1.state)(),
|
|
631
|
-
tslib_1.__metadata("design:type", String)
|
|
632
|
-
], LabelingWorkflowBuilderPage.prototype, "error", void 0);
|
|
633
585
|
exports.LabelingWorkflowBuilderPage = LabelingWorkflowBuilderPage = tslib_1.__decorate([
|
|
634
586
|
(0, decorators_js_1.customElement)('labeling-workflow-builder-page')
|
|
635
587
|
], LabelingWorkflowBuilderPage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labeling-workflow-builder.js","sourceRoot":"","sources":["../../client/pages/labeling-workflow-builder.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,qDAAkE;AAClE,0CAAyC;AACzC,8CAAyC;AACzC,sEAA6B;AAE7B;;;;GAIG;AAEI,IAAM,2BAA2B,GAAjC,M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,EAAC,gCAAgC,CAAC;GACnC,2BAA2B,CA6mBvC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport gql from 'graphql-tag'\n\n/**\n * Workflow Builder Page\n *\n * Generic workflow builder UI for creating and editing labeling workflows\n */\n@customElement('labeling-workflow-builder-page')\nexport class LabelingWorkflowBuilderPage extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: var(--md-sys-color-surface);\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 20px;\n background-color: var(--md-sys-color-surface-variant);\n border-bottom: 1px solid var(--md-sys-color-outline);\n }\n\n .header h1 {\n margin: 0;\n font-size: 24px;\n color: var(--md-sys-color-on-surface);\n }\n\n .header-actions {\n display: flex;\n gap: 10px;\n }\n\n .content {\n display: flex;\n flex: 1;\n overflow: hidden;\n }\n\n .sidebar {\n width: 300px;\n border-right: 1px solid var(--md-sys-color-outline);\n overflow-y: auto;\n padding: 20px;\n }\n\n .main-area {\n flex: 1;\n overflow-y: auto;\n padding: 20px;\n }\n\n .form-group {\n margin-bottom: 20px;\n }\n\n .form-group label {\n display: block;\n margin-bottom: 8px;\n font-weight: 500;\n color: var(--md-sys-color-on-surface);\n }\n\n .form-group input,\n .form-group textarea,\n .form-group select {\n width: 100%;\n padding: 10px;\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 4px;\n font-size: 14px;\n background-color: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n\n .form-group textarea {\n min-height: 80px;\n resize: vertical;\n }\n\n button {\n padding: 10px 20px;\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n }\n\n button:hover {\n opacity: 0.9;\n }\n\n button.secondary {\n background-color: var(--md-sys-color-secondary);\n color: var(--md-sys-color-on-secondary);\n }\n\n .steps-container {\n margin-top: 20px;\n }\n\n .steps-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 15px;\n }\n\n .steps-header h2 {\n margin: 0;\n font-size: 18px;\n }\n\n .step-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .step-item {\n background-color: var(--md-sys-color-surface-variant);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 8px;\n padding: 15px;\n cursor: pointer;\n transition:\n transform 0.2s,\n box-shadow 0.2s;\n }\n\n .step-item:hover {\n transform: translateY(-2px);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n\n .step-item.selected {\n border-color: var(--md-sys-color-primary);\n border-width: 2px;\n }\n\n .step-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .step-title {\n font-weight: bold;\n font-size: 16px;\n }\n\n .step-actions {\n display: flex;\n gap: 5px;\n }\n\n .step-actions button {\n padding: 5px 10px;\n font-size: 12px;\n }\n\n .step-type {\n display: inline-block;\n padding: 4px 8px;\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n border-radius: 4px;\n font-size: 12px;\n margin-bottom: 8px;\n }\n\n .step-config {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-top: 8px;\n }\n\n .empty-state {\n text-align: center;\n padding: 40px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .add-step-button {\n width: 100%;\n padding: 15px;\n border: 2px dashed var(--md-sys-color-outline);\n background-color: transparent;\n color: var(--md-sys-color-on-surface);\n cursor: pointer;\n border-radius: 8px;\n margin-top: 10px;\n }\n\n .add-step-button:hover {\n border-color: var(--md-sys-color-primary);\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .loading {\n text-align: center;\n padding: 40px;\n }\n\n .error {\n padding: 15px;\n background-color: #ffebee;\n color: #c62828;\n border-radius: 4px;\n margin-bottom: 20px;\n }\n `\n ]\n\n @property({ type: String }) workflowId?: string\n @state() workflow: any = {\n name: '',\n description: '',\n projectId: null,\n triggerType: 'manual',\n triggerConfig: '',\n steps: [],\n autoStart: false\n }\n @state() selectedStepIndex: number = -1\n @state() loading: boolean = false\n @state() error: string = ''\n\n async firstUpdated() {\n if (this.workflowId) {\n await this.loadWorkflow()\n }\n }\n\n async loadWorkflow() {\n this.loading = true\n this.error = ''\n\n try {\n const response = await client.query({\n query: gql`\n query GetWorkflow($workflowId: String!) {\n labelingWorkflow(workflowId: $workflowId) {\n id\n name\n description\n projectId\n triggerType\n triggerConfig\n steps {\n name\n type\n order\n config\n continueOnError\n }\n status\n autoStart\n }\n }\n `,\n variables: { workflowId: this.workflowId }\n })\n\n this.workflow = response.data.labelingWorkflow\n } catch (error) {\n console.error('Failed to load workflow:', error)\n this.error = 'Failed to load workflow. Please try again.'\n } finally {\n this.loading = false\n }\n }\n\n async saveWorkflow() {\n this.loading = true\n this.error = ''\n\n try {\n const mutation = this.workflowId\n ? gql`\n mutation UpdateWorkflow($workflowId: String!, $input: UpdateWorkflowRequest!) {\n updateLabelingWorkflow(workflowId: $workflowId, input: $input) {\n id\n name\n }\n }\n `\n : gql`\n mutation CreateWorkflow($input: CreateWorkflowRequest!) {\n createLabelingWorkflow(input: $input) {\n id\n name\n }\n }\n `\n\n const variables: any = {\n input: {\n name: this.workflow.name,\n description: this.workflow.description,\n projectId: parseInt(this.workflow.projectId),\n triggerType: this.workflow.triggerType,\n triggerConfig: this.workflow.triggerConfig,\n steps: this.workflow.steps.map((step: any, index: number) => ({\n name: step.name,\n type: step.type,\n order: index + 1,\n config: step.config,\n continueOnError: step.continueOnError || false\n })),\n autoStart: this.workflow.autoStart\n }\n }\n\n if (this.workflowId) {\n variables.workflowId = this.workflowId\n }\n\n await client.mutate({ mutation, variables })\n\n alert('Workflow saved successfully!')\n history.back()\n } catch (error) {\n console.error('Failed to save workflow:', error)\n this.error = 'Failed to save workflow. Please check your inputs and try again.'\n } finally {\n this.loading = false\n }\n }\n\n addStep() {\n const newStep = {\n name: `Step ${this.workflow.steps.length + 1}`,\n type: 'import_data',\n config: '{}',\n continueOnError: false\n }\n\n this.workflow = {\n ...this.workflow,\n steps: [...this.workflow.steps, newStep]\n }\n\n this.selectedStepIndex = this.workflow.steps.length - 1\n }\n\n removeStep(index: number) {\n if (confirm('Are you sure you want to remove this step?')) {\n const steps = [...this.workflow.steps]\n steps.splice(index, 1)\n\n this.workflow = {\n ...this.workflow,\n steps\n }\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = -1\n } else if (this.selectedStepIndex > index) {\n this.selectedStepIndex--\n }\n }\n }\n\n moveStepUp(index: number) {\n if (index === 0) return\n\n const steps = [...this.workflow.steps]\n const temp = steps[index]\n steps[index] = steps[index - 1]\n steps[index - 1] = temp\n\n this.workflow = {\n ...this.workflow,\n steps\n }\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = index - 1\n } else if (this.selectedStepIndex === index - 1) {\n this.selectedStepIndex = index\n }\n }\n\n moveStepDown(index: number) {\n if (index === this.workflow.steps.length - 1) return\n\n const steps = [...this.workflow.steps]\n const temp = steps[index]\n steps[index] = steps[index + 1]\n steps[index + 1] = temp\n\n this.workflow = {\n ...this.workflow,\n steps\n }\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = index + 1\n } else if (this.selectedStepIndex === index + 1) {\n this.selectedStepIndex = index\n }\n }\n\n selectStep(index: number) {\n this.selectedStepIndex = index\n }\n\n updateStep(index: number, field: string, value: any) {\n const steps = [...this.workflow.steps]\n steps[index] = {\n ...steps[index],\n [field]: value\n }\n\n this.workflow = {\n ...this.workflow,\n steps\n }\n }\n\n updateWorkflow(field: string, value: any) {\n this.workflow = {\n ...this.workflow,\n [field]: value\n }\n }\n\n renderStepEditor() {\n if (this.selectedStepIndex === -1 || !this.workflow.steps[this.selectedStepIndex]) {\n return html` <div class=\"empty-state\">Select a step to edit its configuration</div> `\n }\n\n const step = this.workflow.steps[this.selectedStepIndex]\n\n return html`\n <div class=\"form-group\">\n <label>Step Name</label>\n <input\n type=\"text\"\n .value=${step.name}\n @input=${(e: any) => this.updateStep(this.selectedStepIndex, 'name', e.target.value)}\n />\n </div>\n\n <div class=\"form-group\">\n <label>Step Type</label>\n <select\n .value=${step.type}\n @change=${(e: any) => this.updateStep(this.selectedStepIndex, 'type', e.target.value)}\n >\n <option value=\"import_data\">Import Data</option>\n <option value=\"generate_predictions\">Generate Predictions</option>\n <option value=\"wait_for_annotations\">Wait for Annotations</option>\n <option value=\"sync_annotations\">Sync Annotations</option>\n <option value=\"validate_quality\">Validate Quality</option>\n <option value=\"export_results\">Export Results</option>\n <option value=\"notification\">Notification</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label>Configuration (JSON)</label>\n <textarea\n .value=${step.config}\n @input=${(e: any) => this.updateStep(this.selectedStepIndex, 'config', e.target.value)}\n placeholder='{\"key\": \"value\"}'\n ></textarea>\n </div>\n\n <div class=\"form-group\">\n <label>\n <input\n type=\"checkbox\"\n .checked=${step.continueOnError}\n @change=${(e: any) => this.updateStep(this.selectedStepIndex, 'continueOnError', e.target.checked)}\n />\n Continue on Error\n </label>\n </div>\n `\n }\n\n render() {\n if (this.loading) {\n return html`<div class=\"loading\">Loading...</div>`\n }\n\n return html`\n <div class=\"header\">\n <h1>${this.workflowId ? 'Edit Workflow' : 'Create Workflow'}</h1>\n <div class=\"header-actions\">\n <button class=\"secondary\" @click=${() => history.back()}>Cancel</button>\n <button @click=${this.saveWorkflow}>Save Workflow</button>\n </div>\n </div>\n\n ${this.error ? html`<div class=\"error\">${this.error}</div>` : ''}\n\n <div class=\"content\">\n <div class=\"sidebar\">\n <div class=\"form-group\">\n <label>Workflow Name *</label>\n <input\n type=\"text\"\n .value=${this.workflow.name}\n @input=${(e: any) => this.updateWorkflow('name', e.target.value)}\n placeholder=\"Enter workflow name\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label>Description</label>\n <textarea\n .value=${this.workflow.description || ''}\n @input=${(e: any) => this.updateWorkflow('description', e.target.value)}\n placeholder=\"Enter workflow description\"\n ></textarea>\n </div>\n\n <div class=\"form-group\">\n <label>Project ID *</label>\n <input\n type=\"number\"\n .value=${this.workflow.projectId || ''}\n @input=${(e: any) => this.updateWorkflow('projectId', e.target.value)}\n placeholder=\"Label Studio project ID\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label>Trigger Type</label>\n <select\n .value=${this.workflow.triggerType}\n @change=${(e: any) => this.updateWorkflow('triggerType', e.target.value)}\n >\n <option value=\"manual\">Manual</option>\n <option value=\"scheduled\">Scheduled</option>\n <option value=\"event\">Event-based</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label>\n <input\n type=\"checkbox\"\n .checked=${this.workflow.autoStart}\n @change=${(e: any) => this.updateWorkflow('autoStart', e.target.checked)}\n />\n Auto Start\n </label>\n </div>\n\n <div class=\"steps-container\">\n <div class=\"steps-header\">\n <h2>Workflow Steps</h2>\n </div>\n\n <div class=\"step-list\">\n ${this.workflow.steps.length === 0\n ? html`<div class=\"empty-state\">No steps added yet</div>`\n : this.workflow.steps.map(\n (step: any, index: number) => html`\n <div\n class=\"step-item ${this.selectedStepIndex === index ? 'selected' : ''}\"\n @click=${() => this.selectStep(index)}\n >\n <div class=\"step-header\">\n <div class=\"step-title\">${index + 1}. ${step.name}</div>\n <div class=\"step-actions\">\n ${index > 0\n ? html`<button\n @click=${(e: Event) => {\n e.stopPropagation()\n this.moveStepUp(index)\n }}\n >\n ↑\n </button>`\n : ''}\n ${index < this.workflow.steps.length - 1\n ? html`<button\n @click=${(e: Event) => {\n e.stopPropagation()\n this.moveStepDown(index)\n }}\n >\n ↓\n </button>`\n : ''}\n <button\n class=\"secondary\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this.removeStep(index)\n }}\n >\n ×\n </button>\n </div>\n </div>\n <div class=\"step-type\">${step.type}</div>\n ${step.continueOnError ? html`<div class=\"step-config\">Continue on error: Yes</div>` : ''}\n </div>\n `\n )}\n </div>\n\n <button class=\"add-step-button\" @click=${this.addStep}>+ Add Step</button>\n </div>\n </div>\n\n <div class=\"main-area\">\n <h2>Step Configuration</h2>\n ${this.renderStepEditor()}\n </div>\n </div>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"labeling-workflow-builder.js","sourceRoot":"","sources":["../../client/pages/labeling-workflow-builder.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,qDAAkE;AAClE,0CAA0D;AAC1D,8CAAsE;AACtE,sEAA6B;AAE7B;;;;GAIG;AACH,uCAAuC;AACvC,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,QAAQ;IACrB,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,KAAK;CACjB,CAAA;AAGM,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,gBAAQ;IAAlD;;QAuNI,sBAAiB,GAAW,CAAC,CAAC,CAAA;QAEvC,2CAA2C;QACnC,iBAAY,GAAG,IAAI,yBAAe,CACxC,IAAI,EACJ,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;;KAoBF,EACD,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CACrF,CAAA;QAED,yCAAyC;QACjC,aAAQ,GAAG,IAAI,4BAAkB,CACvC,IAAI,EACJ,IAAA,qBAAG,EAAA;;;;;;;KAOF,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAA;QACO,aAAQ,GAAG,IAAI,4BAAkB,CACvC,IAAI,EACJ,IAAA,qBAAG,EAAA;;;;;;;KAOF,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACrB,CAAA;QAED,mEAAmE;QAC3D,UAAK,GAAG,IAAI,u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AAE;;qBAE5F,CACF;;;qDAGkC,IAAI,CAAC,OAAO;;;;;;YAMrD,IAAI,CAAC,gBAAgB,EAAE;;;KAG9B,CAAA;IACH,CAAC;;AA5kBU,kEAA2B;AAsNV;IAA3B,IAAA,wBAAQ,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+DAAoB;AACtC;IAAR,IAAA,qBAAK,GAAE;;sEAA+B;sCAvN5B,2BAA2B;IADvC,IAAA,6BAAa,EAAC,gCAAgC,CAAC;GACnC,2BAA2B,CA6kBvC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { PageView, DraftController } from '@operato/shell'\nimport { MutationController, QueryController } from '@operato/graphql'\nimport gql from 'graphql-tag'\n\n/**\n * Workflow Builder Page\n *\n * Generic workflow builder UI for creating and editing labeling workflows\n */\n/** What a new workflow starts from. */\nconst NEW_WORKFLOW = {\n name: '',\n description: '',\n projectId: null,\n triggerType: 'manual',\n triggerConfig: '',\n steps: [],\n autoStart: false\n}\n\n@customElement('labeling-workflow-builder-page')\nexport class LabelingWorkflowBuilderPage extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n height: 100%;\n background-color: var(--md-sys-color-surface);\n }\n\n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 20px;\n background-color: var(--md-sys-color-surface-variant);\n border-bottom: 1px solid var(--md-sys-color-outline);\n }\n\n .header h1 {\n margin: 0;\n font-size: 24px;\n color: var(--md-sys-color-on-surface);\n }\n\n .header-actions {\n display: flex;\n gap: 10px;\n }\n\n .content {\n display: flex;\n flex: 1;\n overflow: hidden;\n }\n\n .sidebar {\n width: 300px;\n border-right: 1px solid var(--md-sys-color-outline);\n overflow-y: auto;\n padding: 20px;\n }\n\n .main-area {\n flex: 1;\n overflow-y: auto;\n padding: 20px;\n }\n\n .form-group {\n margin-bottom: 20px;\n }\n\n .form-group label {\n display: block;\n margin-bottom: 8px;\n font-weight: 500;\n color: var(--md-sys-color-on-surface);\n }\n\n .form-group input,\n .form-group textarea,\n .form-group select {\n width: 100%;\n padding: 10px;\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 4px;\n font-size: 14px;\n background-color: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n\n .form-group textarea {\n min-height: 80px;\n resize: vertical;\n }\n\n button {\n padding: 10px 20px;\n background-color: var(--md-sys-color-primary);\n color: var(--md-sys-color-on-primary);\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n }\n\n button:hover {\n opacity: 0.9;\n }\n\n button.secondary {\n background-color: var(--md-sys-color-secondary);\n color: var(--md-sys-color-on-secondary);\n }\n\n .steps-container {\n margin-top: 20px;\n }\n\n .steps-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 15px;\n }\n\n .steps-header h2 {\n margin: 0;\n font-size: 18px;\n }\n\n .step-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n\n .step-item {\n background-color: var(--md-sys-color-surface-variant);\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 8px;\n padding: 15px;\n cursor: pointer;\n transition:\n transform 0.2s,\n box-shadow 0.2s;\n }\n\n .step-item:hover {\n transform: translateY(-2px);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n }\n\n .step-item.selected {\n border-color: var(--md-sys-color-primary);\n border-width: 2px;\n }\n\n .step-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .step-title {\n font-weight: bold;\n font-size: 16px;\n }\n\n .step-actions {\n display: flex;\n gap: 5px;\n }\n\n .step-actions button {\n padding: 5px 10px;\n font-size: 12px;\n }\n\n .step-type {\n display: inline-block;\n padding: 4px 8px;\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n border-radius: 4px;\n font-size: 12px;\n margin-bottom: 8px;\n }\n\n .step-config {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-top: 8px;\n }\n\n .empty-state {\n text-align: center;\n padding: 40px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .add-step-button {\n width: 100%;\n padding: 15px;\n border: 2px dashed var(--md-sys-color-outline);\n background-color: transparent;\n color: var(--md-sys-color-on-surface);\n cursor: pointer;\n border-radius: 8px;\n margin-top: 10px;\n }\n\n .add-step-button:hover {\n border-color: var(--md-sys-color-primary);\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .loading {\n text-align: center;\n padding: 40px;\n }\n\n .error {\n padding: 15px;\n background-color: #ffebee;\n color: #c62828;\n border-radius: 4px;\n margin-bottom: 20px;\n }\n `\n ]\n\n @property({ type: String }) workflowId?: string\n @state() selectedStepIndex: number = -1\n\n /* The workflow being edited (ADR-0190). */\n private workflowRead = new QueryController(\n this,\n gql`\n query GetWorkflow($workflowId: String!) {\n labelingWorkflow(workflowId: $workflowId) {\n id\n name\n description\n projectId\n triggerType\n triggerConfig\n steps {\n name\n type\n order\n config\n continueOnError\n }\n status\n autoStart\n }\n }\n `,\n { variables: () => (this.workflowId ? { workflowId: this.workflowId } : undefined) }\n )\n\n /* The form says a failed save itself. */\n private updating = new MutationController(\n this,\n gql`\n mutation UpdateWorkflow($workflowId: String!, $input: UpdateWorkflowRequest!) {\n updateLabelingWorkflow(workflowId: $workflowId, input: $input) {\n id\n name\n }\n }\n `,\n { showsError: true }\n )\n private creating = new MutationController(\n this,\n gql`\n mutation CreateWorkflow($input: CreateWorkflowRequest!) {\n createLabelingWorkflow(input: $input) {\n id\n name\n }\n }\n `,\n { showsError: true }\n )\n\n /* The workflow as changed here over the one read, or a new one. */\n private draft = new DraftController<any>(this, {\n read: () => this.workflowRead.data?.labelingWorkflow ?? NEW_WORKFLOW,\n key: () => this.workflowId\n })\n\n get workflow(): any {\n return { ...(this.workflowRead.data?.labelingWorkflow ?? NEW_WORKFLOW), ...this.draft.edits }\n }\n\n get loading() {\n return this.workflowRead.loading || this.updating.pending || this.creating.pending\n }\n\n get error() {\n if (this.workflowRead.error) return 'Failed to load workflow. Please try again.'\n if (this.updating.error || this.creating.error) return 'Failed to save workflow. Please check your inputs and try again.'\n return ''\n }\n\n async saveWorkflow() {\n const input = {\n name: this.workflow.name,\n description: this.workflow.description,\n projectId: parseInt(this.workflow.projectId),\n triggerType: this.workflow.triggerType,\n triggerConfig: this.workflow.triggerConfig,\n steps: this.workflow.steps.map((step: any, index: number) => ({\n name: step.name,\n type: step.type,\n order: index + 1,\n config: step.config,\n continueOnError: step.continueOnError || false\n })),\n autoStart: this.workflow.autoStart\n }\n\n const saved = await this.draft.submit(() =>\n this.workflowId ? this.updating.run({ workflowId: this.workflowId, input }) : this.creating.run({ input })\n )\n if (!saved) return\n\n alert('Workflow saved successfully!')\n history.back()\n }\n\n addStep() {\n const newStep = {\n name: `Step ${this.workflow.steps.length + 1}`,\n type: 'import_data',\n config: '{}',\n continueOnError: false\n }\n\n this.draft.set('steps', [...this.workflow.steps, newStep])\n\n this.selectedStepIndex = this.workflow.steps.length - 1\n }\n\n removeStep(index: number) {\n if (confirm('Are you sure you want to remove this step?')) {\n const steps = [...this.workflow.steps]\n steps.splice(index, 1)\n\n this.draft.set('steps', steps)\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = -1\n } else if (this.selectedStepIndex > index) {\n this.selectedStepIndex--\n }\n }\n }\n\n moveStepUp(index: number) {\n if (index === 0) return\n\n const steps = [...this.workflow.steps]\n const temp = steps[index]\n steps[index] = steps[index - 1]\n steps[index - 1] = temp\n\n this.draft.set('steps', steps)\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = index - 1\n } else if (this.selectedStepIndex === index - 1) {\n this.selectedStepIndex = index\n }\n }\n\n moveStepDown(index: number) {\n if (index === this.workflow.steps.length - 1) return\n\n const steps = [...this.workflow.steps]\n const temp = steps[index]\n steps[index] = steps[index + 1]\n steps[index + 1] = temp\n\n this.draft.set('steps', steps)\n\n if (this.selectedStepIndex === index) {\n this.selectedStepIndex = index + 1\n } else if (this.selectedStepIndex === index + 1) {\n this.selectedStepIndex = index\n }\n }\n\n selectStep(index: number) {\n this.selectedStepIndex = index\n }\n\n updateStep(index: number, field: string, value: any) {\n const steps = [...this.workflow.steps]\n steps[index] = {\n ...steps[index],\n [field]: value\n }\n\n this.draft.set('steps', steps)\n }\n\n updateWorkflow(field: string, value: any) {\n this.draft.set(field, value)\n }\n\n renderStepEditor() {\n if (this.selectedStepIndex === -1 || !this.workflow.steps[this.selectedStepIndex]) {\n return html` <div class=\"empty-state\">Select a step to edit its configuration</div> `\n }\n\n const step = this.workflow.steps[this.selectedStepIndex]\n\n return html`\n <div class=\"form-group\">\n <label>Step Name</label>\n <input\n type=\"text\"\n .value=${step.name}\n @input=${(e: any) => this.updateStep(this.selectedStepIndex, 'name', e.target.value)}\n />\n </div>\n\n <div class=\"form-group\">\n <label>Step Type</label>\n <select\n .value=${step.type}\n @change=${(e: any) => this.updateStep(this.selectedStepIndex, 'type', e.target.value)}\n >\n <option value=\"import_data\">Import Data</option>\n <option value=\"generate_predictions\">Generate Predictions</option>\n <option value=\"wait_for_annotations\">Wait for Annotations</option>\n <option value=\"sync_annotations\">Sync Annotations</option>\n <option value=\"validate_quality\">Validate Quality</option>\n <option value=\"export_results\">Export Results</option>\n <option value=\"notification\">Notification</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label>Configuration (JSON)</label>\n <textarea\n .value=${step.config}\n @input=${(e: any) => this.updateStep(this.selectedStepIndex, 'config', e.target.value)}\n placeholder='{\"key\": \"value\"}'\n ></textarea>\n </div>\n\n <div class=\"form-group\">\n <label>\n <input\n type=\"checkbox\"\n .checked=${step.continueOnError}\n @change=${(e: any) => this.updateStep(this.selectedStepIndex, 'continueOnError', e.target.checked)}\n />\n Continue on Error\n </label>\n </div>\n `\n }\n\n render() {\n if (this.loading) {\n return html`<div class=\"loading\">Loading...</div>`\n }\n\n return html`\n <div class=\"header\">\n <h1>${this.workflowId ? 'Edit Workflow' : 'Create Workflow'}</h1>\n <div class=\"header-actions\">\n <button class=\"secondary\" @click=${() => history.back()}>Cancel</button>\n <button @click=${this.saveWorkflow}>Save Workflow</button>\n </div>\n </div>\n\n ${this.error ? html`<div class=\"error\">${this.error}</div>` : ''}\n\n <div class=\"content\">\n <div class=\"sidebar\">\n <div class=\"form-group\">\n <label>Workflow Name *</label>\n <input\n type=\"text\"\n .value=${this.workflow.name}\n @input=${(e: any) => this.updateWorkflow('name', e.target.value)}\n placeholder=\"Enter workflow name\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label>Description</label>\n <textarea\n .value=${this.workflow.description || ''}\n @input=${(e: any) => this.updateWorkflow('description', e.target.value)}\n placeholder=\"Enter workflow description\"\n ></textarea>\n </div>\n\n <div class=\"form-group\">\n <label>Project ID *</label>\n <input\n type=\"number\"\n .value=${this.workflow.projectId || ''}\n @input=${(e: any) => this.updateWorkflow('projectId', e.target.value)}\n placeholder=\"Label Studio project ID\"\n required\n />\n </div>\n\n <div class=\"form-group\">\n <label>Trigger Type</label>\n <select\n .value=${this.workflow.triggerType}\n @change=${(e: any) => this.updateWorkflow('triggerType', e.target.value)}\n >\n <option value=\"manual\">Manual</option>\n <option value=\"scheduled\">Scheduled</option>\n <option value=\"event\">Event-based</option>\n </select>\n </div>\n\n <div class=\"form-group\">\n <label>\n <input\n type=\"checkbox\"\n .checked=${this.workflow.autoStart}\n @change=${(e: any) => this.updateWorkflow('autoStart', e.target.checked)}\n />\n Auto Start\n </label>\n </div>\n\n <div class=\"steps-container\">\n <div class=\"steps-header\">\n <h2>Workflow Steps</h2>\n </div>\n\n <div class=\"step-list\">\n ${this.workflow.steps.length === 0\n ? html`<div class=\"empty-state\">No steps added yet</div>`\n : this.workflow.steps.map(\n (step: any, index: number) => html`\n <div\n class=\"step-item ${this.selectedStepIndex === index ? 'selected' : ''}\"\n @click=${() => this.selectStep(index)}\n >\n <div class=\"step-header\">\n <div class=\"step-title\">${index + 1}. ${step.name}</div>\n <div class=\"step-actions\">\n ${index > 0\n ? html`<button\n @click=${(e: Event) => {\n e.stopPropagation()\n this.moveStepUp(index)\n }}\n >\n ↑\n </button>`\n : ''}\n ${index < this.workflow.steps.length - 1\n ? html`<button\n @click=${(e: Event) => {\n e.stopPropagation()\n this.moveStepDown(index)\n }}\n >\n ↓\n </button>`\n : ''}\n <button\n class=\"secondary\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this.removeStep(index)\n }}\n >\n ×\n </button>\n </div>\n </div>\n <div class=\"step-type\">${step.type}</div>\n ${step.continueOnError ? html`<div class=\"step-config\">Continue on error: Yes</div>` : ''}\n </div>\n `\n )}\n </div>\n\n <button class=\"add-step-button\" @click=${this.addStep}>+ Add Step</button>\n </div>\n </div>\n\n <div class=\"main-area\">\n <h2>Step Configuration</h2>\n ${this.renderStepEditor()}\n </div>\n </div>\n `\n }\n}\n"]}
|
|
@@ -6,12 +6,17 @@ import { PageView } from '@operato/shell';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare class LabelingWorkflowListPage extends PageView {
|
|
8
8
|
static styles: import("lit").CSSResult[];
|
|
9
|
-
workflows: any[];
|
|
10
|
-
loading: boolean;
|
|
11
9
|
filterStatus: string;
|
|
12
10
|
filterProjectId: string;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
private appliedProjectId;
|
|
12
|
+
private workflowsRead;
|
|
13
|
+
private executing;
|
|
14
|
+
private pausing;
|
|
15
|
+
private resuming;
|
|
16
|
+
private deleting;
|
|
17
|
+
private change;
|
|
18
|
+
get workflows(): any[];
|
|
19
|
+
get loading(): boolean;
|
|
15
20
|
createWorkflow(): void;
|
|
16
21
|
editWorkflow(workflowId: string, event: Event): void;
|
|
17
22
|
executeWorkflow(workflowId: string, event: Event): Promise<void>;
|