mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +00:00
UBERF-8516: Stable mentions popup (#6993)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
7bd0db43c4
commit
d65176fb84
@ -860,7 +860,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: contact.string.Employees,
|
title: contact.string.Employees,
|
||||||
query: contact.completion.EmployeeQuery,
|
query: contact.completion.EmployeeQuery,
|
||||||
context: ['search', 'mention'],
|
context: ['search', 'mention'],
|
||||||
classToSearch: contact.mixin.Employee
|
classToSearch: contact.mixin.Employee,
|
||||||
|
priority: 1000
|
||||||
},
|
},
|
||||||
contact.completion.EmployeeCategory
|
contact.completion.EmployeeCategory
|
||||||
)
|
)
|
||||||
@ -874,7 +875,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: contact.string.People,
|
title: contact.string.People,
|
||||||
query: contact.completion.PersonQuery,
|
query: contact.completion.PersonQuery,
|
||||||
context: ['search', 'spotlight'],
|
context: ['search', 'spotlight'],
|
||||||
classToSearch: contact.class.Person
|
classToSearch: contact.class.Person,
|
||||||
|
priority: 900
|
||||||
},
|
},
|
||||||
contact.completion.PersonCategory
|
contact.completion.PersonCategory
|
||||||
)
|
)
|
||||||
@ -888,7 +890,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: contact.string.Organizations,
|
title: contact.string.Organizations,
|
||||||
query: contact.completion.OrganizationQuery,
|
query: contact.completion.OrganizationQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: contact.class.Organization
|
classToSearch: contact.class.Organization,
|
||||||
|
priority: 800
|
||||||
},
|
},
|
||||||
contact.completion.OrganizationCategory
|
contact.completion.OrganizationCategory
|
||||||
)
|
)
|
||||||
|
@ -908,7 +908,8 @@ export function defineSearch (builder: Builder): void {
|
|||||||
label: documents.string.SearchDocument,
|
label: documents.string.SearchDocument,
|
||||||
query: documents.completion.DocumentMetaQuery,
|
query: documents.completion.DocumentMetaQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: documents.class.DocumentMeta
|
classToSearch: documents.class.DocumentMeta,
|
||||||
|
priority: 800
|
||||||
},
|
},
|
||||||
documents.completion.DocumentMetaCategory
|
documents.completion.DocumentMetaCategory
|
||||||
)
|
)
|
||||||
|
@ -492,7 +492,8 @@ function defineDocument (builder: Builder): void {
|
|||||||
label: document.string.SearchDocument,
|
label: document.string.SearchDocument,
|
||||||
query: document.completion.DocumentQuery,
|
query: document.completion.DocumentQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: document.class.Document
|
classToSearch: document.class.Document,
|
||||||
|
priority: 800
|
||||||
},
|
},
|
||||||
document.completion.DocumentQueryCategory
|
document.completion.DocumentQueryCategory
|
||||||
)
|
)
|
||||||
|
@ -444,7 +444,8 @@ function defineFolder (builder: Builder): void {
|
|||||||
label: presentation.string.Search,
|
label: presentation.string.Search,
|
||||||
query: drive.completion.FolderQuery,
|
query: drive.completion.FolderQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: drive.class.Folder
|
classToSearch: drive.class.Folder,
|
||||||
|
priority: 700
|
||||||
},
|
},
|
||||||
drive.completion.FolderCategory
|
drive.completion.FolderCategory
|
||||||
)
|
)
|
||||||
@ -594,7 +595,8 @@ function defineFile (builder: Builder): void {
|
|||||||
label: presentation.string.Search,
|
label: presentation.string.Search,
|
||||||
query: drive.completion.FileQuery,
|
query: drive.completion.FileQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: drive.class.File
|
classToSearch: drive.class.File,
|
||||||
|
priority: 600
|
||||||
},
|
},
|
||||||
drive.completion.FileCategory
|
drive.completion.FileCategory
|
||||||
)
|
)
|
||||||
|
@ -1048,7 +1048,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: recruit.string.Applications,
|
title: recruit.string.Applications,
|
||||||
query: recruit.completion.ApplicationQuery,
|
query: recruit.completion.ApplicationQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: recruit.class.Applicant
|
classToSearch: recruit.class.Applicant,
|
||||||
|
priority: 500
|
||||||
},
|
},
|
||||||
recruit.completion.ApplicationCategory
|
recruit.completion.ApplicationCategory
|
||||||
)
|
)
|
||||||
@ -1062,7 +1063,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: recruit.string.Vacancies,
|
title: recruit.string.Vacancies,
|
||||||
query: recruit.completion.VacancyQuery,
|
query: recruit.completion.VacancyQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: recruit.class.Vacancy
|
classToSearch: recruit.class.Vacancy,
|
||||||
|
priority: 550
|
||||||
},
|
},
|
||||||
recruit.completion.VacancyCategory
|
recruit.completion.VacancyCategory
|
||||||
)
|
)
|
||||||
|
@ -602,7 +602,8 @@ export function createModel (builder: Builder): void {
|
|||||||
title: tracker.string.Issues,
|
title: tracker.string.Issues,
|
||||||
query: tracker.completion.IssueQuery,
|
query: tracker.completion.IssueQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: tracker.class.Issue
|
classToSearch: tracker.class.Issue,
|
||||||
|
priority: 300
|
||||||
},
|
},
|
||||||
tracker.completion.IssueCategory
|
tracker.completion.IssueCategory
|
||||||
)
|
)
|
||||||
|
@ -98,9 +98,14 @@ async function doFulltextSearch (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return sections.sort((a, b) => {
|
return sections.sort((a, b) => {
|
||||||
|
const ac = categories.indexOf(a.category)
|
||||||
|
const bc = categories.indexOf(b.category)
|
||||||
|
if (ac === bc) {
|
||||||
const maxScoreA = Math.max(...(a?.items ?? []).map((obj) => obj?.score ?? 0))
|
const maxScoreA = Math.max(...(a?.items ?? []).map((obj) => obj?.score ?? 0))
|
||||||
const maxScoreB = Math.max(...(b?.items ?? []).map((obj) => obj?.score ?? 0))
|
const maxScoreB = Math.max(...(b?.items ?? []).map((obj) => obj?.score ?? 0))
|
||||||
return maxScoreB - maxScoreA
|
return maxScoreB - maxScoreA
|
||||||
|
}
|
||||||
|
return ac - bc
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +119,8 @@ export async function searchFor (
|
|||||||
let categories = categoriesByContext.get(context)
|
let categories = categoriesByContext.get(context)
|
||||||
if (categories === undefined) {
|
if (categories === undefined) {
|
||||||
categories = await client.findAll(plugin.class.ObjectSearchCategory, { context })
|
categories = await client.findAll(plugin.class.ObjectSearchCategory, { context })
|
||||||
|
|
||||||
|
categories.sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))
|
||||||
categoriesByContext.set(context, categories)
|
categoriesByContext.set(context, categories)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ export interface ObjectSearchCategory extends Doc {
|
|||||||
// Query for documents with pattern
|
// Query for documents with pattern
|
||||||
query: Resource<ObjectSearchFactory>
|
query: Resource<ObjectSearchFactory>
|
||||||
classToSearch?: Ref<Class<Doc>>
|
classToSearch?: Ref<Class<Doc>>
|
||||||
|
|
||||||
|
priority?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComponentExt {
|
export interface ComponentExt {
|
||||||
|
@ -988,7 +988,8 @@ export function createModel (builder: Builder): void {
|
|||||||
label: github.string.PullRequests,
|
label: github.string.PullRequests,
|
||||||
query: tracker.completion.IssueQuery,
|
query: tracker.completion.IssueQuery,
|
||||||
context: ['search', 'mention', 'spotlight'],
|
context: ['search', 'mention', 'spotlight'],
|
||||||
classToSearch: github.class.GithubPullRequest
|
classToSearch: github.class.GithubPullRequest,
|
||||||
|
priority: 280
|
||||||
},
|
},
|
||||||
github.completion.PullRequestCategory
|
github.completion.PullRequestCategory
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user