mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-31 12:49:57 +00:00
Fix current space selection on page load (#927)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
f01f30fc1d
commit
f2402c3208
@ -17,7 +17,8 @@
|
|||||||
import core, { Client, getCurrentAccount, Ref, Space } from '@anticrm/core'
|
import core, { Client, getCurrentAccount, Ref, Space } from '@anticrm/core'
|
||||||
import { Avatar, createQuery, setClient } from '@anticrm/presentation'
|
import { Avatar, createQuery, setClient } from '@anticrm/presentation'
|
||||||
import {
|
import {
|
||||||
AnyComponent, closeTooltip,
|
AnyComponent,
|
||||||
|
closeTooltip,
|
||||||
Component,
|
Component,
|
||||||
getCurrentLocation,
|
getCurrentLocation,
|
||||||
location,
|
location,
|
||||||
@ -60,7 +61,7 @@
|
|||||||
navigatorModel = currentApplication?.navigatorModel
|
navigatorModel = currentApplication?.navigatorModel
|
||||||
}
|
}
|
||||||
const currentFolder = loc.path[2] as Ref<Space>
|
const currentFolder = loc.path[2] as Ref<Space>
|
||||||
|
|
||||||
if (currentSpecial !== currentFolder) {
|
if (currentSpecial !== currentFolder) {
|
||||||
specialComponent = getSpecialComponent(currentFolder)
|
specialComponent = getSpecialComponent(currentFolder)
|
||||||
if (specialComponent !== undefined) {
|
if (specialComponent !== undefined) {
|
||||||
@ -69,7 +70,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpace(currentSpace)
|
updateSpace(currentFolder)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -84,7 +85,7 @@
|
|||||||
if (space) {
|
if (space) {
|
||||||
currentSpace = spaceId
|
currentSpace = spaceId
|
||||||
currentSpecial = undefined
|
currentSpecial = undefined
|
||||||
|
|
||||||
const spaceClass = client.getHierarchy().getClass(space._class) // (await client.findAll(core.class.Class, { _id: space._class }))[0]
|
const spaceClass = client.getHierarchy().getClass(space._class) // (await client.findAll(core.class.Class, { _id: space._class }))[0]
|
||||||
const view = client.getHierarchy().as(spaceClass, workbench.mixin.SpaceView)
|
const view = client.getHierarchy().as(spaceClass, workbench.mixin.SpaceView)
|
||||||
currentView = view.view
|
currentView = view.view
|
||||||
@ -143,20 +144,31 @@
|
|||||||
let employee: Employee | undefined
|
let employee: Employee | undefined
|
||||||
const accountQ = createQuery()
|
const accountQ = createQuery()
|
||||||
const employeeQ = createQuery()
|
const employeeQ = createQuery()
|
||||||
$: accountQ.query(contact.class.EmployeeAccount, {
|
$: accountQ.query(
|
||||||
_id: getCurrentAccount()._id as Ref<EmployeeAccount>
|
contact.class.EmployeeAccount,
|
||||||
}, (res) => {
|
{
|
||||||
account = res[0]
|
_id: getCurrentAccount()._id as Ref<EmployeeAccount>
|
||||||
}, { limit: 1 })
|
},
|
||||||
|
(res) => {
|
||||||
|
account = res[0]
|
||||||
|
},
|
||||||
|
{ limit: 1 }
|
||||||
|
)
|
||||||
|
|
||||||
$: account && employeeQ.query(contact.class.Employee, {
|
$: account &&
|
||||||
_id: account.employee
|
employeeQ.query(
|
||||||
}, (res) => {
|
contact.class.Employee,
|
||||||
employee = res[0]
|
{
|
||||||
}, { limit: 1 })
|
_id: account.employee
|
||||||
|
},
|
||||||
|
(res) => {
|
||||||
|
employee = res[0]
|
||||||
|
},
|
||||||
|
{ limit: 1 }
|
||||||
|
)
|
||||||
|
|
||||||
let isNavigate: boolean = false
|
let isNavigate: boolean = false
|
||||||
$: isNavigate = navigatorModel ? true : false
|
$: isNavigate = !!navigatorModel
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if client}
|
{#if client}
|
||||||
@ -213,7 +225,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<div class="antiPanel-component indent antiComponent" class:filled={isNavigate}>
|
<div class="antiPanel-component indent antiComponent" class:filled={isNavigate}>
|
||||||
{#if currentApplication && currentApplication.component}
|
{#if currentApplication && currentApplication.component}
|
||||||
<Component is={currentApplication.component} />
|
<Component is={currentApplication.component} />
|
||||||
{:else if specialComponent}
|
{:else if specialComponent}
|
||||||
<Component is={specialComponent} />
|
<Component is={specialComponent} />
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
Reference in New Issue
Block a user