UBER-773: Fix List search anv Vacancy view (#3614)

Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
Maksim Karmatskikh 2023-08-22 09:58:04 +06:00 committed by GitHub
parent 5b7ca98523
commit 5104e5ace6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 17 deletions

View File

@ -763,11 +763,11 @@ export function createModel (builder: Builder): void {
descriptor: view.viewlet.List,
config: [
{ key: '', displayProps: { fixed: 'left', key: 'app' } },
'description',
{
key: '@applications',
label: recruit.string.Applications
},
'description',
{ key: '', displayProps: { grow: true } },
{
key: '$lookup.company',
@ -779,8 +779,8 @@ export function createModel (builder: Builder): void {
}
],
configOptions: {
hiddenKeys: ['name', 'space', 'modifiedOn'],
sortable: true
strict: true,
hiddenKeys: ['name', 'space', 'modifiedOn']
},
baseQuery: {
doneState: null,
@ -794,16 +794,7 @@ export function createModel (builder: Builder): void {
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: [
{
key: 'shouldShowAll',
type: 'toggle',
defaultValue: false,
actionTarget: 'category',
action: view.function.ShowEmptyGroups,
label: view.string.ShowEmptyGroups
}
]
other: []
}
},
recruit.viewlet.ListVacancy

View File

@ -64,6 +64,8 @@
viewOptions[model.key] = !viewOptions[model.key]
dispatch('update', { key: model.key, value: viewOptions[model.key] })
}
$: visibleOthers = config.other.filter((p) => !p.hidden?.(viewOptions))
</script>
<div class="antiCard dialog menu">
@ -103,8 +105,10 @@
}}
/>
</div>
<div class="antiCard-menu__divider" />
{#each config.other.filter((p) => !p.hidden?.(viewOptions)) as model}
{#if visibleOthers.length > 0}
<div class="antiCard-menu__divider" />
{/if}
{#each visibleOthers as model}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="antiCard-menu__item hoverable ordering"

View File

@ -84,10 +84,19 @@
function getProjection (fields: string[], query: DocumentQuery<Doc>): Record<string, number> {
const res: Record<string, number> = {}
for (const f of fields) {
res[f] = 1
/*
Mongo projection doesn't support properties fields which
start from $. Such field here is $search. The least we could do
is to filter all properties which start from $.
*/
if (!f.startsWith('$')) {
res[f] = 1
}
}
for (const f of Object.keys(query)) {
res[f] = 1
if (!f.startsWith('$')) {
res[f] = 1
}
}
return res
}