mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
feat: add OnExecutionDone trigger and related functionality for proce… (#10944)
* feat: add OnExecutionDone trigger and related functionality for process management Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> --------- Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Card } from '@hcengineering/card'
|
||||
import { Card, MasterTag, Tag } from '@hcengineering/card'
|
||||
import { Class, Doc, Ref } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Process } from '@hcengineering/process'
|
||||
@@ -34,13 +34,21 @@
|
||||
const res = client.getModel().findAllSync(process.class.Process, {})
|
||||
const processes = res.filter((it) => resClasses.includes(it.masterTag) && it.automationOnly !== true)
|
||||
|
||||
function getCardPossibleClasses (card: Card): Ref<Class<Doc>>[] {
|
||||
const asc = h.getAncestors(card._class)
|
||||
const mixins = h.getDescendants(card._class).filter((p) => h.hasMixin(card, p))
|
||||
return [...asc, ...mixins]
|
||||
type PossibleProcessClass = Ref<MasterTag | Tag>
|
||||
|
||||
function getCardPossibleClasses (card: Card): PossibleProcessClass[] {
|
||||
const ancestors = h.getAncestors(card._class) as PossibleProcessClass[]
|
||||
const res = new Set<PossibleProcessClass>(ancestors)
|
||||
|
||||
const mixins = h.getAllPossibleMixins(card._class).filter((mixin) => h.hasMixin(card, mixin))
|
||||
for (const mixin of mixins) {
|
||||
res.add(mixin)
|
||||
}
|
||||
|
||||
return [...res]
|
||||
}
|
||||
|
||||
function getPossibleClasses (): Ref<Class<Doc>>[] {
|
||||
function getPossibleClasses (): PossibleProcessClass[] {
|
||||
if (!value) {
|
||||
return []
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user