finished implementation of tag loading when loading project tasks

This commit is contained in:
2025-09-24 10:27:43 +02:00
parent 404b8263a9
commit 1d7e508f1a
5 changed files with 25 additions and 37 deletions

View File

@@ -18,7 +18,6 @@
let highlight = $state({});
let filter = $derived(filter_input.toLowerCase());
let project = $state(null);
let ready = $state(false);
let tasks = $state({});
let users = {};
let columns = $derived(project.allowed_states?Object.keys(project.allowed_states).length+1:1);
@@ -96,8 +95,6 @@
try {
await loadProject();
await loadTasks({project_id:+id,parent_task_id:0});
ready = true;
loadTags();
} catch (ignored) {}
}
@@ -120,31 +117,6 @@
}
}
async function loadTag(task){
try {
const url = api(`tags/task/${task.id}`);
const resp = await fetch(url,{
credentials:'include',
signal: signal
});
if (resp.ok) {
const tags = await resp.json();
if (tags.length) task.tags = tags.sort();
}
} catch (ignored) {}
}
function loadTags(){
for (let uid of Object.keys(tasks)){
for (let state of Object.keys(tasks[uid])){
for (let tid of Object.keys(tasks[uid][state])){
const task = tasks[uid][state][tid];
loadTag(task);
}
}
}
}
async function loadTasks(selector){
const url = api('task/list');
selector.show_closed = true;
@@ -205,7 +177,7 @@
<span class="error">{error}</span>
{/if}
{#if ready}
{#if project}
<div class="kanban" style="display: grid; grid-template-columns: {`repeat(${columns}, auto)`}">
<span class="filter">
<input type="text" bind:value={filter_input} autofocus />