mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 21:03:30 +00:00
Allow child classes in navigator model (#5275)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
38ac81d6c1
commit
9d414439b9
@ -18,7 +18,7 @@ import { NotificationGroup, NotificationType } from '@hcengineering/notification
|
||||
import type { Asset, Plugin, Resource } from '@hcengineering/platform'
|
||||
import { IntlString, plugin } from '@hcengineering/platform'
|
||||
import type { AnyComponent, Location, ResolvedLocation } from '@hcengineering/ui'
|
||||
import { Action, Viewlet } from '@hcengineering/view'
|
||||
import { Action } from '@hcengineering/view'
|
||||
import { Document, DocumentEmbedding, DocumentSnapshot, SavedDocument, Teamspace } from './types'
|
||||
|
||||
/**
|
||||
@ -75,9 +75,6 @@ export const documentPlugin = plugin(documentId, {
|
||||
DocumentNotificationGroup: '' as Ref<NotificationGroup>,
|
||||
ContentNotification: '' as Ref<NotificationType>
|
||||
},
|
||||
viewlet: {
|
||||
TableBranches: '' as Ref<Viewlet>
|
||||
},
|
||||
descriptor: {
|
||||
TeamspaceType: '' as Ref<SpaceTypeDescriptor>
|
||||
},
|
||||
|
@ -42,10 +42,11 @@
|
||||
let shownSpaces: Space[] = []
|
||||
|
||||
$: if (model) {
|
||||
const classes = getSpecialSpaceClass(model).flatMap((c) => hierarchy.getDescendants(c))
|
||||
query.query(
|
||||
core.class.Space,
|
||||
{
|
||||
_class: { $in: getSpecialSpaceClass(model) }
|
||||
_class: { $in: classes }
|
||||
// temp disabled, need way for default spaces
|
||||
// members: getCurrentAccount()._id
|
||||
},
|
||||
|
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import type { Doc, Ref, Space } from '@hcengineering/core'
|
||||
import type { Class, Doc, Ref, Space } from '@hcengineering/core'
|
||||
import core from '@hcengineering/core'
|
||||
import { DocNotifyContext, InboxNotification } from '@hcengineering/notification'
|
||||
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||
@ -86,6 +86,16 @@
|
||||
return result
|
||||
}
|
||||
|
||||
function getSpaceModel (space: Ref<Class<Space>>): SpacesNavModel | undefined {
|
||||
const hierarchy = client.getHierarchy()
|
||||
const ancestors = [space, ...[...hierarchy.getAncestors(space)].reverse()]
|
||||
for (const clazz of ancestors) {
|
||||
const model = models.find((p) => p.spaceClass === clazz)
|
||||
if (model !== undefined) return model
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
const inboxClient = InboxNotificationsClientImpl.getClient()
|
||||
const notifyContextByDocStore = inboxClient.contextByDoc
|
||||
const inboxNotificationsByContextStore = inboxClient.inboxNotificationsByContext
|
||||
@ -103,7 +113,7 @@
|
||||
|
||||
<TreeNode _id={'tree-stared'} {label} node actions={async () => [unStarAll]}>
|
||||
{#each spaces as space (space._id)}
|
||||
{@const model = models.find((p) => p.spaceClass === space._class)}
|
||||
{@const model = getSpaceModel(space._class)}
|
||||
{#await getSpacePresenter(client, space._class) then presenter}
|
||||
{#if presenter && model}
|
||||
<svelte:component
|
||||
|
Loading…
Reference in New Issue
Block a user