mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 08:48:01 +00:00
Fix workbench for admin (#4432)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
bd4cba9d11
commit
50f7a42351
@ -14,54 +14,54 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import contact, { Employee, PersonAccount } from '@hcengineering/contact'
|
import contact, { Employee, PersonAccount } from '@hcengineering/contact'
|
||||||
import core, { Class, Doc, getCurrentAccount, Ref, setCurrentAccount, Space } from '@hcengineering/core'
|
import core, { AccountRole, Class, Doc, Ref, Space, getCurrentAccount } from '@hcengineering/core'
|
||||||
import login from '@hcengineering/login'
|
import login from '@hcengineering/login'
|
||||||
import notification, { DocNotifyContext, inboxId, InboxNotification } from '@hcengineering/notification'
|
import notification, { DocNotifyContext, InboxNotification, inboxId } from '@hcengineering/notification'
|
||||||
import { BrowserNotificatator, InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
import { BrowserNotificatator, InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
|
||||||
import { broadcastEvent, getMetadata, getResource, IntlString } from '@hcengineering/platform'
|
import { IntlString, broadcastEvent, getMetadata, getResource } from '@hcengineering/platform'
|
||||||
import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
|
import { ActionContext, createQuery, getClient } from '@hcengineering/presentation'
|
||||||
import setting from '@hcengineering/setting'
|
import setting from '@hcengineering/setting'
|
||||||
import support, { SupportStatus } from '@hcengineering/support'
|
import support, { SupportStatus } from '@hcengineering/support'
|
||||||
import {
|
import {
|
||||||
AnyComponent,
|
AnyComponent,
|
||||||
areLocationsEqual,
|
|
||||||
Button,
|
Button,
|
||||||
closePanel,
|
|
||||||
closePopup,
|
|
||||||
closeTooltip,
|
|
||||||
CompAndProps,
|
CompAndProps,
|
||||||
Component,
|
Component,
|
||||||
defineSeparators,
|
IconSettings,
|
||||||
deviceOptionsStore as deviceInfo,
|
|
||||||
getCurrentLocation,
|
|
||||||
getLocation,
|
|
||||||
Label,
|
Label,
|
||||||
Location,
|
Location,
|
||||||
location,
|
|
||||||
locationStorageKeyId,
|
|
||||||
navigate,
|
|
||||||
openPanel,
|
|
||||||
PanelInstance,
|
PanelInstance,
|
||||||
Popup,
|
Popup,
|
||||||
PopupAlignment,
|
PopupAlignment,
|
||||||
PopupPosAlignment,
|
PopupPosAlignment,
|
||||||
PopupResult,
|
PopupResult,
|
||||||
popupstore,
|
|
||||||
ResolvedLocation,
|
ResolvedLocation,
|
||||||
resolvedLocationStore,
|
|
||||||
Separator,
|
Separator,
|
||||||
|
TooltipInstance,
|
||||||
|
areLocationsEqual,
|
||||||
|
closePanel,
|
||||||
|
closePopup,
|
||||||
|
closeTooltip,
|
||||||
|
defineSeparators,
|
||||||
|
deviceOptionsStore as deviceInfo,
|
||||||
|
getCurrentLocation,
|
||||||
|
getLocation,
|
||||||
|
location,
|
||||||
|
locationStorageKeyId,
|
||||||
|
navigate,
|
||||||
|
openPanel,
|
||||||
|
popupstore,
|
||||||
|
resolvedLocationStore,
|
||||||
setResolvedLocation,
|
setResolvedLocation,
|
||||||
showPopup,
|
showPopup,
|
||||||
workbenchSeparators,
|
workbenchSeparators
|
||||||
IconSettings,
|
|
||||||
TooltipInstance
|
|
||||||
} from '@hcengineering/ui'
|
} from '@hcengineering/ui'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
import {
|
import {
|
||||||
ActionHandler,
|
ActionHandler,
|
||||||
ListSelectionProvider,
|
ListSelectionProvider,
|
||||||
migrateViewOpttions,
|
|
||||||
NavLink,
|
NavLink,
|
||||||
|
migrateViewOpttions,
|
||||||
updateFocus
|
updateFocus
|
||||||
} from '@hcengineering/view-resources'
|
} from '@hcengineering/view-resources'
|
||||||
import type { Application, NavigatorModel, SpecialNavModel, ViewConfiguration } from '@hcengineering/workbench'
|
import type { Application, NavigatorModel, SpecialNavModel, ViewConfiguration } from '@hcengineering/workbench'
|
||||||
@ -129,37 +129,22 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const accountId = (getCurrentAccount() as PersonAccount)._id
|
const account = getCurrentAccount() as PersonAccount
|
||||||
|
|
||||||
let account: PersonAccount | undefined
|
|
||||||
const accountQ = createQuery()
|
|
||||||
accountQ.query<PersonAccount>(
|
|
||||||
contact.class.PersonAccount,
|
|
||||||
{
|
|
||||||
_id: accountId
|
|
||||||
},
|
|
||||||
(res) => {
|
|
||||||
if (res.length > 0) {
|
|
||||||
account = res[0]
|
|
||||||
setCurrentAccount(account)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ limit: 1 }
|
|
||||||
)
|
|
||||||
|
|
||||||
let employee: Employee | undefined
|
let employee: Employee | undefined
|
||||||
const employeeQ = createQuery()
|
const employeeQ = createQuery()
|
||||||
|
|
||||||
$: employeeQ.query<Employee>(
|
$: account &&
|
||||||
contact.mixin.Employee,
|
employeeQ.query<Employee>(
|
||||||
{
|
contact.mixin.Employee,
|
||||||
_id: account?.person as Ref<Employee>
|
{
|
||||||
},
|
_id: account?.person as Ref<Employee>
|
||||||
(res) => {
|
},
|
||||||
employee = res[0]
|
(res) => {
|
||||||
},
|
employee = res[0]
|
||||||
{ limit: 1 }
|
},
|
||||||
)
|
{ limit: 1 }
|
||||||
|
)
|
||||||
|
|
||||||
const workspaceId = $location.path[1]
|
const workspaceId = $location.path[1]
|
||||||
const inboxClient = InboxNotificationsClientImpl.getClient()
|
const inboxClient = InboxNotificationsClientImpl.getClient()
|
||||||
@ -621,7 +606,20 @@
|
|||||||
defineSeparators('workbench', workbenchSeparators)
|
defineSeparators('workbench', workbenchSeparators)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if employee?.active === true || accountId === core.account.System}
|
{#if employee && !employee.active}
|
||||||
|
<div class="flex-col-center justify-center h-full flex-grow">
|
||||||
|
<h1><Label label={workbench.string.AccountDisabled} /></h1>
|
||||||
|
<Label label={workbench.string.AccountDisabledDescr} />
|
||||||
|
<Button
|
||||||
|
label={setting.string.Signout}
|
||||||
|
kind={'link'}
|
||||||
|
size={'small'}
|
||||||
|
on:click={() => {
|
||||||
|
signOut()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{:else if employee?.active || account.role === AccountRole.Owner}
|
||||||
<ActionHandler />
|
<ActionHandler />
|
||||||
<svg class="svg-mask">
|
<svg class="svg-mask">
|
||||||
<clipPath id="notify-normal">
|
<clipPath id="notify-normal">
|
||||||
@ -843,19 +841,6 @@
|
|||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</Popup>
|
</Popup>
|
||||||
<BrowserNotificatator />
|
<BrowserNotificatator />
|
||||||
{:else if employee}
|
|
||||||
<div class="flex-col-center justify-center h-full flex-grow">
|
|
||||||
<h1><Label label={workbench.string.AccountDisabled} /></h1>
|
|
||||||
<Label label={workbench.string.AccountDisabledDescr} />
|
|
||||||
<Button
|
|
||||||
label={setting.string.Signout}
|
|
||||||
kind={'link'}
|
|
||||||
size={'small'}
|
|
||||||
on:click={() => {
|
|
||||||
signOut()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
Loading…
Reference in New Issue
Block a user