diff --git a/plugins/process-resources/src/components/attributeEditors/ContextSelectorPopup.svelte b/plugins/process-resources/src/components/attributeEditors/ContextSelectorPopup.svelte index e4892c4c67..6873d837bd 100644 --- a/plugins/process-resources/src/components/attributeEditors/ContextSelectorPopup.svelte +++ b/plugins/process-resources/src/components/attributeEditors/ContextSelectorPopup.svelte @@ -16,11 +16,19 @@ import { MasterTag, Tag } from '@hcengineering/card' import { AnyAttribute, Ref } from '@hcengineering/core' import { getClient } from '@hcengineering/presentation' - import { Context, ContextId, Process, ProcessContext, ProcessFunction, SelectedContext } from '@hcengineering/process' + import { + Context, + ContextId, + Process, + ProcessContext, + ProcessFunction, + RelatedContext, + SelectedContext + } from '@hcengineering/process' import { Label, resizeObserver, Scroller, Submenu } from '@hcengineering/ui' import { createEventDispatcher } from 'svelte' import plugin from '../../plugin' - import { generateContextId, getValueReduceFunc, isTypeEqual } from '../../utils' + import { generateContextId, getRelationObjectReduceFunc, getValueReduceFunc, isTypeEqual } from '../../utils' import ExecutionContextPresenter from './ExecutionContextPresenter.svelte' export let process: Process @@ -96,6 +104,21 @@ const f = client.getModel().getObject(func) return f } + + function onRelation (val: RelatedContext): void { + const client = getClient() + const reduceFunc = getRelationObjectReduceFunc(client, val.association, val.direction, attribute) + onSelect({ + type: 'relation', + key: '', + association: val.association, + direction: val.direction, + name: val.name, + functions: [], + sourceFunction: reduceFunc + }) + dispatch('close') + }