@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
|
@@ -16,10 +16,60 @@ const shell_2 = require("@operato/shell");
|
|
|
16
16
|
let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.PageView {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
|
-
this.workflows = [];
|
|
20
|
-
this.loading = true;
|
|
21
19
|
this.filterStatus = 'all';
|
|
22
20
|
this.filterProjectId = '';
|
|
21
|
+
/* The project filter read now - typed into filterProjectId, applied by its button. */
|
|
22
|
+
this.appliedProjectId = '';
|
|
23
|
+
this.workflowsRead = new graphql_1.QueryController(this, (0, graphql_tag_1.default) `
|
|
24
|
+
query GetWorkflows($projectId: Int) {
|
|
25
|
+
labelingWorkflows(projectId: $projectId) {
|
|
26
|
+
items {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
description
|
|
30
|
+
projectId
|
|
31
|
+
status
|
|
32
|
+
triggerType
|
|
33
|
+
steps {
|
|
34
|
+
name
|
|
35
|
+
type
|
|
36
|
+
}
|
|
37
|
+
createdAt
|
|
38
|
+
lastExecutedAt
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`, { variables: () => (this.appliedProjectId ? { projectId: parseInt(this.appliedProjectId) } : {}) });
|
|
43
|
+
this.executing = this.change((0, graphql_tag_1.default) `
|
|
44
|
+
mutation ExecuteWorkflow($workflowId: String!) {
|
|
45
|
+
executeLabelingWorkflow(input: { workflowId: $workflowId }) {
|
|
46
|
+
executionId
|
|
47
|
+
status
|
|
48
|
+
summary
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
`);
|
|
52
|
+
this.pausing = this.change((0, graphql_tag_1.default) `
|
|
53
|
+
mutation PauseWorkflow($workflowId: String!) {
|
|
54
|
+
pauseLabelingWorkflow(workflowId: $workflowId) {
|
|
55
|
+
id
|
|
56
|
+
status
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`);
|
|
60
|
+
this.resuming = this.change((0, graphql_tag_1.default) `
|
|
61
|
+
mutation ResumeWorkflow($workflowId: String!) {
|
|
62
|
+
resumeLabelingWorkflow(workflowId: $workflowId) {
|
|
63
|
+
id
|
|
64
|
+
status
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`);
|
|
68
|
+
this.deleting = this.change((0, graphql_tag_1.default) `
|
|
69
|
+
mutation DeleteWorkflow($workflowId: String!) {
|
|
70
|
+
deleteLabelingWorkflow(workflowId: $workflowId)
|
|
71
|
+
}
|
|
72
|
+
`);
|
|
23
73
|
}
|
|
24
74
|
static { this.styles = [
|
|
25
75
|
(0, lit_1.css) `
|
|
@@ -216,44 +266,15 @@ let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.Pa
|
|
|
216
266
|
}
|
|
217
267
|
`
|
|
218
268
|
]; }
|
|
219
|
-
|
|
220
|
-
|
|
269
|
+
/* Every change reads the workflows again once it is done. */
|
|
270
|
+
change(mutation) {
|
|
271
|
+
return new graphql_1.MutationController(this, mutation, { refetch: () => [this.workflowsRead] });
|
|
221
272
|
}
|
|
222
|
-
|
|
223
|
-
this.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
query GetWorkflows($projectId: Int) {
|
|
228
|
-
labelingWorkflows(projectId: $projectId) {
|
|
229
|
-
items {
|
|
230
|
-
id
|
|
231
|
-
name
|
|
232
|
-
description
|
|
233
|
-
projectId
|
|
234
|
-
status
|
|
235
|
-
triggerType
|
|
236
|
-
steps {
|
|
237
|
-
name
|
|
238
|
-
type
|
|
239
|
-
}
|
|
240
|
-
createdAt
|
|
241
|
-
lastExecutedAt
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
`,
|
|
246
|
-
variables: this.filterProjectId ? { projectId: parseInt(this.filterProjectId) } : {}
|
|
247
|
-
});
|
|
248
|
-
this.workflows = response.data.labelingWorkflows.items || [];
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
console.error('Failed to load workflows:', error);
|
|
252
|
-
alert('Failed to load workflows');
|
|
253
|
-
}
|
|
254
|
-
finally {
|
|
255
|
-
this.loading = false;
|
|
256
|
-
}
|
|
273
|
+
get workflows() {
|
|
274
|
+
return this.workflowsRead.data?.labelingWorkflows?.items || [];
|
|
275
|
+
}
|
|
276
|
+
get loading() {
|
|
277
|
+
return this.workflowsRead.loading;
|
|
257
278
|
}
|
|
258
279
|
createWorkflow() {
|
|
259
280
|
(0, shell_2.navigate)('workflow-builder');
|
|
@@ -266,96 +287,30 @@ let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.Pa
|
|
|
266
287
|
event.stopPropagation();
|
|
267
288
|
if (!confirm('Execute this workflow?'))
|
|
268
289
|
return;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
mutation ExecuteWorkflow($workflowId: String!) {
|
|
273
|
-
executeLabelingWorkflow(input: { workflowId: $workflowId }) {
|
|
274
|
-
executionId
|
|
275
|
-
status
|
|
276
|
-
summary
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
`,
|
|
280
|
-
variables: { workflowId }
|
|
281
|
-
});
|
|
282
|
-
const result = response.data.executeLabelingWorkflow;
|
|
283
|
-
alert(`Workflow execution started!\nExecution ID: ${result.executionId}`);
|
|
284
|
-
await this.loadWorkflows();
|
|
285
|
-
}
|
|
286
|
-
catch (error) {
|
|
287
|
-
console.error('Failed to execute workflow:', error);
|
|
288
|
-
alert('Failed to execute workflow');
|
|
289
|
-
}
|
|
290
|
+
const data = await this.executing.run({ workflowId });
|
|
291
|
+
if (data)
|
|
292
|
+
alert(`Workflow execution started!\nExecution ID: ${data.executeLabelingWorkflow.executionId}`);
|
|
290
293
|
}
|
|
291
294
|
async pauseWorkflow(workflowId, event) {
|
|
292
295
|
event.stopPropagation();
|
|
293
296
|
if (!confirm('Pause this workflow?'))
|
|
294
297
|
return;
|
|
295
|
-
|
|
296
|
-
await graphql_1.client.mutate({
|
|
297
|
-
mutation: (0, graphql_tag_1.default) `
|
|
298
|
-
mutation PauseWorkflow($workflowId: String!) {
|
|
299
|
-
pauseLabelingWorkflow(workflowId: $workflowId) {
|
|
300
|
-
id
|
|
301
|
-
status
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
`,
|
|
305
|
-
variables: { workflowId }
|
|
306
|
-
});
|
|
298
|
+
if (await this.pausing.run({ workflowId }))
|
|
307
299
|
alert('Workflow paused successfully');
|
|
308
|
-
await this.loadWorkflows();
|
|
309
|
-
}
|
|
310
|
-
catch (error) {
|
|
311
|
-
console.error('Failed to pause workflow:', error);
|
|
312
|
-
alert('Failed to pause workflow');
|
|
313
|
-
}
|
|
314
300
|
}
|
|
315
301
|
async resumeWorkflow(workflowId, event) {
|
|
316
302
|
event.stopPropagation();
|
|
317
303
|
if (!confirm('Resume this workflow?'))
|
|
318
304
|
return;
|
|
319
|
-
|
|
320
|
-
await graphql_1.client.mutate({
|
|
321
|
-
mutation: (0, graphql_tag_1.default) `
|
|
322
|
-
mutation ResumeWorkflow($workflowId: String!) {
|
|
323
|
-
resumeLabelingWorkflow(workflowId: $workflowId) {
|
|
324
|
-
id
|
|
325
|
-
status
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
`,
|
|
329
|
-
variables: { workflowId }
|
|
330
|
-
});
|
|
305
|
+
if (await this.resuming.run({ workflowId }))
|
|
331
306
|
alert('Workflow resumed successfully');
|
|
332
|
-
await this.loadWorkflows();
|
|
333
|
-
}
|
|
334
|
-
catch (error) {
|
|
335
|
-
console.error('Failed to resume workflow:', error);
|
|
336
|
-
alert('Failed to resume workflow');
|
|
337
|
-
}
|
|
338
307
|
}
|
|
339
308
|
async deleteWorkflow(workflowId, event) {
|
|
340
309
|
event.stopPropagation();
|
|
341
310
|
if (!confirm('Are you sure you want to delete this workflow? This action cannot be undone.'))
|
|
342
311
|
return;
|
|
343
|
-
|
|
344
|
-
await graphql_1.client.mutate({
|
|
345
|
-
mutation: (0, graphql_tag_1.default) `
|
|
346
|
-
mutation DeleteWorkflow($workflowId: String!) {
|
|
347
|
-
deleteLabelingWorkflow(workflowId: $workflowId)
|
|
348
|
-
}
|
|
349
|
-
`,
|
|
350
|
-
variables: { workflowId }
|
|
351
|
-
});
|
|
312
|
+
if (await this.deleting.run({ workflowId }))
|
|
352
313
|
alert('Workflow deleted successfully');
|
|
353
|
-
await this.loadWorkflows();
|
|
354
|
-
}
|
|
355
|
-
catch (error) {
|
|
356
|
-
console.error('Failed to delete workflow:', error);
|
|
357
|
-
alert('Failed to delete workflow');
|
|
358
|
-
}
|
|
359
314
|
}
|
|
360
315
|
getStatusClass(status) {
|
|
361
316
|
switch (status?.toLowerCase()) {
|
|
@@ -390,7 +345,7 @@ let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.Pa
|
|
|
390
345
|
<h1>Labeling Workflows</h1>
|
|
391
346
|
<div class="toolbar">
|
|
392
347
|
<button @click=${this.createWorkflow}>Create Workflow</button>
|
|
393
|
-
<button class="secondary" @click=${this.
|
|
348
|
+
<button class="secondary" @click=${() => this.workflowsRead.refetch()}>Refresh</button>
|
|
394
349
|
</div>
|
|
395
350
|
</div>
|
|
396
351
|
|
|
@@ -418,7 +373,7 @@ let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.Pa
|
|
|
418
373
|
@input=${(e) => (this.filterProjectId = e.target.value)}
|
|
419
374
|
placeholder="Filter by project"
|
|
420
375
|
/>
|
|
421
|
-
<button class="secondary" @click=${this.
|
|
376
|
+
<button class="secondary" @click=${() => (this.appliedProjectId = this.filterProjectId)}>Apply Filter</button>
|
|
422
377
|
</div>
|
|
423
378
|
|
|
424
379
|
${this.filteredWorkflows.length === 0
|
|
@@ -473,14 +428,6 @@ let LabelingWorkflowListPage = class LabelingWorkflowListPage extends shell_1.Pa
|
|
|
473
428
|
}
|
|
474
429
|
};
|
|
475
430
|
exports.LabelingWorkflowListPage = LabelingWorkflowListPage;
|
|
476
|
-
tslib_1.__decorate([
|
|
477
|
-
(0, decorators_js_1.state)(),
|
|
478
|
-
tslib_1.__metadata("design:type", Array)
|
|
479
|
-
], LabelingWorkflowListPage.prototype, "workflows", void 0);
|
|
480
|
-
tslib_1.__decorate([
|
|
481
|
-
(0, decorators_js_1.state)(),
|
|
482
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
483
|
-
], LabelingWorkflowListPage.prototype, "loading", void 0);
|
|
484
431
|
tslib_1.__decorate([
|
|
485
432
|
(0, decorators_js_1.state)(),
|
|
486
433
|
tslib_1.__metadata("design:type", String)
|
|
@@ -489,6 +436,10 @@ tslib_1.__decorate([
|
|
|
489
436
|
(0, decorators_js_1.state)(),
|
|
490
437
|
tslib_1.__metadata("design:type", String)
|
|
491
438
|
], LabelingWorkflowListPage.prototype, "filterProjectId", void 0);
|
|
439
|
+
tslib_1.__decorate([
|
|
440
|
+
(0, decorators_js_1.state)(),
|
|
441
|
+
tslib_1.__metadata("design:type", String)
|
|
442
|
+
], LabelingWorkflowListPage.prototype, "appliedProjectId", void 0);
|
|
492
443
|
exports.LabelingWorkflowListPage = LabelingWorkflowListPage = tslib_1.__decorate([
|
|
493
444
|
(0, decorators_js_1.customElement)('labeling-workflow-list-page')
|
|
494
445
|
], LabelingWorkflowListPage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labeling-workflow-list.js","sourceRoot":"","sources":["../../client/pages/labeling-workflow-list.ts"],"names":[],"mappings":";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AI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;;oCAE9E;gBACZ,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ;oBAC5B,CAAC,CAAC,IAAA,UAAI,EAAA,kBAAkB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB;oBAC3F,CAAC,CAAC,EAAE;yDAC2B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;;;;;iBAKzF,CACF;;WAEJ;KACN,CAAA;IACH,CAAC;;AAxdU,4DAAwB;AAqM1B;IAAR,IAAA,qBAAK,GAAE;;2DAAsB;AACrB;IAAR,IAAA,qBAAK,GAAE;;yDAAwB;AACvB;IAAR,IAAA,qBAAK,GAAE;;8DAA6B;AAC5B;IAAR,IAAA,qBAAK,GAAE;;iEAA6B;mCAxM1B,wBAAwB;IADpC,IAAA,6BAAa,EAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAydpC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport gql from 'graphql-tag'\nimport { navigate } from '@operato/shell'\n\n/**\n * Workflow List Page\n *\n * Displays all labeling workflows with CRUD operations\n */\n@customElement('labeling-workflow-list-page')\nexport class LabelingWorkflowListPage extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n padding: 20px;\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 margin-bottom: 20px;\n }\n\n h1 {\n font-size: 24px;\n margin: 0;\n color: var(--md-sys-color-on-surface);\n }\n\n .toolbar {\n display: flex;\n gap: 10px;\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 }\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 .workflow-list {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));\n gap: 20px;\n }\n\n .workflow-card {\n background-color: var(--md-sys-color-surface-variant);\n border-radius: 8px;\n padding: 20px;\n cursor: pointer;\n transition:\n transform 0.2s,\n box-shadow 0.2s;\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .workflow-card:hover {\n transform: translateY(-4px);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n\n .workflow-header {\n display: flex;\n justify-content: space-between;\n align-items: start;\n margin-bottom: 10px;\n }\n\n .workflow-name {\n font-size: 18px;\n font-weight: bold;\n margin-bottom: 5px;\n color: var(--md-sys-color-on-surface);\n }\n\n .workflow-status {\n display: inline-block;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 500;\n }\n\n .status-active {\n background-color: #4caf50;\n color: white;\n }\n\n .status-draft {\n background-color: #9e9e9e;\n color: white;\n }\n\n .status-paused {\n background-color: #ff9800;\n color: white;\n }\n\n .status-completed {\n background-color: #2196f3;\n color: white;\n }\n\n .status-failed {\n background-color: #f44336;\n color: white;\n }\n\n .workflow-description {\n font-size: 14px;\n color: var(--md-sys-color-on-surface-variant);\n margin-bottom: 10px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .workflow-info {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-bottom: 5px;\n }\n\n .workflow-steps {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-top: 10px;\n padding-top: 10px;\n border-top: 1px solid var(--md-sys-color-outline);\n }\n\n .workflow-actions {\n display: flex;\n gap: 5px;\n margin-top: 15px;\n }\n\n .workflow-actions button {\n flex: 1;\n padding: 8px;\n font-size: 12px;\n }\n\n .loading {\n text-align: center;\n padding: 40px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .empty-state {\n text-align: center;\n padding: 60px 20px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .empty-state h2 {\n font-size: 20px;\n margin-bottom: 10px;\n }\n\n .empty-state p {\n font-size: 14px;\n margin-bottom: 20px;\n }\n\n .filter-bar {\n display: flex;\n gap: 10px;\n margin-bottom: 20px;\n align-items: center;\n }\n\n .filter-bar select,\n .filter-bar input {\n padding: 8px 12px;\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 4px;\n background-color: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n\n .filter-bar label {\n font-size: 14px;\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @state() workflows: any[] = []\n @state() loading: boolean = true\n @state() filterStatus: string = 'all'\n @state() filterProjectId: string = ''\n\n async firstUpdated() {\n await this.loadWorkflows()\n }\n\n async loadWorkflows() {\n this.loading = true\n try {\n const response = await client.query({\n query: gql`\n query GetWorkflows($projectId: Int) {\n labelingWorkflows(projectId: $projectId) {\n items {\n id\n name\n description\n projectId\n status\n triggerType\n steps {\n name\n type\n }\n createdAt\n lastExecutedAt\n }\n }\n }\n `,\n variables: this.filterProjectId ? { projectId: parseInt(this.filterProjectId) } : {}\n })\n\n this.workflows = response.data.labelingWorkflows.items || []\n } catch (error) {\n console.error('Failed to load workflows:', error)\n alert('Failed to load workflows')\n } finally {\n this.loading = false\n }\n }\n\n createWorkflow() {\n navigate('workflow-builder')\n }\n\n editWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n navigate(`workflow-builder/${workflowId}`)\n }\n\n async executeWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Execute this workflow?')) return\n\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ExecuteWorkflow($workflowId: String!) {\n executeLabelingWorkflow(input: { workflowId: $workflowId }) {\n executionId\n status\n summary\n }\n }\n `,\n variables: { workflowId }\n })\n\n const result = response.data.executeLabelingWorkflow\n alert(`Workflow execution started!\\nExecution ID: ${result.executionId}`)\n await this.loadWorkflows()\n } catch (error) {\n console.error('Failed to execute workflow:', error)\n alert('Failed to execute workflow')\n }\n }\n\n async pauseWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Pause this workflow?')) return\n\n try {\n await client.mutate({\n mutation: gql`\n mutation PauseWorkflow($workflowId: String!) {\n pauseLabelingWorkflow(workflowId: $workflowId) {\n id\n status\n }\n }\n `,\n variables: { workflowId }\n })\n\n alert('Workflow paused successfully')\n await this.loadWorkflows()\n } catch (error) {\n console.error('Failed to pause workflow:', error)\n alert('Failed to pause workflow')\n }\n }\n\n async resumeWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Resume this workflow?')) return\n\n try {\n await client.mutate({\n mutation: gql`\n mutation ResumeWorkflow($workflowId: String!) {\n resumeLabelingWorkflow(workflowId: $workflowId) {\n id\n status\n }\n }\n `,\n variables: { workflowId }\n })\n\n alert('Workflow resumed successfully')\n await this.loadWorkflows()\n } catch (error) {\n console.error('Failed to resume workflow:', error)\n alert('Failed to resume workflow')\n }\n }\n\n async deleteWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Are you sure you want to delete this workflow? This action cannot be undone.')) return\n\n try {\n await client.mutate({\n mutation: gql`\n mutation DeleteWorkflow($workflowId: String!) {\n deleteLabelingWorkflow(workflowId: $workflowId)\n }\n `,\n variables: { workflowId }\n })\n\n alert('Workflow deleted successfully')\n await this.loadWorkflows()\n } catch (error) {\n console.error('Failed to delete workflow:', error)\n alert('Failed to delete workflow')\n }\n }\n\n getStatusClass(status: string) {\n switch (status?.toLowerCase()) {\n case 'active':\n return 'status-active'\n case 'draft':\n return 'status-draft'\n case 'paused':\n return 'status-paused'\n case 'completed':\n return 'status-completed'\n case 'failed':\n return 'status-failed'\n default:\n return ''\n }\n }\n\n get filteredWorkflows() {\n return this.workflows.filter(workflow => {\n if (this.filterStatus !== 'all' && workflow.status !== this.filterStatus) {\n return false\n }\n return true\n })\n }\n\n render() {\n if (this.loading) {\n return html`<div class=\"loading\">Loading workflows...</div>`\n }\n\n return html`\n <div class=\"header\">\n <h1>Labeling Workflows</h1>\n <div class=\"toolbar\">\n <button @click=${this.createWorkflow}>Create Workflow</button>\n <button class=\"secondary\" @click=${this.loadWorkflows}>Refresh</button>\n </div>\n </div>\n\n <div class=\"filter-bar\">\n <label>Status:</label>\n <select\n .value=${this.filterStatus}\n @change=${(e: any) => {\n this.filterStatus = e.target.value\n this.requestUpdate()\n }}\n >\n <option value=\"all\">All</option>\n <option value=\"draft\">Draft</option>\n <option value=\"active\">Active</option>\n <option value=\"paused\">Paused</option>\n <option value=\"completed\">Completed</option>\n <option value=\"failed\">Failed</option>\n </select>\n\n <label>Project ID:</label>\n <input\n type=\"number\"\n .value=${this.filterProjectId}\n @input=${(e: any) => (this.filterProjectId = e.target.value)}\n placeholder=\"Filter by project\"\n />\n <button class=\"secondary\" @click=${this.loadWorkflows}>Apply Filter</button>\n </div>\n\n ${this.filteredWorkflows.length === 0\n ? html`\n <div class=\"empty-state\">\n <h2>No workflows found</h2>\n <p>Create your first labeling workflow to get started</p>\n <button @click=${this.createWorkflow}>Create Workflow</button>\n </div>\n `\n : html`\n <div class=\"workflow-list\">\n ${this.filteredWorkflows.map(\n workflow => html`\n <div class=\"workflow-card\">\n <div class=\"workflow-header\">\n <div class=\"workflow-name\">${workflow.name}</div>\n <span class=\"workflow-status ${this.getStatusClass(workflow.status)}\">${workflow.status}</span>\n </div>\n\n <div class=\"workflow-description\">${workflow.description || 'No description'}</div>\n\n <div class=\"workflow-info\">Project ID: ${workflow.projectId}</div>\n <div class=\"workflow-info\">Trigger: ${workflow.triggerType}</div>\n <div class=\"workflow-info\">Created: ${new Date(workflow.createdAt).toLocaleDateString()}</div>\n ${workflow.lastExecutedAt\n ? html`<div class=\"workflow-info\">\n Last executed: ${new Date(workflow.lastExecutedAt).toLocaleDateString()}\n </div>`\n : ''}\n\n <div class=\"workflow-steps\">${workflow.steps.length} steps configured</div>\n\n <div class=\"workflow-actions\">\n <button @click=${(e: Event) => this.editWorkflow(workflow.id, e)}>Edit</button>\n <button @click=${(e: Event) => this.executeWorkflow(workflow.id, e)}>Execute</button>\n ${workflow.status === 'active'\n ? html`<button class=\"secondary\" @click=${(e: Event) => this.pauseWorkflow(workflow.id, e)}>\n Pause\n </button>`\n : workflow.status === 'paused'\n ? html`<button @click=${(e: Event) => this.resumeWorkflow(workflow.id, e)}>Resume</button>`\n : ''}\n <button class=\"secondary\" @click=${(e: Event) => this.deleteWorkflow(workflow.id, e)}>\n Delete\n </button>\n </div>\n </div>\n `\n )}\n </div>\n `}\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"labeling-workflow-list.js","sourceRoot":"","sources":["../../client/pages/labeling-workflow-list.ts"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAC/B,qDAAwD;AACxD,0CAAyC;AACzC,8CAAsE;AACtE,sEAA6B;AAC7B,0CAAyC;AAEzC;;;;GAIG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAAQ;IAA/C;;QAqMI,iBAAY,GAAW,KAAK,CAAA;QAC5B,oBAAe,GAAW,EAAE,CAAA;QACrC,sFAAsF;QACrE,qBAAgB,GAAW,EAAE,CAAA;QAEtC,kBAAa,GAAG,IAAI,yBAAe,CACzC,IAAI,EACJ,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;;;;KAmBF,EACD,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CACnG,CAAA;QAEO,cAAS,GAAG,IAAI,CAAC,MAAM,CA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,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,kBAAkB;oBAC3F,CAAC,CAAC,EAAE;yDAC2B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;;;;;iBAKzF,CACF;;WAEJ;KACN,CAAA;IACH,CAAC;;AA/aU,4DAAwB;AAqM1B;IAAR,IAAA,qBAAK,GAAE;;8DAA6B;AAC5B;IAAR,IAAA,qBAAK,GAAE;;iEAA6B;AAEpB;IAAhB,IAAA,qBAAK,GAAE;;kEAAsC;mCAxMnC,wBAAwB;IADpC,IAAA,6BAAa,EAAC,6BAA6B,CAAC;GAChC,wBAAwB,CAgbpC","sourcesContent":["import { html, css } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { MutationController, QueryController } from '@operato/graphql'\nimport gql from 'graphql-tag'\nimport { navigate } from '@operato/shell'\n\n/**\n * Workflow List Page\n *\n * Displays all labeling workflows with CRUD operations\n */\n@customElement('labeling-workflow-list-page')\nexport class LabelingWorkflowListPage extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n padding: 20px;\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 margin-bottom: 20px;\n }\n\n h1 {\n font-size: 24px;\n margin: 0;\n color: var(--md-sys-color-on-surface);\n }\n\n .toolbar {\n display: flex;\n gap: 10px;\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 }\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 .workflow-list {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));\n gap: 20px;\n }\n\n .workflow-card {\n background-color: var(--md-sys-color-surface-variant);\n border-radius: 8px;\n padding: 20px;\n cursor: pointer;\n transition:\n transform 0.2s,\n box-shadow 0.2s;\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .workflow-card:hover {\n transform: translateY(-4px);\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n }\n\n .workflow-header {\n display: flex;\n justify-content: space-between;\n align-items: start;\n margin-bottom: 10px;\n }\n\n .workflow-name {\n font-size: 18px;\n font-weight: bold;\n margin-bottom: 5px;\n color: var(--md-sys-color-on-surface);\n }\n\n .workflow-status {\n display: inline-block;\n padding: 4px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 500;\n }\n\n .status-active {\n background-color: #4caf50;\n color: white;\n }\n\n .status-draft {\n background-color: #9e9e9e;\n color: white;\n }\n\n .status-paused {\n background-color: #ff9800;\n color: white;\n }\n\n .status-completed {\n background-color: #2196f3;\n color: white;\n }\n\n .status-failed {\n background-color: #f44336;\n color: white;\n }\n\n .workflow-description {\n font-size: 14px;\n color: var(--md-sys-color-on-surface-variant);\n margin-bottom: 10px;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .workflow-info {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-bottom: 5px;\n }\n\n .workflow-steps {\n font-size: 12px;\n color: var(--md-sys-color-on-surface-variant);\n margin-top: 10px;\n padding-top: 10px;\n border-top: 1px solid var(--md-sys-color-outline);\n }\n\n .workflow-actions {\n display: flex;\n gap: 5px;\n margin-top: 15px;\n }\n\n .workflow-actions button {\n flex: 1;\n padding: 8px;\n font-size: 12px;\n }\n\n .loading {\n text-align: center;\n padding: 40px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .empty-state {\n text-align: center;\n padding: 60px 20px;\n color: var(--md-sys-color-on-surface-variant);\n }\n\n .empty-state h2 {\n font-size: 20px;\n margin-bottom: 10px;\n }\n\n .empty-state p {\n font-size: 14px;\n margin-bottom: 20px;\n }\n\n .filter-bar {\n display: flex;\n gap: 10px;\n margin-bottom: 20px;\n align-items: center;\n }\n\n .filter-bar select,\n .filter-bar input {\n padding: 8px 12px;\n border: 1px solid var(--md-sys-color-outline);\n border-radius: 4px;\n background-color: var(--md-sys-color-surface);\n color: var(--md-sys-color-on-surface);\n }\n\n .filter-bar label {\n font-size: 14px;\n color: var(--md-sys-color-on-surface-variant);\n }\n `\n ]\n\n @state() filterStatus: string = 'all'\n @state() filterProjectId: string = ''\n /* The project filter read now - typed into filterProjectId, applied by its button. */\n @state() private appliedProjectId: string = ''\n\n private workflowsRead = new QueryController(\n this,\n gql`\n query GetWorkflows($projectId: Int) {\n labelingWorkflows(projectId: $projectId) {\n items {\n id\n name\n description\n projectId\n status\n triggerType\n steps {\n name\n type\n }\n createdAt\n lastExecutedAt\n }\n }\n }\n `,\n { variables: () => (this.appliedProjectId ? { projectId: parseInt(this.appliedProjectId) } : {}) }\n )\n\n private executing = this.change(gql`\n mutation ExecuteWorkflow($workflowId: String!) {\n executeLabelingWorkflow(input: { workflowId: $workflowId }) {\n executionId\n status\n summary\n }\n }\n `)\n private pausing = this.change(gql`\n mutation PauseWorkflow($workflowId: String!) {\n pauseLabelingWorkflow(workflowId: $workflowId) {\n id\n status\n }\n }\n `)\n private resuming = this.change(gql`\n mutation ResumeWorkflow($workflowId: String!) {\n resumeLabelingWorkflow(workflowId: $workflowId) {\n id\n status\n }\n }\n `)\n private deleting = this.change(gql`\n mutation DeleteWorkflow($workflowId: String!) {\n deleteLabelingWorkflow(workflowId: $workflowId)\n }\n `)\n\n /* Every change reads the workflows again once it is done. */\n private change(mutation: any) {\n return new MutationController(this, mutation, { refetch: () => [this.workflowsRead] })\n }\n\n get workflows(): any[] {\n return this.workflowsRead.data?.labelingWorkflows?.items || []\n }\n\n get loading() {\n return this.workflowsRead.loading\n }\n\n createWorkflow() {\n navigate('workflow-builder')\n }\n\n editWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n navigate(`workflow-builder/${workflowId}`)\n }\n\n async executeWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Execute this workflow?')) return\n\n const data = await this.executing.run({ workflowId })\n if (data) alert(`Workflow execution started!\\nExecution ID: ${data.executeLabelingWorkflow.executionId}`)\n }\n\n async pauseWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Pause this workflow?')) return\n\n if (await this.pausing.run({ workflowId })) alert('Workflow paused successfully')\n }\n\n async resumeWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Resume this workflow?')) return\n\n if (await this.resuming.run({ workflowId })) alert('Workflow resumed successfully')\n }\n\n async deleteWorkflow(workflowId: string, event: Event) {\n event.stopPropagation()\n\n if (!confirm('Are you sure you want to delete this workflow? This action cannot be undone.')) return\n\n if (await this.deleting.run({ workflowId })) alert('Workflow deleted successfully')\n }\n\n getStatusClass(status: string) {\n switch (status?.toLowerCase()) {\n case 'active':\n return 'status-active'\n case 'draft':\n return 'status-draft'\n case 'paused':\n return 'status-paused'\n case 'completed':\n return 'status-completed'\n case 'failed':\n return 'status-failed'\n default:\n return ''\n }\n }\n\n get filteredWorkflows() {\n return this.workflows.filter(workflow => {\n if (this.filterStatus !== 'all' && workflow.status !== this.filterStatus) {\n return false\n }\n return true\n })\n }\n\n render() {\n if (this.loading) {\n return html`<div class=\"loading\">Loading workflows...</div>`\n }\n\n return html`\n <div class=\"header\">\n <h1>Labeling Workflows</h1>\n <div class=\"toolbar\">\n <button @click=${this.createWorkflow}>Create Workflow</button>\n <button class=\"secondary\" @click=${() => this.workflowsRead.refetch()}>Refresh</button>\n </div>\n </div>\n\n <div class=\"filter-bar\">\n <label>Status:</label>\n <select\n .value=${this.filterStatus}\n @change=${(e: any) => {\n this.filterStatus = e.target.value\n this.requestUpdate()\n }}\n >\n <option value=\"all\">All</option>\n <option value=\"draft\">Draft</option>\n <option value=\"active\">Active</option>\n <option value=\"paused\">Paused</option>\n <option value=\"completed\">Completed</option>\n <option value=\"failed\">Failed</option>\n </select>\n\n <label>Project ID:</label>\n <input\n type=\"number\"\n .value=${this.filterProjectId}\n @input=${(e: any) => (this.filterProjectId = e.target.value)}\n placeholder=\"Filter by project\"\n />\n <button class=\"secondary\" @click=${() => (this.appliedProjectId = this.filterProjectId)}>Apply Filter</button>\n </div>\n\n ${this.filteredWorkflows.length === 0\n ? html`\n <div class=\"empty-state\">\n <h2>No workflows found</h2>\n <p>Create your first labeling workflow to get started</p>\n <button @click=${this.createWorkflow}>Create Workflow</button>\n </div>\n `\n : html`\n <div class=\"workflow-list\">\n ${this.filteredWorkflows.map(\n workflow => html`\n <div class=\"workflow-card\">\n <div class=\"workflow-header\">\n <div class=\"workflow-name\">${workflow.name}</div>\n <span class=\"workflow-status ${this.getStatusClass(workflow.status)}\">${workflow.status}</span>\n </div>\n\n <div class=\"workflow-description\">${workflow.description || 'No description'}</div>\n\n <div class=\"workflow-info\">Project ID: ${workflow.projectId}</div>\n <div class=\"workflow-info\">Trigger: ${workflow.triggerType}</div>\n <div class=\"workflow-info\">Created: ${new Date(workflow.createdAt).toLocaleDateString()}</div>\n ${workflow.lastExecutedAt\n ? html`<div class=\"workflow-info\">\n Last executed: ${new Date(workflow.lastExecutedAt).toLocaleDateString()}\n </div>`\n : ''}\n\n <div class=\"workflow-steps\">${workflow.steps.length} steps configured</div>\n\n <div class=\"workflow-actions\">\n <button @click=${(e: Event) => this.editWorkflow(workflow.id, e)}>Edit</button>\n <button @click=${(e: Event) => this.executeWorkflow(workflow.id, e)}>Execute</button>\n ${workflow.status === 'active'\n ? html`<button class=\"secondary\" @click=${(e: Event) => this.pauseWorkflow(workflow.id, e)}>\n Pause\n </button>`\n : workflow.status === 'paused'\n ? html`<button @click=${(e: Event) => this.resumeWorkflow(workflow.id, e)}>Resume</button>`\n : ''}\n <button class=\"secondary\" @click=${(e: Event) => this.deleteWorkflow(workflow.id, e)}>\n Delete\n </button>\n </div>\n </div>\n `\n )}\n </div>\n `}\n `\n }\n}\n"]}
|