feat(web,server): search people (#5703)
* feat: search peoples * fix: responsive design * use existing count * generate sql file * fix: tests * remove visible people * fix: merge, hide... * use component * fix: linter * chore: regenerate api * fix: change name when searching for a face * save search * remove duplicate * use enums for query parameters * fix: increase to 20 for the local search * use constants * simplify * fix: number of people more visible * fix: merge * fix: search * fix: loading spinner position * pr feedback
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
NotificationType,
|
||||
notificationController,
|
||||
} from '$lib/components/shared-components/notification/notification';
|
||||
import { AppRoute } from '$lib/constants';
|
||||
import { AppRoute, QueryParameter, maximumLengthSearchPeople, timeBeforeShowLoadingSpinner } from '$lib/constants';
|
||||
import { createAssetInteractionStore } from '$lib/stores/asset-interaction.store';
|
||||
import { AssetStore } from '$lib/stores/assets.store';
|
||||
import { websocketStore } from '$lib/stores/websocket';
|
||||
@@ -90,10 +90,10 @@
|
||||
let isSearchingPeople = false;
|
||||
|
||||
const searchPeople = async () => {
|
||||
if ((people.length < 20 && name.startsWith(searchWord)) || name === '') {
|
||||
if ((people.length < maximumLengthSearchPeople && name.startsWith(searchWord)) || name === '') {
|
||||
return;
|
||||
}
|
||||
const timeout = setTimeout(() => (isSearchingPeople = true), 100);
|
||||
const timeout = setTimeout(() => (isSearchingPeople = true), timeBeforeShowLoadingSpinner);
|
||||
try {
|
||||
const { data } = await api.searchApi.searchPerson({ name });
|
||||
people = data;
|
||||
@@ -120,8 +120,8 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const action = $page.url.searchParams.get('action');
|
||||
const getPreviousRoute = $page.url.searchParams.get('previousRoute');
|
||||
const action = $page.url.searchParams.get(QueryParameter.ACTION);
|
||||
const getPreviousRoute = $page.url.searchParams.get(QueryParameter.PREVIOUS_ROUTE);
|
||||
if (getPreviousRoute && !isExternalUrl(getPreviousRoute)) {
|
||||
previousRoute = getPreviousRoute;
|
||||
}
|
||||
@@ -343,8 +343,8 @@
|
||||
|
||||
const handleGoBack = () => {
|
||||
viewMode = ViewMode.VIEW_ASSETS;
|
||||
if ($page.url.searchParams.has('action')) {
|
||||
$page.url.searchParams.delete('action');
|
||||
if ($page.url.searchParams.has(QueryParameter.ACTION)) {
|
||||
$page.url.searchParams.delete(QueryParameter.ACTION);
|
||||
goto($page.url);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user