implemented task navigation buttons
Build Docker Image / Docker-Build (push) Successful in 2m50s
Build Docker Image / Clean-Registry (push) Successful in 6s

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-07-03 09:29:16 +02:00
parent 167365d0b3
commit 5eead469d3
2 changed files with 40 additions and 5 deletions
@@ -42,8 +42,8 @@ public class Path {
public static final String PROPERTY = "property"; public static final String PROPERTY = "property";
public static final String PURPOSES = "purposes"; public static final String PURPOSES = "purposes";
public static final String READ = "read"; public static final String READ = "read";
public static final String REDIRECT = "redirect"; public static final String REDIRECT = "redirect";
public static final String SEARCH = "search"; public static final String SEARCH = "search";
public static final String SELECT = "select"; public static final String SELECT = "select";
+38 -3
View File
@@ -81,6 +81,10 @@
router.navigate(`/project/${project.id}/view`) router.navigate(`/project/${project.id}/view`)
} }
function gotoTask(tid){
if (id) router.navigate(`/task/${tid}/view`)
}
function handleUpdateEvent(evt){ function handleUpdateEvent(evt){
let json = JSON.parse(evt.data); let json = JSON.parse(evt.data);
if (json.task) { if (json.task) {
@@ -119,7 +123,8 @@
if (task.show_closed) show_closed = true; if (task.show_closed) show_closed = true;
loadChildren(); loadChildren();
if (task.project_id) loadProject(); if (task.project_id) loadProject();
if (task.parent_task_id) loadParent(); if (task.parent_task_id) await loadParent();
loadSiblings();
} else error(resp); } else error(resp);
} }
@@ -129,13 +134,36 @@
if (resp.ok){ if (resp.ok){
project = await resp.json(); project = await resp.json();
yikes(); yikes();
} else error(await resp.text()); } else error(resp);
}
async function loadSiblings(){
const url = api(`task/list`);
const select = task.parent_task_id ? {parent_task_id:task.parent_task_id} : {project_id: task.project_id};
select.show_closed = false;
const res = await post(url,select);
if (res.ok){
task.siblings = await res.json();
let last = null;
let before = undefined;
let after = null;
for (let [sid, t] of Object.entries(task.siblings).toSorted((a,b) => a[1].name.localeCompare(b[1].name))){
if (before !== undefined) {
after = +sid;
break;
}
if (id == sid) before = last;
last = +sid;
}
task.before = before;
task.after = after;
} else error(res)
} }
function parentClick(ev){ function parentClick(ev){
ev.preventDefault(); ev.preventDefault();
if (!task.parent_task_id) return; if (!task.parent_task_id) return;
router.navigate(`/task/${task.parent_task_id}/view`); gotoTask(task.parent_task_id);
return false; return false;
} }
@@ -232,10 +260,17 @@
{/if} {/if}
<button class="symbol" title={t('edit')} onclick={parentRightClick}></button> <button class="symbol" title={t('edit')} onclick={parentRightClick}></button>
{/if} {/if}
</div> </div>
<div>{t('task')}</div> <div>{t('task')}</div>
<div class="name"> <div class="name">
<LineEditor bind:value={task.name} editable={true} onSet={val => update({name:val})} /> <LineEditor bind:value={task.name} editable={true} onSet={val => update({name:val})} />
{#if task.before}
<button class="symbol" title={task.siblings[task.before].name} onclick={e => gotoTask(task.before)}></button>
{/if}
{#if task.after}
<button class="symbol" title={task.siblings[task.after].name} onclick={e => gotoTask(task.after)}></button>
{/if}
<button class="symbol" title={t('settings')} onclick={toggleSettings}></button> <button class="symbol" title={t('settings')} onclick={toggleSettings}></button>
<button class="symbol" title={t('timetracking')} onclick={addTime}></button> <button class="symbol" title={t('timetracking')} onclick={addTime}></button>
</div> </div>