Skip to content

Commit 14af21e

Browse files
committed
Moved tasks table links to the info modal
1 parent d7cfe58 commit 14af21e

File tree

5 files changed

+56
-8
lines changed

5 files changed

+56
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Added a "Get URL" button to image list (\#759);
1515
* Supported converter task types (\#759);
1616
* Made user sorting case insensitive (\#759);
17+
* Moved tasks table links to the info modal (\#759);
1718

1819
# 1.16.2
1920

components/src/lib/tasks/FilteredTasksTable.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/** @type {Array<import('../types/api').TaskGroupV2>} */
88
export let taskGroups;
99
export let showAuthorsInSeparateColumn = true;
10+
export let showDocLinksInTable = false;
1011
1112
/** @type {import('../types/api').WorkflowTasksTableRowGroup[]} */
1213
let allRows = [];
@@ -380,7 +381,7 @@
380381
{#if task.taskVersions[task.selectedVersion]}
381382
<tr>
382383
<td class="task-name-col">
383-
{#if task.taskVersions[task.selectedVersion].docs_link}
384+
{#if showDocLinksInTable && task.taskVersions[task.selectedVersion].docs_link}
384385
<a href={task.taskVersions[task.selectedVersion].docs_link} target="_blank">
385386
{task.taskVersions[task.selectedVersion].task_name}
386387
</a>

src/lib/components/v2/workflow/AddWorkflowTaskModal.svelte

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
let loading = false;
2121
let addingTask = false;
22+
let showDocLinksInTable = false;
2223
2324
/** @type {Array<import('fractal-components/types/api').TaskGroupV2>} */
2425
let taskGroups = [];
@@ -94,6 +95,30 @@
9495
}
9596
);
9697
}
98+
99+
/**
100+
* @param {import('fractal-components/types/api').TasksTableRow} taskRow
101+
*/
102+
function showTaskInfoButton(taskRow) {
103+
return taskRow.docs_info || (!showDocLinksInTable && taskRow.docs_link);
104+
}
105+
106+
/**
107+
* @param {import('fractal-components/types/api').TasksTableRow} taskRow
108+
*/
109+
function getTaskInfo(taskRow) {
110+
let info = '';
111+
if (taskRow.docs_info) {
112+
info += taskRow.docs_info;
113+
}
114+
if (!showDocLinksInTable && taskRow.docs_link) {
115+
if (taskRow.docs_info) {
116+
info += '\n\n---\n'; // markdown hr
117+
}
118+
info += taskRow.docs_link;
119+
}
120+
return formatMarkdown(info);
121+
}
97122
</script>
98123

99124
<Modal
@@ -124,8 +149,8 @@
124149
</svelte:fragment>
125150
<svelte:fragment slot="extra-columns" let:task>
126151
<td>
127-
{#if task.docs_info}
128-
<PropertyDescription description={formatMarkdown(task.docs_info)} html={true} />
152+
{#if showTaskInfoButton(task)}
153+
<PropertyDescription description={getTaskInfo(task)} html={true} />
129154
{/if}
130155
</td>
131156
<td>

src/routes/v2/tasks/+page.svelte

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
1414
/** @type {import('fractal-components/types/api').TasksTableRow|null} */
1515
let selectedTaskRow = null;
16+
let showDocLinksInTable = false;
1617
1718
/**
1819
* @param {import('fractal-components/types/api').TasksTableRow} taskRow
@@ -22,6 +23,13 @@
2223
modal.show();
2324
}
2425
26+
/**
27+
* @param {import('fractal-components/types/api').TasksTableRow} taskRow
28+
*/
29+
function showInfoButton(taskRow) {
30+
return taskRow.docs_info || (!showDocLinksInTable && taskRow.docs_link);
31+
}
32+
2533
onMount(() => {
2634
const genericSearchInput = document.getElementById('taskGenericSearchInput');
2735
if (genericSearchInput instanceof HTMLElement) {
@@ -46,7 +54,7 @@
4654
{/if}
4755

4856
<div class="container mt-2">
49-
<FilteredTasksTable {taskGroups}>
57+
<FilteredTasksTable {taskGroups} {showDocLinksInTable}>
5058
<svelte:fragment slot="extra-columns-colgroup">
5159
<col width="60" />
5260
</svelte:fragment>
@@ -55,7 +63,7 @@
5563
</svelte:fragment>
5664
<svelte:fragment slot="extra-columns" let:task>
5765
<td>
58-
{#if task.docs_info}
66+
{#if showInfoButton(task)}
5967
<button class="btn btn-info" on:click={() => showDocsInfoModal(task)}>
6068
<i class="bi bi-info-circle" />
6169
</button>
@@ -70,7 +78,20 @@
7078
<h5 class="modal-title">{selectedTaskRow?.task_name}</h5>
7179
</svelte:fragment>
7280
<svelte:fragment slot="body">
73-
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
74-
{@html formatMarkdown(selectedTaskRow?.docs_info)}
81+
{#if selectedTaskRow?.docs_info}
82+
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
83+
{@html formatMarkdown(selectedTaskRow?.docs_info)}
84+
{/if}
85+
{#if !showDocLinksInTable && selectedTaskRow?.docs_link}
86+
{#if selectedTaskRow?.docs_info}
87+
<hr />
88+
{/if}
89+
<div>
90+
Docs link:
91+
<a href={selectedTaskRow?.docs_link} target="_blank">
92+
{selectedTaskRow?.docs_link}
93+
</a>
94+
</div>
95+
{/if}
7596
</svelte:fragment>
7697
</Modal>

tasks-list/src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
</script>
4040

41-
<FilteredTasksTable taskGroups={tasks}>
41+
<FilteredTasksTable taskGroups={tasks} showDocLinksInTable={true}>
4242
<svelte:fragment slot="extra-columns-colgroup">
4343
<col width="60" />
4444
<col width="60" />

0 commit comments

Comments
 (0)