Compare commits

...
3 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 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
5 changed files with 73 additions and 12 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}
+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>
@@ -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
+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",