workin on search based on tags

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-11-10 19:18:17 +01:00
parent d3c325b608
commit 84f92ac664
2 changed files with 60 additions and 8 deletions
+39 -4
View File
@@ -9,7 +9,7 @@
import Bookmark from '../bookmark/Template.svelte';
const router = useTinyRouter();
let counter = 9;
let counter = 10;
let bookmarks = $state(null);
let companies = $state(null);
let documents = $state(null);
@@ -18,14 +18,13 @@
let pages = $state(null);
let projects = $state(null);
let stock = $state(null);
let tags = $state(null);
let tasks = $state(null);
let times = $state(null);
function doSearch(key){
warn(t('searching…'));
console.log("doSearch");
const data = { key : key, fulltext : fulltext };
post(api('bookmark/search'),data).then(handleBookmarks);
post(api('company/search '),data).then(handleCompanies);
@@ -34,6 +33,7 @@
post(api('project/search' ),data).then(handleProjects);
post(api('task/search' ),data).then(handleTasks);
post(api('stock/search' ),data).then(handleStock);
post(api('tags/search' ),data).then(handleTags);
post(api('time/search' ),data).then(handleTimes);
post(api('wiki/search' ),data).then(handleWikiPages);
}
@@ -110,6 +110,20 @@
}
}
async function handleTags(resp){
quitOne();
if (resp.ok){
const res = await resp.json();
tags = Object.keys(res).length ? res : null;
for (let [module, ids] of Object.entries(tags)){
console.log("found "+module+" with tags:");
// TODO: load entities from module
}
} else {
error(resp);
}
}
async function handleTasks(resp){
quitOne();
if (resp.ok){
@@ -364,3 +378,24 @@
</ul>
</fieldset>
{/if}
{#if tags}
<fieldset>
<legend>
{t('tags')}
</legend>
<ul>
{#each Object.entries(tags) as [module,items]}
{#each items as item}
<li>
<a href="/{module}/{item}/view" {onclick} >{module} {item}</a>
</li>
{/each}
{/each}
</ul>
</fieldset>
{/if}
<pre>
<code>
{JSON.stringify(tags,null,2)}
</code>
</pre>