Compare commits

...
5 Commits
Author SHA1 Message Date
StephanRichter 1553546f66 Merge branch 'markdown-norender'
Build Docker Image / Docker-Build (push) Successful in 1m4s
Build Docker Image / Clean-Registry (push) Successful in 6s
2026-10-08 01:34:53 +02:00
StephanRichter d2d534cb14 fixed code so it works for task list in project view
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-10-08 01:28:00 +02:00
StephanRichter e41932cb9f avoiding markdown rendering when loading project tasks
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-10-08 00:59:58 +02:00
StephanRichter 75814a86eb altered tag search in order to preserve case of input
re-set focus on inpt when selection option on autocomplete field

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-10-05 14:37:25 +02:00
StephanRichter 072ba5d4e5 implemented sorting for task list
Build Docker Image / Docker-Build (push) Successful in 1m30s
Build Docker Image / Clean-Registry (push) Successful in 7s
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
2026-10-05 13:50:56 +02:00
9 changed files with 89 additions and 28 deletions
+3 -2
View File
@@ -18,7 +18,7 @@
let selected = $state(null);
let candidates = $state([]);
let timer = null;
let list_elem;
let input, list_elem;
async function dummyGetCandidates(text){
console.warn(`getCandidates(${text}) not overridden!`);
@@ -117,6 +117,7 @@
function select(index){
candidate = candidates[index];
disableDropdown();
input.focus();
onSelect(candidate);
}
@@ -149,7 +150,7 @@
</style>
<span class="autocomplete">
<input type="text" bind:value={candidate.display} {onkeyup} autofocus={autofocus} {id} {onblur} disabled={!enabled} />
<input bind:this={input} type="text" bind:value={candidate.display} {onkeyup} autofocus={autofocus} {id} {onblur} disabled={!enabled} />
{#if candidates && candidates.length > 0}
<ul bind:this={list_elem} class="suggestions" tabindex="-1">
{#each candidates as candidate,i}
+1 -1
View File
@@ -190,7 +190,7 @@
const url = api('task/list');
selector.show_closed = true;
selector.no_index = true;
selector.rendered = false;
selector.render = false;
var resp = await post(url,selector);
if (resp.ok){
var json = await resp.json();
+3 -6
View File
@@ -108,13 +108,10 @@
const url = api('task/list');
const data = {
project_id:+id,
show_closed:project.show_closed
show_closed:project.show_closed,
render: false
}
const resp = await fetch(url,{
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
const resp = await post(url,data);
if (resp.ok){
tasks = {};
est_time.sum = 0;
+54 -5
View File
@@ -16,6 +16,7 @@
let loading = $state(true);
let map = $state({});
let hidden = $state({});
let sort = $state({key:'',asc:true});
async function changeState(idx,state){
const task = tasks[idx];
@@ -37,6 +38,11 @@
changeState(idx,'COMPLETE');
}
function cursor(key){
if (key != sort.key) return 'asc';
return sort.asc ? 'desc' : 'asc';
}
function edit(tid){
router.navigate(`/task/${tid}/edit`);
}
@@ -96,6 +102,40 @@
changeState(idx,'PENDING');
}
function compare(task1, task2, key){
if (key == 'project') {
let pj_id_A = task1['project_id'];
let pj_id_B = task2['project_id'];
if (pj_id_A == pj_id_B) {
let parentA = "";
if (task1['parent_task_id']){
let parent = map[task1['parent_task_id']];
if (parent) parentA = parent['name'];
}
let parentB = "";
if (task2['parent_task_id']){
let parent = map[task2['parent_task_id']];
if (parent) parentB = parent['name'];
}
return parentA.localeCompare(parentB);
}
return projects[pj_id_A]['name'].localeCompare(projects[pj_id_B]['name']);
}
if (key == 'state') return task1['status'] - task2['status'];
let valA = task1[key] || '';
let valB = task2[key] || '';
return valA.localeCompare(valB);
}
function resort(key){
if (loading) return;
if (sort.key != key) {
sort.asc = true;
sort.key = key;
} else sort.asc = !sort.asc;
tasks = tasks.toSorted((a,b) => sort.asc ? compare(a,b,key) : compare(b,a,key));
}
function start(idx){
changeState(idx,'STARTED');
}
@@ -103,6 +143,15 @@
onMount(load);
</script>
<style>
.asc{
cursor: s-resize;
}
.desc{
cursor: n-resize;
}
</style>
<svelte:head>
<title>Umbrella – {t('tasks')}</title>
</svelte:head>
@@ -124,11 +173,11 @@
<table>
<thead>
<tr>
<th>{t('name')}</th>
<th>{t('project')} ({t('parent_task')})</th>
<th>{t('state')}</th>
<th>{t('start_date')}</th>
<th>{t('due_date')}</th>
<th title={t('sort')} class={cursor('name')} onclick={e => resort('name')}>{t('name')}</th>
<th title={t('sort')} class={cursor('project')} onclick={e => resort('project')}>{t('project')} ({t('parent_task')})</th>
<th title={t('sort')} class={cursor('state')} onclick={e => resort('state')}>{t('state')}</th>
<th title={t('sort')} class={cursor('start_date')} onclick={e => resort('start_date')}>{t('start_date')}</th>
<th title={t('sort')} class={cursor('due_date')} onclick={e => resort('due_date')}>{t('due_date')}</th>
<th>{t('users')}</th>
<th>{t('actions')}</th>
</tr>
+2 -1
View File
@@ -80,7 +80,8 @@
const url = api('task/list');
const data = {
parent_task_id : +task.id,
show_closed : show_closed
show_closed : show_closed,
render : false
};
if (task.show_closed) data.show_closed = true;
const resp = await post(url,data);
@@ -40,6 +40,11 @@ public class TagModule extends BaseHandler implements TagService {
tagDb.deleteEntity(module,entityId);
}
@Override
public void deleteEntity(String module, long entityId, long userId) {
tagDb.deleteEntity(module,entityId,userId);
}
@Override
public boolean doDelete(Path path, HttpExchange ex) throws IOException {
addCors(ex);
@@ -137,9 +142,11 @@ public class TagModule extends BaseHandler implements TagService {
return sendContent(ex,tuples.map(t -> Map.of(TAG,t.a,COUNT,t.b)));
}
@Override
public void deleteEntity(String module, long entityId, long userId) {
tagDb.deleteEntity(module,entityId,userId);
private String modifyCase(String entry, String key, String lKey) {
if (entry.toLowerCase().startsWith(lKey)) return key + entry.substring(key.length());
var pos = entry.toLowerCase().indexOf(" "+lKey);
if (pos >= 0) entry = entry.substring(0,pos+1)+key+entry.substring(pos+key.length()+1);
return entry;
}
@Override
@@ -158,8 +165,10 @@ public class TagModule extends BaseHandler implements TagService {
return tagDb.search(key, user);
}
private boolean searchTags(HttpExchange ex, String head, UmbrellaUser user) throws IOException {
return sendContent(ex, search(head, user));
private boolean searchTags(HttpExchange ex, String key, UmbrellaUser user) throws IOException {
var tags = search(key, user);
var lKey = key.toLowerCase();
return sendContent(ex, tags.stream().map(entry -> modifyCase(entry, key, lKey)));
}
@Override
@@ -475,24 +475,26 @@ public class TaskModule extends BaseHandler implements TaskService {
var noIndex = json.has(NO_INDEX) && json.get(NO_INDEX) instanceof Boolean bool ? bool : false;
var projectId = json.has(PROJECT_ID) && json.get(PROJECT_ID) instanceof Number number ? number.longValue() : null;
var parentTaskId = json.has(PARENT_TASK_ID) && json.get(PARENT_TASK_ID) instanceof Number number ? number.longValue() : null;
var markdown = !json.has(RENDERED) || !(json.get(RENDERED) instanceof Boolean render) || render;
var render = !json.has(RENDER) || !(json.get(RENDER) instanceof Boolean bool) || bool;
if (isSet(projectId)) {
if (parentTaskId == null) {
var list = taskDb.listRootTasks(projectId, user, showClosed);
return sendContent(ex, mapTasks(list,markdown));
return sendContent(ex, mapTasks(list,render));
}
var projectTasks = taskDb.listProjectTasks(projectId, parentTaskId, noIndex);
loadMembers(projectTasks.values());
var tags = tagService().getTags(TASK,projectTasks.keySet(),user);
projectTasks = addTags(projectTasks, tags);
return sendContent(ex, mapTasks(projectTasks, markdown));
return sendContent(ex, mapTasks(projectTasks, render));
}
if (isSet(parentTaskId)) return sendContent(ex, mapValues(taskDb.listChildrenOf(parentTaskId, user, showClosed)));
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
var tasks = taskDb.load(taskIds);
if (isSet(taskIds)) return sendContent(ex, mapTasks(tasks,markdown));
return sendEmptyResponse(HTTP_NOT_IMPLEMENTED, ex);
Map<Long, Task> tasks;
if (!isSet(parentTaskId)) {
var taskIds = json.has(IDS) && json.get(IDS) instanceof JSONArray ids ? ids.toList().stream().map(Object::toString).map(Long::parseLong).toList() : null;
if (!isSet(taskIds)) return sendEmptyResponse(HTTP_NOT_IMPLEMENTED,ex);
tasks = taskDb.load(taskIds);
} else tasks = taskDb.listChildrenOf(parentTaskId,user,showClosed);
return sendContent(ex, mapTasks(tasks,render));
}
private Map<Long, Task> addTags(Map<Long, Task> taskList, Map<Long, ? extends Collection<String>> tags) {
+1
View File
@@ -357,6 +357,7 @@
"show": "anzeigen",
"show_closed": "geschlossene anzeigen",
"show_kanban": "Kanban-Ansicht",
"sort": "sortieren",
"source": "Quelle",
"start": "Start",
"start_date": "Startdatum",
+1
View File
@@ -357,6 +357,7 @@
"show": "show",
"show_closed": "show closed",
"show_kanban": "Kanban",
"sort": "sort",
"source": "source",
"start": "start",
"start_date": "start date",