Fix_HiddenApplication_query (#4312)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-01-07 00:09:24 +06:00 committed by GitHub
parent b4089c47d4
commit 2ecfa4c70c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View File

@ -19,6 +19,7 @@
import workbench from '@hcengineering/workbench'
import { hideApplication, showApplication } from '../utils'
import { Loading, IconCheck, Label, Icon } from '@hcengineering/ui'
import preference from '@hcengineering/preference'
// import Drag from './icons/Drag.svelte'
export let apps: Application[] = []
@ -55,10 +56,16 @@
let loaded: boolean = false
let hiddenAppsIds: Array<Ref<Application>> = []
const hiddenAppsIdsQuery = createQuery()
hiddenAppsIdsQuery.query(workbench.class.HiddenApplication, {}, (res) => {
hiddenAppsIds = res.map((r) => r.attachedTo)
loaded = true
})
hiddenAppsIdsQuery.query(
workbench.class.HiddenApplication,
{
space: preference.space.Preference
},
(res) => {
hiddenAppsIds = res.map((r) => r.attachedTo)
loaded = true
}
)
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->

View File

@ -20,6 +20,7 @@
import type { Application } from '@hcengineering/workbench'
import workbench from '@hcengineering/workbench'
import AppItem from './AppItem.svelte'
import preference from '@hcengineering/preference'
export let active: Ref<Application> | undefined
export let apps: Application[] = []
@ -28,10 +29,16 @@
let loaded: boolean = false
let hiddenAppsIds: Array<Ref<Application>> = []
const hiddenAppsIdsQuery = createQuery()
hiddenAppsIdsQuery.query(workbench.class.HiddenApplication, {}, (res) => {
hiddenAppsIds = res.map((r) => r.attachedTo)
loaded = true
})
hiddenAppsIdsQuery.query(
workbench.class.HiddenApplication,
{
space: preference.space.Preference
},
(res) => {
hiddenAppsIds = res.map((r) => r.attachedTo)
loaded = true
}
)
$: filteredApps = apps.filter((it) => !hiddenAppsIds.includes(it._id))
$: topApps = filteredApps.filter((it) => it.position === 'top')