Fix List Category requests (#3938)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-04 00:00:43 +07:00 committed by GitHub
parent 66915d29e3
commit 7872a460e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View File

@ -707,7 +707,7 @@ export function createModel (builder: Builder): void {
label: recruit.string.HideArchivedVacancies
}
const applicantViewOptions = (colors: boolean): ViewOptionsModel => {
const applicantViewOptions = (colors: boolean, hides: boolean): ViewOptionsModel => {
const model: ViewOptionsModel = {
groupBy: ['status', 'assignee', 'space', 'createdBy', 'modifiedBy'],
orderBy: [
@ -725,14 +725,15 @@ export function createModel (builder: Builder): void {
actionTarget: 'category',
action: view.function.ShowEmptyGroups,
label: view.string.ShowEmptyGroups
},
applicationDoneOption,
vacancyHideOption
}
]
}
if (colors) {
model.other.push(showColorsViewOption)
}
if (hides) {
model.other.push(...[applicationDoneOption, vacancyHideOption])
}
return model
}
@ -810,7 +811,7 @@ export function createModel (builder: Builder): void {
strict: true,
hiddenKeys: ['name', 'attachedTo']
},
viewOptions: applicantViewOptions(true)
viewOptions: applicantViewOptions(true, true)
},
recruit.viewlet.ListApplicant
)
@ -977,8 +978,12 @@ export function createModel (builder: Builder): void {
attachTo: recruit.class.Applicant,
descriptor: task.viewlet.Kanban,
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
baseQuery: {
isDone: { $ne: true },
'$lookup.space.archived': false
},
viewOptions: {
...applicantViewOptions(false),
...applicantViewOptions(false, false),
groupDepth: 1
},
options: {

View File

@ -59,7 +59,7 @@
let resultQuery: DocumentQuery<Doc> = query
$: getResultQuery(query, viewOptionsConfig, viewOptions).then((p) => {
resultQuery = { ...p, ...query }
resultQuery = { ...query, ...p }
})
$: queryNoLookup = noLookup(resultQuery)
@ -68,7 +68,7 @@
let categoryQueryOptions: Partial<FindOptions<Doc>>
$: categoryQueryOptions = {
...resultOptions,
...noLookupOptions(resultOptions),
projection: {
...resultOptions.projection,
_id: 1,
@ -132,6 +132,11 @@
return newQuery
}
function noLookupOptions (options: FindOptions<Doc>): FindOptions<Doc> {
const { lookup, ...resultOptions } = options
return resultOptions
}
$: dispatch('content', docs)
const dispatch = createEventDispatcher()