diff --git a/documents/src/main/java/de/srsoftware/umbrella/documents/DocumentApi.java b/documents/src/main/java/de/srsoftware/umbrella/documents/DocumentApi.java index 46036fee..a43ac578 100644 --- a/documents/src/main/java/de/srsoftware/umbrella/documents/DocumentApi.java +++ b/documents/src/main/java/de/srsoftware/umbrella/documents/DocumentApi.java @@ -541,6 +541,11 @@ public class DocumentApi extends BaseHandler implements DocumentService { var userCompanyIds = companyService().listCompaniesOf(user).keySet(); var documents = db.find(userCompanyIds,keys,fulltext); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } return sendContent(ex,mapValues(documents)); } diff --git a/frontend/src/routes/search/Search.svelte b/frontend/src/routes/search/Search.svelte index f1fd1813..bdde9757 100644 --- a/frontend/src/routes/search/Search.svelte +++ b/frontend/src/routes/search/Search.svelte @@ -2,13 +2,14 @@ import { onMount } from 'svelte'; import { useTinyRouter } from 'svelte-tiny-router'; import { api, post, target } from '../../urls.svelte.js'; - import { error, yikes } from '../../warn.svelte'; + import { error, warn, yikes } from '../../warn.svelte'; import { t } from '../../translations.svelte.js'; import { display } from '../../time.svelte'; import Bookmark from '../bookmark/Template.svelte'; const router = useTinyRouter(); + let counter = 9; let bookmarks = $state(null); let companies = $state(null); let documents = $state(null); @@ -34,12 +35,12 @@ }); function doSearch(ignored){ + warn(t('searching…')); let url = window.location.origin + window.location.pathname; if (key) url += '?key=' + encodeURI(key); window.history.replaceState(history.state, '', url); const data = { key : key, fulltext : fulltext }; - post(api('bookmark/search'),data).then(handleBookmarks); post(api('company/search '),data).then(handleCompanies); post(api('document/search'),data).then(handleDocuments); @@ -61,6 +62,7 @@ } async function handleBookmarks(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); bookmarks = Object.keys(res).length ? res : null; @@ -70,6 +72,7 @@ } async function handleCompanies(resp){ + quitOne(); if (resp.ok){ const json = await resp.json(); companies = Object.keys(json).length ? json : null; @@ -79,6 +82,7 @@ } async function handleDocuments(resp){ + quitOne(); if (resp.ok){ const json = await resp.json(); documents = Object.keys(json).length ? json : null; @@ -88,6 +92,7 @@ } async function handleNotes(resp){ + quitOne(); if (resp.ok){ const json = await resp.json(); notes = Object.keys(json).length ? json : null; @@ -97,6 +102,7 @@ } async function handleProjects(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); projects = Object.keys(res).length ? res : null; @@ -106,6 +112,7 @@ } async function handleStock(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); stock = Object.keys(res).length ? res : null; @@ -115,6 +122,7 @@ } async function handleTasks(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); tasks = Object.keys(res).length ? res : null; @@ -124,6 +132,7 @@ } async function handleTimes(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); times = Object.keys(res).length ? res : null; @@ -133,6 +142,7 @@ } async function handleWikiPages(resp){ + quitOne(); if (resp.ok){ const res = await resp.json(); pages = Object.keys(res).length ? res : null; @@ -140,6 +150,13 @@ error(resp); } } + + function quitOne(){ + counter--; + if (counter > 0) { + warn(t('searching…')+" "+counter); + } else yikes(); + } $effect(() => doSearch(key))