@haiiro/docuflow 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -11
- package/manifest.json +37 -33
- package/package.json +1 -1
- package/src/front-components/docflow-documents.front-component.mjs +26 -26
- package/src/front-components/docflow-documents.front-component.tsx +24 -8
- package/src/front-components/docflow-processes.front-component.mjs +23 -23
- package/src/front-components/docflow-processes.front-component.tsx +27 -3
- package/src/front-components/docflow-tasks.front-component.mjs +32 -32
- package/src/front-components/docflow-tasks.front-component.tsx +16 -4
- package/src/front-components/process-steps.front-component.mjs +21 -21
- package/src/front-components/process-steps.front-component.tsx +36 -13
- package/src/logic-functions/hand-out-form-step.logic-function.mjs +6 -1
- package/src/logic-functions/launch-parameters-step.logic-function.mjs +1 -15
- package/src/logic-functions/launch-parameters-step.logic-function.ts +4 -18
- package/src/logic-functions/on-workflow-run-updated.logic-function.mjs +6 -1
- package/src/logic-functions/save-launch-fields.logic-function.mjs +72 -106
- package/src/logic-functions/save-launch-fields.logic-function.ts +9 -9
|
@@ -4,7 +4,7 @@ import { AppPath, enqueueSnackbar, navigate } from 'twenty-sdk/front-component';
|
|
|
4
4
|
import { Button } from 'twenty-ui/primitives/input';
|
|
5
5
|
import { useTheme } from 'twenty-ui/theme';
|
|
6
6
|
|
|
7
|
-
import { callAppRoute, createRecord, getErrorMessage, listRecords } from 'src/front/api';
|
|
7
|
+
import { callAppRoute, createRecord, deleteRecord, getErrorMessage, listRecords } from 'src/front/api';
|
|
8
8
|
import { useAsync, useDebouncedValue } from 'src/front/hooks/use-async';
|
|
9
9
|
import { DataTable, DocflowRoot, Message, SplitView, TextField, Toolbar } from 'src/front/ui/components';
|
|
10
10
|
import { FormFieldInputs } from 'src/front/ui/form-field-inputs';
|
|
@@ -15,6 +15,7 @@ import { findMissingRequiredFields } from 'src/shared/form/form-fields.util';
|
|
|
15
15
|
import { logDocflow, logDocflowError } from 'src/shared/log.util';
|
|
16
16
|
import {
|
|
17
17
|
buildLaunchParameters,
|
|
18
|
+
isLaunchableTrigger,
|
|
18
19
|
isLaunchParametersStep,
|
|
19
20
|
parseLaunchFields,
|
|
20
21
|
} from 'src/shared/workflow/launch-step.util';
|
|
@@ -71,7 +72,7 @@ const loadProcesses = async (searchQuery: string): Promise<DocflowProcess[]> =>
|
|
|
71
72
|
return workflows.flatMap((workflow) => {
|
|
72
73
|
const version = versions.find((candidate) => candidate.workflowId === workflow.id);
|
|
73
74
|
|
|
74
|
-
if (version === undefined || version.trigger
|
|
75
|
+
if (version === undefined || !isLaunchableTrigger(version.trigger)) {
|
|
75
76
|
return [];
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -181,10 +182,32 @@ const DocflowProcesses = () => {
|
|
|
181
182
|
const searchQuery = useDebouncedValue(searchInput, SEARCH_DEBOUNCE_MS);
|
|
182
183
|
const [panel, setPanel] = useState<Panel>({ kind: 'closed' });
|
|
183
184
|
const [isCreating, setIsCreating] = useState(false);
|
|
184
|
-
const { data: processes, loading, error } = useAsync(() => loadProcesses(searchQuery), [searchQuery]);
|
|
185
|
+
const { data: processes, loading, error, reload } = useAsync(() => loadProcesses(searchQuery), [searchQuery]);
|
|
185
186
|
const selectedVersionId = panel.kind === 'process' ? panel.workflowVersionId : undefined;
|
|
186
187
|
const selectedProcess = processes?.find((process) => process.workflowVersionId === selectedVersionId);
|
|
187
188
|
|
|
189
|
+
// The process goes to the Twenty trash ("Рабочие процессы → Удалённые"),
|
|
190
|
+
// its runs and tasks stay.
|
|
191
|
+
const handleDeleteProcess = async (workflowVersionId: string) => {
|
|
192
|
+
const process = processes?.find((candidate) => candidate.workflowVersionId === workflowVersionId);
|
|
193
|
+
|
|
194
|
+
if (process === undefined) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
try {
|
|
199
|
+
await deleteRecord('workflows', process.workflowId);
|
|
200
|
+
setPanel((current) =>
|
|
201
|
+
current.kind === 'process' && current.workflowVersionId === workflowVersionId ? { kind: 'closed' } : current,
|
|
202
|
+
);
|
|
203
|
+
await enqueueSnackbar({ message: `Процесс «${process.name}» удалён`, variant: 'success' });
|
|
204
|
+
await reload();
|
|
205
|
+
} catch (deleteError) {
|
|
206
|
+
logDocflowError('process: delete failed', deleteError, { workflowId: process.workflowId });
|
|
207
|
+
await enqueueSnackbar({ message: getErrorMessage(deleteError, 'Не удалось удалить процесс'), variant: 'error' });
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
188
211
|
// As "Создать" of the standard list: a process with a manual trigger in the
|
|
189
212
|
// docflow section, opened in the editor. Launch parameters are set later
|
|
190
213
|
// with the process's "Параметры запуска" command.
|
|
@@ -270,6 +293,7 @@ const DocflowProcesses = () => {
|
|
|
270
293
|
]}
|
|
271
294
|
selectedRowId={selectedVersionId}
|
|
272
295
|
onRowClick={(workflowVersionId) => setPanel({ kind: 'process', workflowVersionId })}
|
|
296
|
+
onDeleteRow={handleDeleteProcess}
|
|
273
297
|
rows={processes.map((process) => {
|
|
274
298
|
const parameterCount = process.launchFields.length;
|
|
275
299
|
|