Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions models/process/src/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,22 @@ export function defineTriggers (builder: Builder): void {
process.trigger.OnSubProcessesDone
)

builder.createDoc(
process.class.Trigger,
core.space.Model,
{
label: process.string.WhenSubProcessMatches,
icon: process.icon.WaitSubprocesses,
editor: process.component.SubProcessMatchEditor,
presenter: process.component.SubProcessMatchPresenter,
checkFunction: process.triggerCheck.SubProcessMatchCheck,
requiredParams: ['process'],
init: false,
auto: true
},
process.trigger.OnSubProcessMatch
)

builder.createDoc(
process.class.Trigger,
core.space.Model,
Expand Down
5 changes: 5 additions & 0 deletions models/server-process/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export function createModel (builder: Builder): void {
serverCheckFunc: serverProcess.func.CheckSubProcessesDone
})

builder.mixin(process.trigger.OnSubProcessMatch, process.class.Trigger, serverProcess.mixin.TriggerImpl, {
preventRollback: true,
serverCheckFunc: serverProcess.func.CheckSubProcessMatch
})

builder.mixin(process.method.RunSubProcess, process.class.Method, serverProcess.mixin.MethodImpl, {
func: serverProcess.func.RunSubProcess
})
Expand Down
7 changes: 4 additions & 3 deletions packages/presentation/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ export function findAttributeEditorByAttribute (client: Client, attribute: AnyAt
const hierarchy = client.getHierarchy()
if (attribute === undefined) return

if (attribute.editor != null) {
return attribute.editor
}

if (attribute.type._class === core.class.TypeAny) {
const _type: TypeAny = attribute.type as TypeAny<AnyComponent>
return _type.editor ?? _type.presenter
Expand Down Expand Up @@ -769,9 +773,6 @@ export function findAttributeEditorByAttribute (client: Client, attribute: AnyAt
}
}

if (attribute.editor != null) {
return attribute.editor
}
const editorMixin = hierarchy.classHierarchyMixin(presenterClass.attrClass, mixin)

if (editorMixin?.inlineEditor === undefined) {
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"EnterValue": "Zadat hodnotu",
"OnToDoDone": "Při dokončení akční položky",
"OnSubProcessesDone": "Při dokončení podprocesů",
"WhenSubProcessMatches": "Když podproces odpovídá podmínce",
"Result": "Výsledek",
"NoResultRequired": "Není vyžadován žádný výsledek",
"RequestResult": "Požádat o výsledek",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"EnterValue": "Wert eingeben",
"OnToDoDone": "Beim Erledigen von Action Item",
"OnSubProcessesDone": "Beim Abschluss von Unterprozessen",
"WhenSubProcessMatches": "Wenn Unterprozess übereinstimmt",
"Result": "Ergebnis",
"NoResultRequired": "Kein Ergebnis erforderlich",
"RequestResult": "Ergebnis anfordern",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"EnterValue": "Enter value",
"OnToDoDone": "When action item done",
"OnSubProcessesDone": "On sub processes done",
"WhenSubProcessMatches": "When subprocess matches",
"Result": "Result",
"RequestResult": "Request result",
"NoResultRequired": "No result required",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "Ingrese un valor",
"OnToDoDone": "Al completar la acción",
"OnSubProcessesDone": "Al finalizar los subprocesos",
"WhenSubProcessMatches": "Cuando el subproceso coincide",
"Result": "Resultado",
"RequestResult": "Solicitar resultado",
"NoResultRequired": "No se requiere resultado",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "Saisir une valeur",
"OnToDoDone": "Lors de l'achèvement de l'action",
"OnSubProcessesDone": "Au fin des sous-processus",
"WhenSubProcessMatches": "Lorsque le sous-processus correspond",
"Result": "Résultat",
"RequestResult": "Demander le résultat",
"NoResultRequired": "Aucun résultat requis",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "Inserisci valore",
"OnToDoDone": "Quando l'azione è completata",
"OnSubProcessesDone": "Alla fine dei sottoprocessi",
"WhenSubProcessMatches": "Quando il sottoprocesso corrisponde",
"Result": "Risultato",
"RequestResult": "Richiedi risultato",
"NoResultRequired": "Nessun risultato richiesto",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "値を入力",
"OnToDoDone": "アクション完了時",
"OnSubProcessesDone": "サブプロセス完了時",
"WhenSubProcessMatches": "サブプロセスが条件に一致したとき",
"RequestResult": "結果をリクエスト",
"NoResultRequired": "結果は不要",
"From": "から",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "Insira valor",
"OnToDoDone": "Ao completar a ação",
"OnSubProcessesDone": "Ao concluir processos sub",
"WhenSubProcessMatches": "Quando o subprocesso corresponde",
"Result": "Resultado",
"RequestResult": "Solicitar resultado",
"NoResultRequired": "Nenhum resultado requerido",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "Введите значение",
"OnToDoDone": "При завершении задачи",
"OnSubProcessesDone": "При завершении подпроцессов",
"WhenSubProcessMatches": "Когда подпроцесс соответствует условию",
"Result": "Результат",
"NoResultRequired": "Результат не требуется",
"RequestResult": "Запросить результат",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"EnterValue": "Değer gir",
"OnToDoDone": "Eylem öğesi tamamlandığında",
"OnSubProcessesDone": "Alt süreçler tamamlandığında",
"WhenSubProcessMatches": "Alt süreç eşleştiğinde",
"Result": "Sonuç",
"RequestResult": "Sonuç talep et",
"NoResultRequired": "Sonuç gerekmez",
Expand Down
1 change: 1 addition & 0 deletions plugins/process-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"EnterValue": "输入值",
"OnToDoDone": "任务完成时",
"OnSubProcessesDone": "子进程完成时",
"WhenSubProcessMatches": "当子进程匹配条件时",
"Result": "结果",
"RequestResult": "请求结果",
"NoResultRequired": "无需结果",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
<script lang="ts">
import { AnyAttribute } from '@hcengineering/core'
import { Context, Process } from '@hcengineering/process'
import { Component, DropdownLabelsIntl } from '@hcengineering/ui'
import { Component } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import { buildResult, Mode, ModeId, Modes, parseValue } from '../../query'
import BaseCriteriaEditor from './BaseCriteriaEditor.svelte'
import ModeSelector from './ModeSelector.svelte'

export let readonly: boolean
export let value: any
Expand All @@ -32,7 +33,6 @@

let [val, selectedMode] = parseValue(modesValues, value)

$: mode = selectedMode.id
const dispatch = createEventDispatcher()

$: [val, selectedMode] = parseValue(modesValues, value)
Expand All @@ -42,27 +42,18 @@
value = result
dispatch('change', result)
}

function changeMode (e: CustomEvent): void {
const editorChanged = e.detail
if (editorChanged) {
val = undefined
}
changeResult(val)
}
</script>

<div class="flex-row-center flex-gap-4">
<DropdownLabelsIntl
items={modesValues}
selected={mode}
disabled={readonly}
minW0={false}
kind={'no-border'}
width={'100%'}
on:selected={(e) => {
mode = e.detail
const prevEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
selectedMode = modesValues.find((m) => m.id === mode) ?? modesValues[0]
const newEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
if (prevEditor !== newEditor) {
val = undefined
}
changeResult(val)
}}
/>
<ModeSelector bind:selectedMode modes={modesValues} {readonly} on:change={changeMode} />
{#if selectedMode.editor}
<div class="w-full">
<Component
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
// Copyright © 2025 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->

<script lang="ts">
import { DropdownLabelsIntl } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import { Mode } from '../../query'

export let selectedMode: Mode
export let readonly: boolean
export let modes: Mode[] = []

$: mode = selectedMode.id

const dispatch = createEventDispatcher()
</script>

<DropdownLabelsIntl
items={modes}
selected={mode}
disabled={readonly}
minW0={false}
kind={'no-border'}
width={'100%'}
on:selected={(e) => {
mode = e.detail
const prevEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
selectedMode = modes.find((m) => m.id === mode) ?? modes[0]
const newEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
dispatch('change', prevEditor !== newEditor)
}}
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
// Copyright © 2025 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->

<script lang="ts">
import { Ref, SortingOrder } from '@hcengineering/core'
import { Process, State } from '@hcengineering/process'
import { Dropdown, DropdownLabels } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin'
import { buildResult, Modes, parseValue } from '../../query'
import ModeSelector from './ModeSelector.svelte'
import { ObjectBox } from '@hcengineering/view-resources'
import { createQuery } from '@hcengineering/presentation'

export let readonly: boolean
export let target: Ref<Process> | undefined
export let value: any

const dispatch = createEventDispatcher()

const modes = [Modes.ArrayAll, Modes.ArrayAny, Modes.ArrayNotIncludes]

let [val, selectedMode] = parseValue(modes, value)
$: [val, selectedMode] = parseValue(modes, value)

function changeMode (): void {
value = buildResult(selectedMode, val)
dispatch('change', value)
}

function change (e: CustomEvent): void {
val = e.detail ?? []
value = buildResult(selectedMode, val)
dispatch('change', value)
}

const query = createQuery()
let states: State[] = []
$: query.query(
plugin.class.State,
{ process: target },
(items) => {
states = items
},
{ sort: { rank: SortingOrder.Ascending } }
)

$: selected = states.filter((state) => val?.includes(state._id))?.map((p) => p._id)
</script>

<div class="flex-row-center flex-gap-4">
<ModeSelector bind:selectedMode {modes} {readonly} on:change={changeMode} />
<DropdownLabels
useFlexGrow
width={'100%'}
multiselect={true}
items={states.map((state) => ({ id: state._id, label: state.title }))}
{selected}
on:selected={change}
/>
</div>
Loading