Skip to content

Commit 6d62eb1

Browse files
committed
Fixed V2 typing in DatasetHistoryModal
1 parent 4ff3600 commit 6d62eb1

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

src/lib/components/v2/projects/datasets/DatasetHistoryModal.svelte

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Returns the dataset history formatted in JSON hiding some values.
99
*
10-
* @param {import('$lib/types').DatasetHistoryItem} historyItem
10+
* @param {import('$lib/types-v2').DatasetHistoryItemV2} historyItem
1111
* @returns {string}
1212
*/
1313
function formatDatasetHistory(historyItem) {
@@ -16,12 +16,29 @@
1616
...historyItem,
1717
workflowtask: {
1818
...historyItem.workflowtask,
19-
task: {
20-
...historyItem.workflowtask.task,
21-
args_schema: historyItem.workflowtask.task.args_schema ? '[HIDDEN]' : undefined,
22-
docs_info: historyItem.workflowtask.task.docs_info ? '[HIDDEN]' : undefined,
23-
docs_link: historyItem.workflowtask.task.docs_link ? '[HIDDEN]' : undefined
24-
}
19+
task: historyItem.workflowtask.is_legacy_task
20+
? null
21+
: {
22+
...historyItem.workflowtask.task,
23+
args_schema_non_parallel: historyItem.workflowtask.task.args_schema_non_parallel
24+
? '[HIDDEN]'
25+
: undefined,
26+
args_schema_parallel: historyItem.workflowtask.task.args_schema_parallel
27+
? '[HIDDEN]'
28+
: undefined,
29+
docs_info: historyItem.workflowtask.task.docs_info ? '[HIDDEN]' : undefined,
30+
docs_link: historyItem.workflowtask.task.docs_link ? '[HIDDEN]' : undefined
31+
},
32+
task_legacy: historyItem.workflowtask.is_legacy_task
33+
? {
34+
...historyItem.workflowtask.task_legacy,
35+
args_schema: historyItem.workflowtask.task_legacy.args_schema
36+
? '[HIDDEN]'
37+
: undefined,
38+
docs_info: historyItem.workflowtask.task_legacy.docs_info ? '[HIDDEN]' : undefined,
39+
docs_link: historyItem.workflowtask.task_legacy.docs_link ? '[HIDDEN]' : undefined
40+
}
41+
: null
2542
}
2643
},
2744
null,
@@ -40,7 +57,9 @@
4057
{#each Object.entries(dataset.history) as [_, value]}
4158
<li class="list-group-item text-bg-light">
4259
<span>
43-
Task "{value.workflowtask.task.name}", status "{value.status}"
60+
Task "{value.workflowtask.is_legacy_task
61+
? value.workflowtask.task_legacy.name
62+
: value.workflowtask.task.name}", status "{value.status}"
4463
</span>
4564
</li>
4665
<li class="list-group-item text-break">

src/lib/types-v2.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export type DatasetV2 = {
1212
name: string
1313
project_id: number
1414
project: ProjectV2
15-
history: Array<DatasetHistoryItem> | null
15+
history: Array<DatasetHistoryItemV2> | null
1616
zarr_dir: string
1717
filters: {
1818
attributes: { [key: string]: string | number | boolean }
@@ -21,6 +21,12 @@ export type DatasetV2 = {
2121
timestamp_created: string
2222
}
2323

24+
export type DatasetHistoryItemV2 = {
25+
workflowtask: WorkflowTaskV2
26+
status: string
27+
parallelization: object
28+
}
29+
2430
export type ImagePage = {
2531
total_count: number
2632
page_size: number

0 commit comments

Comments
 (0)