Tracker: issues search (#2129)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2022-06-23 09:04:51 +03:00 committed by GitHub
parent 075e1678df
commit 14de8334ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 5 deletions

View File

@ -34,7 +34,7 @@
}) })
</script> </script>
<div class="ac-header divide full"> <div class="ac-header full">
{#if space} {#if space}
<div class="ac-header__wrap-description"> <div class="ac-header__wrap-description">
<div class="ac-header__wrap-title" on:click> <div class="ac-header__wrap-title" on:click>

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { Icon, TabList } from '@anticrm/ui' import { Icon, TabList, SearchEdit } from '@anticrm/ui'
import { Viewlet } from '@anticrm/view' import { Viewlet } from '@anticrm/view'
import { FilterButton, setActiveViewletId } from '@anticrm/view-resources' import { FilterButton, setActiveViewletId } from '@anticrm/view-resources'
import tracker from '../../plugin' import tracker from '../../plugin'
@ -9,6 +9,7 @@
export let viewlet: WithLookup<Viewlet> | undefined export let viewlet: WithLookup<Viewlet> | undefined
export let viewlets: WithLookup<Viewlet>[] = [] export let viewlets: WithLookup<Viewlet>[] = []
export let label: string export let label: string
export let search: string
$: viewslist = viewlets.map((views) => { $: viewslist = viewlets.map((views) => {
return { return {
@ -25,6 +26,7 @@
<span class="ac-header__title">{label}</span> <span class="ac-header__title">{label}</span>
<div class="ml-4"><FilterButton _class={tracker.class.Issue} /></div> <div class="ml-4"><FilterButton _class={tracker.class.Issue} /></div>
</div> </div>
<SearchEdit bind:value={search} on:change={() => {}} />
{#if viewlets.length > 1} {#if viewlets.length > 1}
<TabList <TabList
items={viewslist} items={viewslist}

View File

@ -19,7 +19,14 @@
export let panelWidth: number = 0 export let panelWidth: number = 0
let viewlet: WithLookup<Viewlet> | undefined = undefined let viewlet: WithLookup<Viewlet> | undefined = undefined
let resultQuery: DocumentQuery<Issue> = {} let search = ''
let searchQuery: DocumentQuery<Issue> = { ...query }
function updateSearchQuery (search: string): void {
searchQuery = search === '' ? { ...query } : { ...query, $search: search }
}
$: updateSearchQuery(search)
$: if (query) updateSearchQuery(search)
let resultQuery: DocumentQuery<Issue> = { ...searchQuery }
const client = getClient() const client = getClient()
@ -63,7 +70,7 @@
</script> </script>
{#if currentSpace} {#if currentSpace}
<IssuesHeader {viewlets} {label} bind:viewlet> <IssuesHeader {viewlets} {label} bind:viewlet bind:search>
<svelte:fragment slot="extra"> <svelte:fragment slot="extra">
{#if asideFloat && $$slots.aside} {#if asideFloat && $$slots.aside}
<Button <Button
@ -78,7 +85,7 @@
{/if} {/if}
</svelte:fragment> </svelte:fragment>
</IssuesHeader> </IssuesHeader>
<FilterBar _class={tracker.class.Issue} {query} on:change={(e) => (resultQuery = e.detail)} /> <FilterBar _class={tracker.class.Issue} query={searchQuery} on:change={(e) => (resultQuery = e.detail)} />
<div class="flex w-full h-full clear-mins"> <div class="flex w-full h-full clear-mins">
{#if viewlet} {#if viewlet}
<IssuesContent {currentSpace} {viewlet} query={resultQuery} /> <IssuesContent {currentSpace} {viewlet} query={resultQuery} />