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

View File

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

View File

@ -84,10 +84,19 @@
function getProjection (fields: string[], query: DocumentQuery<Doc>): Record<string, number> { function getProjection (fields: string[], query: DocumentQuery<Doc>): Record<string, number> {
const res: Record<string, number> = {} const res: Record<string, number> = {}
for (const f of fields) { 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)) { for (const f of Object.keys(query)) {
res[f] = 1 if (!f.startsWith('$')) {
res[f] = 1
}
} }
return res return res
} }