mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 23:00:13 +00:00
TSK-1079 Баг Отображение Неактивных пустых групп в разделе Активных задач (#2944)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
de11193e12
commit
6aa026dd90
@ -19,7 +19,15 @@
|
|||||||
import { AnyComponent } from '@hcengineering/ui'
|
import { AnyComponent } from '@hcengineering/ui'
|
||||||
import { AttributeModel, BuildModelKey, CategoryOption, ViewOptionModel, ViewOptions } from '@hcengineering/view'
|
import { AttributeModel, BuildModelKey, CategoryOption, ViewOptionModel, ViewOptions } from '@hcengineering/view'
|
||||||
import { createEventDispatcher, onDestroy } from 'svelte'
|
import { createEventDispatcher, onDestroy } from 'svelte'
|
||||||
import { buildModel, getAdditionalHeader, getCategories, getGroupByValues, getPresenter, groupBy } from '../../utils'
|
import {
|
||||||
|
buildModel,
|
||||||
|
concatCategories,
|
||||||
|
getAdditionalHeader,
|
||||||
|
getCategories,
|
||||||
|
getGroupByValues,
|
||||||
|
getPresenter,
|
||||||
|
groupBy
|
||||||
|
} from '../../utils'
|
||||||
import { CategoryQuery, noCategory } from '../../viewOptions'
|
import { CategoryQuery, noCategory } from '../../viewOptions'
|
||||||
import ListCategory from './ListCategory.svelte'
|
import ListCategory from './ListCategory.svelte'
|
||||||
|
|
||||||
@ -85,7 +93,7 @@
|
|||||||
const f = await getResource(categoryFunc.action)
|
const f = await getResource(categoryFunc.action)
|
||||||
const res = hierarchy.clone(await f(_class, query, groupByKey, update, queryId, $statusStore))
|
const res = hierarchy.clone(await f(_class, query, groupByKey, update, queryId, $statusStore))
|
||||||
if (res !== undefined) {
|
if (res !== undefined) {
|
||||||
categories = Array.from(new Set([...categories, ...res]))
|
categories = concatCategories(res, categories)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,6 +655,33 @@ export async function getCategories (
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function concatCategories (arr1: CategoryType[], arr2: CategoryType[]): CategoryType[] {
|
||||||
|
const uniqueValues: Set<string | number | undefined> = new Set()
|
||||||
|
const uniqueObjects: Map<string | number, StatusValue> = new Map()
|
||||||
|
|
||||||
|
for (const item of arr1) {
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
const id = item.name
|
||||||
|
uniqueObjects.set(id, item)
|
||||||
|
} else {
|
||||||
|
uniqueValues.add(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const item of arr2) {
|
||||||
|
if (typeof item === 'object') {
|
||||||
|
const id = item.name
|
||||||
|
if (!uniqueObjects.has(id)) {
|
||||||
|
uniqueObjects.set(id, item)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
uniqueValues.add(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...uniqueValues, ...uniqueObjects.values()]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -131,16 +131,18 @@ export async function showEmptyGroups (
|
|||||||
|
|
||||||
if (hierarchy.isDerived(attrClass, core.class.Status)) {
|
if (hierarchy.isDerived(attrClass, core.class.Status)) {
|
||||||
// We do not need extensions for all status categories.
|
// We do not need extensions for all status categories.
|
||||||
let statusList = mgr.statuses.filter((it) => {
|
let statusList = mgr.filter((it) => {
|
||||||
return it.ofAttribute === attr._id
|
return it.ofAttribute === attr._id
|
||||||
})
|
})
|
||||||
if (query !== undefined) {
|
if (query !== undefined) {
|
||||||
statusList = matchQuery<Status>(
|
const { [key]: st, space } = query
|
||||||
statusList,
|
const resQuery: DocumentQuery<Status> = {
|
||||||
query as DocumentQuery<Status>,
|
space
|
||||||
_class,
|
}
|
||||||
hierarchy
|
if (st !== undefined) {
|
||||||
) as unknown as Array<WithLookup<Status>>
|
resQuery._id = st
|
||||||
|
}
|
||||||
|
statusList = matchQuery<Status>(statusList, resQuery, _class, hierarchy) as unknown as Array<WithLookup<Status>>
|
||||||
}
|
}
|
||||||
const statuses = statusList.map((it) => it._id)
|
const statuses = statusList.map((it) => it._id)
|
||||||
return await groupByCategory(client, _class, key, statuses, mgr, viewletDescriptorId)
|
return await groupByCategory(client, _class, key, statuses, mgr, viewletDescriptorId)
|
||||||
|
Loading…
Reference in New Issue
Block a user