From 21b2d3e2bd28715b9df252eb570de1556918da39 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 8 Dec 2021 16:05:19 +0700 Subject: [PATCH] Display statuses editor only for spaces with statuess (#582) Signed-off-by: Andrey Sobolev --- .../src/components/navigator/SpacesNav.svelte | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte index 893816ce55..74929a37f7 100644 --- a/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte +++ b/plugins/workbench-resources/src/components/navigator/SpacesNav.svelte @@ -18,6 +18,7 @@ import type { Asset, IntlString } from '@anticrm/platform' import type { Ref, Space, Doc } from '@anticrm/core' + import core from '@anticrm/core' import type { SpacesNavModel } from '@anticrm/workbench' import { Action, navigate, getCurrentLocation, location, IconAdd, IconMoreH, IconEdit } from '@anticrm/ui' @@ -65,7 +66,8 @@ } } - function selectSpace(id: Ref) { + + function selectSpace (id: Ref) { const loc = getCurrentLocation() loc.path[2] = id loc.path.length = 3 @@ -75,12 +77,20 @@ onDestroy(location.subscribe(async (loc) => { selected = loc.path[2] as Ref })) + + function getActions (space: Space): Action[] { + const result = [editSpace] + if (client.getHierarchy().isDerived(space._class, core.class.SpaceWithStates)) { + result.push(editStatuses) + } + return result + }
{#each spaces as space} - { selectSpace(space._id) }}/> + { selectSpace(space._id) }}/> {/each}