mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +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 { AttributeModel, BuildModelKey, CategoryOption, ViewOptionModel, ViewOptions } from '@hcengineering/view'
|
||||
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 ListCategory from './ListCategory.svelte'
|
||||
|
||||
@ -85,7 +93,7 @@
|
||||
const f = await getResource(categoryFunc.action)
|
||||
const res = hierarchy.clone(await f(_class, query, groupByKey, update, queryId, $statusStore))
|
||||
if (res !== undefined) {
|
||||
categories = Array.from(new Set([...categories, ...res]))
|
||||
categories = concatCategories(res, categories)
|
||||
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
|
||||
*/
|
||||
|
@ -131,16 +131,18 @@ export async function showEmptyGroups (
|
||||
|
||||
if (hierarchy.isDerived(attrClass, core.class.Status)) {
|
||||
// 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
|
||||
})
|
||||
if (query !== undefined) {
|
||||
statusList = matchQuery<Status>(
|
||||
statusList,
|
||||
query as DocumentQuery<Status>,
|
||||
_class,
|
||||
hierarchy
|
||||
) as unknown as Array<WithLookup<Status>>
|
||||
const { [key]: st, space } = query
|
||||
const resQuery: DocumentQuery<Status> = {
|
||||
space
|
||||
}
|
||||
if (st !== undefined) {
|
||||
resQuery._id = st
|
||||
}
|
||||
statusList = matchQuery<Status>(statusList, resQuery, _class, hierarchy) as unknown as Array<WithLookup<Status>>
|
||||
}
|
||||
const statuses = statusList.map((it) => it._id)
|
||||
return await groupByCategory(client, _class, key, statuses, mgr, viewletDescriptorId)
|
||||
|
Loading…
Reference in New Issue
Block a user