From c6c074aba11379c0d2d3c572afaec0e93a8fbd7a Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Wed, 10 Sep 2025 21:16:05 +0500 Subject: [PATCH] Fix context class set (#9830) Signed-off-by: Denis Bykhov --- models/process/src/index.ts | 2 +- .../components/settings/AddTagEditor.svelte | 3 +++ .../settings/AsideStepEditor.svelte | 2 +- .../settings/CreateCardEditor.svelte | 27 ++++++++++++++----- .../settings/SubProcessEditor.svelte | 6 ++--- plugins/process-resources/src/utils.ts | 11 +++++--- 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/models/process/src/index.ts b/models/process/src/index.ts index 324e5aa6bd..3e5820e4fe 100644 --- a/models/process/src/index.ts +++ b/models/process/src/index.ts @@ -1060,7 +1060,7 @@ export function createModel (builder: Builder): void { objectClass: card.class.Tag, editor: process.component.AddTagEditor, presenter: process.component.AddTagPresenter, - contextClass: card.class.Tag, + contextClass: card.class.Card, requiredParams: ['_id'] }, process.method.AddTag diff --git a/plugins/process-resources/src/components/settings/AddTagEditor.svelte b/plugins/process-resources/src/components/settings/AddTagEditor.svelte index ebb7685051..54a615b222 100644 --- a/plugins/process-resources/src/components/settings/AddTagEditor.svelte +++ b/plugins/process-resources/src/components/settings/AddTagEditor.svelte @@ -42,6 +42,9 @@ props = {} params.props = props step.params = params + if (step.context != null) { + step.context._class = _id + } dispatch('change', step) } } diff --git a/plugins/process-resources/src/components/settings/AsideStepEditor.svelte b/plugins/process-resources/src/components/settings/AsideStepEditor.svelte index e4c4eec520..6cbd6af9db 100644 --- a/plugins/process-resources/src/components/settings/AsideStepEditor.svelte +++ b/plugins/process-resources/src/components/settings/AsideStepEditor.svelte @@ -70,7 +70,7 @@ {/if} {#if step != null} - + {/if}
diff --git a/plugins/process-resources/src/components/settings/CreateCardEditor.svelte b/plugins/process-resources/src/components/settings/CreateCardEditor.svelte index 041a8ff606..76ec25c94d 100644 --- a/plugins/process-resources/src/components/settings/CreateCardEditor.svelte +++ b/plugins/process-resources/src/components/settings/CreateCardEditor.svelte @@ -39,12 +39,16 @@ const hierarchy = client.getHierarchy() translateCB(cardPlugin.string.Card, {}, undefined, (res) => { + setName(res) + }) + + function setName (name: string): void { if (params.title === undefined || params.title === '') { - params.title = res + params.title = name ;(step.params as any) = params dispatch('change', step) } - }) + } function change (e: CustomEvent): void { if (e.detail !== undefined) { @@ -106,9 +110,9 @@ } } - function typeChange (e: CustomEvent>>): void { - if (e.detail === undefined || e.detail === _class) return - allAttrs = getKeys(e.detail) + function typeChange (_id: Ref>): void { + if (_id === undefined) return + allAttrs = getKeys(_id) const oldParams = { ...params } params = {} for (const attr of allAttrs) { @@ -117,7 +121,6 @@ ;(params as any)[key] = oldParams[key] } } - _class = e.detail keys = Object.keys(params) params._class = _class step.params = params @@ -126,6 +129,8 @@ } dispatch('change', step) } + + $: typeChange(_class)
@@ -137,7 +142,15 @@ >
{#key _class} diff --git a/plugins/process-resources/src/components/settings/SubProcessEditor.svelte b/plugins/process-resources/src/components/settings/SubProcessEditor.svelte index 6b21ce20d6..557bb4ed96 100644 --- a/plugins/process-resources/src/components/settings/SubProcessEditor.svelte +++ b/plugins/process-resources/src/components/settings/SubProcessEditor.svelte @@ -32,7 +32,7 @@ let _id: Ref = step.params._id as any $: context = parseContext(step.params.card) - $: masterTag = getContextMasterTag(client, context, process.masterTag) ?? process.masterTag + $: masterTag = getContextMasterTag(client, context, process) ?? process.masterTag $: executionContext = (step.params.context ?? {}) as ExecutionContext @@ -48,9 +48,7 @@ let thisCard: boolean = step.params.card === undefined - $: ancestors = hierarchy - .getAncestors(masterTag) - .filter((it) => !hierarchy.isMixin(it) && hierarchy.isDerived(it, card.class.Card)) + $: ancestors = hierarchy.getAncestors(masterTag).filter((it) => hierarchy.isDerived(it, card.class.Card)) let processes: Process[] = [] let items: DropdownTextItem[] = [] diff --git a/plugins/process-resources/src/utils.ts b/plugins/process-resources/src/utils.ts index c284ec7f9c..58e4b8c7ea 100644 --- a/plugins/process-resources/src/utils.ts +++ b/plugins/process-resources/src/utils.ts @@ -75,19 +75,19 @@ export function generateContextId (): ContextId { export function getContextMasterTag ( client: Client, context: SelectedContext | undefined, - masterTag: Ref + process: Process ): Ref | undefined { if (context === undefined) return const h = client.getHierarchy() const model = client.getModel() if (context.type === 'attribute') { - const attr = h.findAttribute(masterTag, context.key) + const attr = h.findAttribute(process.masterTag, context.key) if (attr === undefined) return const parentType = attr.type._class === core.class.ArrOf ? (attr.type as ArrOf).of : attr.type if (parentType._class === core.class.RefTo) return (parentType as RefTo).to } if (context.type === 'nested') { - const attr = h.findAttribute(masterTag, context.path) + const attr = h.findAttribute(process.masterTag, context.path) if (attr === undefined) return const parentType = attr.type._class === core.class.ArrOf ? (attr.type as ArrOf).of : attr.type const targetClass = parentType._class === core.class.RefTo ? (parentType as RefTo).to : parentType._class @@ -102,6 +102,11 @@ export function getContextMasterTag ( const nested = h.findAttribute(targetClass, context.key) return (nested?.type as RefTo)?.to } + if (context.type === 'context') { + const execContext = process.context[context.id] + if (execContext === undefined) return + return execContext._class + } } export async function pickTransition (