Skip to content

Commit

Permalink
Archive filter fix (#5626)
Browse files Browse the repository at this point in the history
Signed-off-by: Vyacheslav Tumanov <[email protected]>
  • Loading branch information
ThetaDR committed May 20, 2024
1 parent 4fe6e5e commit 69e683e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plugins/recruit-resources/src/components/Vacancies.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<SearchEdit bind:value={search} on:change={(e) => (search = e.detail)} />
<!-- <ActionIcon icon={IconMoreH} size={'small'} /> -->
<div class="buttons-divider" />
<FilterButton _class={recruit.class.Vacancy} />
<FilterButton _class={recruit.class.Vacancy} {viewOptions} />
</div>
<div class="ac-header-full medium-gap">
<ViewletSettingButton bind:viewOptions bind:viewlet />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { Class, Doc, Ref, Space } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Button, IconFilter, eventToHTMLElement, resolvedLocationStore, showPopup } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { Filter, ViewOptions } from '@hcengineering/view'
import { filterStore, getFilterKey, selectedFilterStore, setFilters } from '../../filter'
import view from '../../plugin'
import FilterTypePopup from './FilterTypePopup.svelte'
Expand All @@ -25,6 +25,7 @@
export let _class: Ref<Class<Doc>> | undefined
export let space: Ref<Space> | undefined = undefined
export let viewOptions: ViewOptions | undefined = undefined
const client = getClient()
const hierarchy = client.getHierarchy()
Expand Down Expand Up @@ -69,7 +70,8 @@
space,
target,
index: 1,
onChange
onChange,
viewOptions
},
target
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import core, { AnyAttribute, ArrOf, Class, Doc, Ref, RefTo, Space, Type } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Label, Scroller, Submenu, closePopup, closeTooltip, resizeObserver, showPopup } from '@hcengineering/ui'
import { ClassFilters, Filter, KeyFilter, KeyFilterPreset } from '@hcengineering/view'
import { ClassFilters, Filter, KeyFilter, KeyFilterPreset, ViewOptions } from '@hcengineering/view'
import { getResource } from '@hcengineering/platform'
import { createEventDispatcher } from 'svelte'
import { FilterQuery, buildFilterKey } from '../../filter'
Expand All @@ -29,6 +29,7 @@
export let index: number
export let onChange: (e: Filter) => void
export let nestedFrom: KeyFilter | undefined = undefined
export let viewOptions: ViewOptions | undefined = undefined
const client = getClient()
const hierarchy = client.getHierarchy()
Expand Down Expand Up @@ -212,7 +213,8 @@
value: [],
index
},
onChange: change
onChange: change,
viewOptions
},
target
)
Expand All @@ -227,7 +229,8 @@
value: [],
index
},
onChange
onChange,
viewOptions
},
target
)
Expand Down
11 changes: 9 additions & 2 deletions plugins/view-resources/src/components/filter/ValueFilter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Loading,
resizeObserver
} from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { Filter, ViewOptions } from '@hcengineering/view'
import { createEventDispatcher } from 'svelte'
import { FILTER_DEBOUNCE_MS, sortFilterValues } from '../../filter'
import view from '../../plugin'
Expand All @@ -35,6 +35,7 @@
export let space: Ref<Space> | undefined = undefined
export let filter: Filter
export let onChange: (e: Filter) => void
export let viewOptions: ViewOptions | undefined = undefined
filter.modes = [view.filter.FilterValueIn, view.filter.FilterValueNin]
filter.mode = filter.mode === undefined ? filter.modes[0] : filter.mode
Expand Down Expand Up @@ -96,7 +97,13 @@
_class,
{
...resultQuery,
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: spaces } }),
...(space
? { space }
: isDerivedFromSpace
? viewOptions === undefined || viewOptions?.hideArchived === true
? { archived: false }
: {}
: { space: { $in: spaces } }),
...(first1000 ? { [filter.key.key]: { $nin: first1000 } } : {})
},
{
Expand Down

0 comments on commit 69e683e

Please sign in to comment.