UBER-271: Fix filters (#3293)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-05-30 20:42:04 +07:00 committed by GitHub
parent 46d66ecad1
commit f403d44769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 3 deletions

View File

@ -323,7 +323,7 @@ export class TTimeSpendReport extends TAttachedDoc implements TimeSpendReport {
* @public
*/
@Model(tracker.class.Component, core.class.Doc, DOMAIN_TRACKER)
@UX(tracker.string.Component, tracker.icon.Component, 'COMPONENT')
@UX(tracker.string.Component, tracker.icon.Component, 'COMPONENT', 'label')
export class TComponent extends TDoc implements Component {
@Prop(TypeString(), tracker.string.Title)
@Index(IndexKind.FullText)
@ -348,7 +348,7 @@ export class TComponent extends TDoc implements Component {
* @public
*/
@Model(tracker.class.Milestone, core.class.Doc, DOMAIN_TRACKER)
@UX(tracker.string.Milestone, tracker.icon.Milestone)
@UX(tracker.string.Milestone, tracker.icon.Milestone, '', 'label')
export class TMilestone extends TDoc implements Milestone {
@Prop(TypeString(), tracker.string.Title)
// @Index(IndexKind.FullText)
@ -1336,7 +1336,25 @@ export function createModel (builder: Builder): void {
})
builder.mixin(tracker.class.Issue, core.class.Class, view.mixin.ClassFilters, {
filters: ['status', 'priority', 'space', 'createdBy', 'assignee'],
filters: [
'status',
'priority',
'space',
'createdBy',
'assignee',
{
_class: tracker.class.Issue,
key: 'component',
component: view.component.ObjectFilter,
showNested: false
},
{
_class: tracker.class.Issue,
key: 'milestone',
component: view.component.ObjectFilter,
showNested: false
}
],
ignoreKeys: ['number', 'estimation', 'attachedTo']
})

View File

@ -231,6 +231,9 @@
}
function hasNested (type: KeyFilter): boolean {
if (type.showNested === false) {
return false
}
const targetClass = (hierarchy.getAttribute(type._class, type.key).type as RefTo<Doc>).to
if (targetClass === undefined) return false
const clazz = hierarchy.getClass(targetClass)

View File

@ -57,6 +57,7 @@ export interface KeyFilterPreset {
component: AnyComponent
label?: IntlString
group?: 'top' | 'bottom'
showNested?: boolean
}
/**