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
14 changes: 14 additions & 0 deletions models/process/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,20 @@ export function defineMethods (builder: Builder): void {
process.method.CancelToDo
)

builder.createDoc(
process.class.Method,
core.space.Model,
{
label: process.string.CancelProcess,
editor: process.component.CancelSubProcessEditor,
presenter: process.component.SubProcessPresenter,
objectClass: process.class.Process,
requiredParams: ['_id'],
createdContext: null
},
process.method.CancelSubProcess
)

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

builder.mixin(process.method.CancelSubProcess, process.class.Method, serverProcess.mixin.MethodImpl, {
func: serverProcess.func.CancelSubProcess
})

builder.mixin(process.method.CreateToDo, process.class.Method, serverProcess.mixin.MethodImpl, {
func: serverProcess.func.CreateToDo
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
import card from '../plugin'
import MasterTagAttributes from './MasterTagAttributes.svelte'
import TagAttributes from './TagAttributes.svelte'
import { getClient } from '@hcengineering/presentation'

export let value: Card
export let readonly: boolean = false
export let mixins: Array<Mixin<Doc>> = []
export let ignoreKeys: string[]

const client = getClient()
const h = client.getHierarchy()

let width: number = 0

let columns = 1
Expand Down Expand Up @@ -57,7 +61,7 @@
<div class="masterTag">
<MasterTagAttributes
bind:this={masterTagAttributes}
readonly={readonly || value.readonlySections?.includes(value._class)}
readonly={readonly || h.getAncestors(value._class).some((p) => value.readonlySections?.includes(p))}
{value}
{ignoreKeys}
fourRows={columns === 2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import { CardSectionAction } from '../../types'
import { permissionsStore } from '@hcengineering/contact-resources'
import { canChangeDoc } from '@hcengineering/view-resources'
import { getClient } from '@hcengineering/presentation'

export let readonly: boolean = false
export let doc: Card
Expand All @@ -45,14 +46,19 @@
dispatch('action', { id: 'toc', toc: [] })
})

const client = getClient()
const h = client.getHierarchy()

$: updatePermissionForbidden = doc && !canChangeDoc(doc?._class, doc?.space, $permissionsStore)
</script>

{#if contentDiv != null}
<div class="content" class:hidden>
<Content
{doc}
readonly={readonly || updatePermissionForbidden || doc.readonlySections?.includes(doc._class)}
readonly={readonly ||
updatePermissionForbidden ||
h.getAncestors(doc._class).some((p) => doc.readonlySections?.includes(p))}
content={contentDiv}
showToc={false}
on:loaded
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"UnlockSection": "Odemknout sekci",
"CancelToDo": "Zrušit akční položku",
"Export": "Exportovat",
"Import": "Importovat"
"Import": "Importovat",
"CancelProcess": "Zrušit proces"
},
"error": {
"MethodNotFound": "Metoda nenalezena: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"UnlockSection": "Abschnitt entsperren",
"CancelToDo": "Action Item abbrechen",
"Export": "Exportieren",
"Import": "Importieren"
"Import": "Importieren",
"CancelProcess": "Prozess abbrechen"
},
"error": {
"MethodNotFound": "Methode nicht gefunden: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Unlock section",
"CancelToDo": "Cancel Action item",
"Export": "Export",
"Import": "Import"
"Import": "Import",
"CancelProcess": "Cancel process"
},
"error": {
"MethodNotFound": "Method not found: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Desbloquear sección",
"CancelToDo": "Cancelar acción",
"Export": "Exportar",
"Import": "Importar"
"Import": "Importar",
"CancelProcess": "Cancelar proceso"
},
"error": {
"MethodNotFound": "Método no encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Déverrouiller la section",
"CancelToDo": "Annuler l'action",
"Export": "Exporter",
"Import": "Importer"
"Import": "Importer",
"CancelProcess": "Annuler le processus"
},
"error": {
"MethodNotFound": "Méthode introuvable : {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Sblocca sezione",
"CancelToDo": "Annulla azione",
"Export": "Esporta",
"Import": "Importa"
"Import": "Importa",
"CancelProcess": "Annulla processo"
},
"error": {
"MethodNotFound": "Metodo non trovato: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
"UnlockSection": "セクションのロックを解除",
"CancelToDo": "アクションをキャンセル",
"Export": "エクスポート",
"Import": "インポート"
"Import": "インポート",
"CancelProcess": "プロセスをキャンセル"
},
"error": {
"MethodNotFound": "メソッドが見つかりません: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@
"UnlockSection": "Desbloquear seção",
"CancelToDo": "Cancelar ação",
"Export": "Exportar",
"Import": "Importar"
"Import": "Importar",
"CancelProcess": "Cancelar processo"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Desbloquear seção",
"CancelToDo": "Cancelar ação",
"Export": "Exportar",
"Import": "Importar"
"Import": "Importar",
"CancelProcess": "Cancelar processo"
},
"error": {
"MethodNotFound": "Método não encontrado: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "Разблокировать секцию",
"CancelToDo": "Отменить задачу",
"Export": "Экспорт",
"Import": "Импорт"
"Import": "Импорт",
"CancelProcess": "Отменить процесс"
},
"error": {
"MethodNotFound": "Метод не найден: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
"UnlockSection": "Bölümün kilidini aç",
"CancelToDo": "Eylem öğesini iptal et",
"Export": "Dışa aktar",
"Import": "İçe aktar"
"Import": "İçe aktar",
"CancelProcess": "Süreci iptal et"
},
"error": {
"MethodNotFound": "Metod bulunamadı: {methodId}",
Expand Down
3 changes: 2 additions & 1 deletion plugins/process-assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
"UnlockSection": "解锁部分",
"CancelToDo": "取消任务",
"Export": "导出",
"Import": "导入"
"Import": "导入",
"CancelProcess": "取消过程"
},
"error": {
"MethodNotFound": "找不到方法:{methodId}",
Expand Down
29 changes: 17 additions & 12 deletions plugins/process-resources/src/components/ExecutionMyToDos.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { getCurrentEmployee } from '@hcengineering/contact'
import { getEmbeddedLabel } from '@hcengineering/platform'
import { createQuery, getClient } from '@hcengineering/presentation'
import { ApproveRequest, Execution, ProcessToDo } from '@hcengineering/process'
import { ApproveRequest, Execution, ExecutionStatus, ProcessToDo } from '@hcengineering/process'
import { Button } from '@hcengineering/ui'
import plugin from '../plugin'
import ApproveRequestButtons from './ApproveRequestButtons.svelte'
Expand All @@ -30,17 +30,22 @@
const emp = getCurrentEmployee()

const query = createQuery()
query.query(
plugin.class.ProcessToDo,
{
execution: value._id,
user: emp,
doneOn: null
},
(res) => {
todos = res
}
)
$: if (value.status === ExecutionStatus.Active) {
query.query(
plugin.class.ProcessToDo,
{
execution: value._id,
user: emp,
doneOn: null
},
(res) => {
todos = res
}
)
} else {
query.unsubscribe()
todos = []
}

async function checkTodo (todo: ProcessToDo) {
await client.update(todo, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
process.class.Execution,
{
card: card._id,
status: { $ne: ExecutionStatus.Cancelled }
status: ExecutionStatus.Active
},
(res) => {
docs = res
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!--
// Copyright © 2026 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 card from '@hcengineering/card'
import { Ref } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Process, Step } from '@hcengineering/process'
import { DropdownLabels, DropdownTextItem, Label } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import plugin from '../../plugin'

export let process: Process
export let step: Step<Process>

const dispatch = createEventDispatcher()
const client = getClient()
const hierarchy = client.getHierarchy()

const params = step.params
let _id = params._id as Ref<Process>

function change (e: CustomEvent): void {
if (e.detail !== undefined) {
_id = e.detail
params._id = _id
step.params = params
dispatch('change', step)
}
}

let processes: Process[] = []
let items: DropdownTextItem[] = []

$: items = processes.map((it) => ({
id: it._id,
label: it.name
}))

$: ancestors = hierarchy.getAncestors(process.masterTag).filter((it) => hierarchy.isDerived(it, card.class.Card))

$: selected = _id !== undefined ? items.find((it) => it.id === _id)?.id : undefined

$: processes = client
.getModel()
.findAllSync(plugin.class.Process, { masterTag: { $in: ancestors }, _id: { $ne: process._id } })
</script>

<div class="editor-grid">
<Label label={plugin.string.Process} />
<DropdownLabels
autoSelect={false}
enableSearch={false}
width={'100%'}
{items}
{selected}
placeholder={plugin.string.Process}
on:selected={change}
/>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@

<div class="editor-grid">
<Label label={plugin.string.ToDo} />
<ToDoContextSelector readonly={false} {process} value={_id} on:change={change} />
<ToDoContextSelector readonly={false} skipRollback {process} value={_id} on:change={change} />
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
function change (e: CustomEvent<string>): void {
if (readonly || e.detail == null) return
params._id = e.detail
params.result = undefined
params.result = {}
dispatch('change', { params })
}

Expand All @@ -46,6 +46,12 @@
<Label label={plugin.string.ToDo} />
<ToDoContextSelector {readonly} {skipRollback} {process} value={params._id} on:change={change} />
{#if !skipRollback}
<ResultCriteriaEditor {readonly} {process} result={params.result} value={params._id} on:change={changeResult} />
<ResultCriteriaEditor
{readonly}
{process}
result={params.result ?? {}}
value={params._id}
on:change={changeResult}
/>
{/if}
</div>
2 changes: 2 additions & 0 deletions plugins/process-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import RequestsExtension from './components/RequestsExtension.svelte'
import RunProcessCardPopup from './components/RunProcessCardPopup.svelte'
import RunProcessPopup from './components/RunProcessPopup.svelte'
import ActionsPresenter from './components/settings/ActionsPresenter.svelte'
import CancelSubProcessEditor from './components/settings/CancelSubProcessEditor.svelte'
import CancelToDoEditor from './components/settings/CancelToDoEditor.svelte'
import FunctionSubmenu from './components/settings/FunctionSubmenu.svelte'
import ProcessEditor from './components/settings/ProcessEditor.svelte'
Expand Down Expand Up @@ -173,6 +174,7 @@ export default async (): Promise<Resources> => ({
LockSectionEditor,
UnLockSectionPresenter,
CancelToDoEditor,
CancelSubProcessEditor,
ToDoValuePresenter
},
criteriaEditor: {
Expand Down
2 changes: 2 additions & 0 deletions plugins/process-resources/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default mergeIds(processId, process, {
ProcessEditor: '' as AnyComponent,
ProcessesSettingSection: '' as AnyComponent,
SubProcessEditor: '' as AnyComponent,
CancelSubProcessEditor: '' as AnyComponent,
ApproveRequestEditor: '' as AnyComponent,
ApproveRequestPresenter: '' as AnyComponent,
ApproveRequestTriggerEditor: '' as AnyComponent,
Expand Down Expand Up @@ -121,6 +122,7 @@ export default mergeIds(processId, process, {
DeleteState: '' as IntlString,
DeleteStateConfirm: '' as IntlString,
RunProcess: '' as IntlString,
CancelProcess: '' as IntlString,
Processes: '' as IntlString,
Untitled: '' as IntlString,
States: '' as IntlString,
Expand Down
Loading
Loading