diff --git a/models/view/src/index.ts b/models/view/src/index.ts index 3657028b34..5a01285d7f 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -63,9 +63,9 @@ import type { ViewOptionsModel, ViewOptions, AllValuesFunc, + GetAllValuesFunc, LinkProvider, - ObjectPanel, - AllValuesFuncGetter + ObjectPanel } from '@hcengineering/view' import view from './plugin' @@ -221,7 +221,7 @@ export class TSortFuncs extends TClass implements ClassSortFuncs { @Mixin(view.mixin.AllValuesFunc, core.class.Class) export class TAllValuesFunc extends TClass implements AllValuesFunc { - func!: Resource + func!: GetAllValuesFunc } @Model(view.class.ViewletPreference, preference.class.Preference) diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts index 1780b40982..cbd5c52140 100644 --- a/plugins/tracker-resources/src/plugin.ts +++ b/plugins/tracker-resources/src/plugin.ts @@ -17,7 +17,7 @@ import type { IntlString, Metadata, Resource } from '@hcengineering/platform' import { mergeIds } from '@hcengineering/platform' import { IssueDraft } from '@hcengineering/tracker' import { AnyComponent, Location } from '@hcengineering/ui' -import { AllValuesFuncGetter, SortFunc, Viewlet, ViewletDescriptor, ViewQueryAction } from '@hcengineering/view' +import { GetAllValuesFunc, SortFunc, Viewlet, ViewletDescriptor, ViewQueryAction } from '@hcengineering/view' import tracker, { trackerId } from '../../tracker/lib' export default mergeIds(trackerId, tracker, { @@ -389,8 +389,8 @@ export default mergeIds(trackerId, tracker, { IssuePrioritySort: '' as SortFunc, SprintSort: '' as SortFunc, SubIssueQuery: '' as ViewQueryAction, - GetAllPriority: '' as Resource, - GetAllComponents: '' as Resource, - GetAllSprints: '' as Resource + GetAllPriority: '' as GetAllValuesFunc, + GetAllComponents: '' as GetAllValuesFunc, + GetAllSprints: '' as GetAllValuesFunc } }) diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index aed867abde..f7f16001cd 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -24,7 +24,6 @@ import core, { DocumentUpdate, Ref, SortingOrder, - Space, StatusCategory, StatusValue, toIdMap, @@ -464,25 +463,19 @@ export function subIssueQuery (value: boolean, query: DocumentQuery): Doc async function getAllSomething ( _class: Ref>, - space: Ref | undefined, + query: DocumentQuery | undefined, onUpdate: () => void, queryId: Ref ): Promise { const promise = new Promise>>((resolve, reject) => { let refresh: boolean = false const lq = CategoryQuery.getLiveQuery(queryId) - refresh = lq.query( - _class, - { - space - }, - (res) => { - const result = res.map((p) => p._id) - CategoryQuery.results.set(queryId, result) - resolve(result) - onUpdate() - } - ) + refresh = lq.query(_class, query ?? {}, (res) => { + const result = res.map((p) => p._id) + CategoryQuery.results.set(queryId, result) + resolve(result) + onUpdate() + }) if (!refresh) { resolve(CategoryQuery.results.get(queryId) ?? []) @@ -492,7 +485,7 @@ async function getAllSomething ( } export async function getAllPriority ( - space: Ref | undefined, + query: DocumentQuery | undefined, onUpdate: () => void, queryId: Ref ): Promise { @@ -500,19 +493,19 @@ export async function getAllPriority ( } export async function getAllComponents ( - space: Ref | undefined, + query: DocumentQuery | undefined, onUpdate: () => void, queryId: Ref ): Promise { - return await getAllSomething(tracker.class.Component, space, onUpdate, queryId) + return await getAllSomething(tracker.class.Component, query, onUpdate, queryId) } export async function getAllSprints ( - space: Ref | undefined, + query: DocumentQuery | undefined, onUpdate: () => void, queryId: Ref ): Promise { - return await getAllSomething(tracker.class.Sprint, space, onUpdate, queryId) + return await getAllSomething(tracker.class.Sprint, query, onUpdate, queryId) } export function subIssueListProvider (subIssues: Issue[], target: Ref): void { diff --git a/plugins/view-resources/src/components/list/List.svelte b/plugins/view-resources/src/components/list/List.svelte index dbb3f1f9ad..27c45f47e7 100644 --- a/plugins/view-resources/src/components/list/List.svelte +++ b/plugins/view-resources/src/components/list/List.svelte @@ -147,6 +147,7 @@ {docs} {_class} {space} + query={resultQuery} {lookup} loadingPropsLength={getLoadingElementsLength(loadingProps, options)} {baseMenuClass} diff --git a/plugins/view-resources/src/components/list/ListCategories.svelte b/plugins/view-resources/src/components/list/ListCategories.svelte index f0a3576a2d..b779d48138 100644 --- a/plugins/view-resources/src/components/list/ListCategories.svelte +++ b/plugins/view-resources/src/components/list/ListCategories.svelte @@ -13,7 +13,7 @@ // limitations under the License. -->