Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process artefact export (new MS) #117

Merged
merged 35 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
895ae9e
select box styling, table categories button added, functionality tba
winniel24 Aug 23, 2023
ed9f3df
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Aug 23, 2023
400e3dd
select bar layout wip
winniel24 Aug 23, 2023
51e0738
Merge branch 'modeler-toolbar-zustand-exp' of https://github.com/PROC…
MaxiLein Aug 23, 2023
b81caa1
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Aug 24, 2023
a3c477d
added first version of a breadcrumb
MaxiLein Aug 24, 2023
b1a277c
styling wip
winniel24 Aug 24, 2023
f4ca92f
Breadcrumb version and process select
MaxiLein Aug 24, 2023
09765e6
fuzzy search, dropdown for columns, deselect for multirow
MaxiLein Aug 24, 2023
c383cb7
add comment for fuzzy search
MaxiLein Aug 28, 2023
e645f7b
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Aug 28, 2023
9e00506
changed colour breadcrumb, added latest changes to modeler (jj), Menu…
MaxiLein Aug 28, 2023
ee44b66
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Aug 29, 2023
232c295
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Aug 30, 2023
4051761
Adjusted Modeler height, added Preview-Viewer Co-authored-by: winniel…
MaxiLein Aug 31, 2023
b940034
Made previewer height adjustable
MaxiLein Sep 1, 2023
3b8515f
Merge branch 'main' into modeler-toolbar-zustand-exp
MaxiLein Sep 1, 2023
0a3f6a7
Added export of a single process as bpmn, svg or pdf from the process…
jjoderis Sep 7, 2023
698f1d3
Added the process export modal to the processes view in addition to t…
jjoderis Sep 7, 2023
697da26
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/proce…
jjoderis Sep 7, 2023
37fb59f
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/proce…
jjoderis Sep 8, 2023
3bc7865
Ran prettier
jjoderis Sep 8, 2023
3c27e63
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/proce…
jjoderis Oct 3, 2023
0c42950
Removed unnecessary code
jjoderis Oct 3, 2023
c98738d
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/proce…
jjoderis Oct 5, 2023
1801e6f
Added jszip as a dependency
jjoderis Oct 5, 2023
073fd06
Added option to export multiple processes at once
jjoderis Oct 6, 2023
4770307
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/multi…
jjoderis Oct 9, 2023
3dca4be
Added the option to export user task html alongside process bpmn
jjoderis Oct 10, 2023
0066f78
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/proce…
jjoderis Oct 12, 2023
b173ab6
Added an export preparation step to handle situations where a user se…
jjoderis Oct 12, 2023
fb60ff0
Added image export when artefacts are supposed to be exported with th…
jjoderis Oct 12, 2023
46e600a
Consolidated some logic
jjoderis Oct 12, 2023
0bdf146
Added some comments and fixed a broken import
jjoderis Oct 12, 2023
ab202a4
Removed unused code
jjoderis Oct 12, 2023
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
87 changes: 68 additions & 19 deletions src/management-system-v2/components/process-export.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,101 @@
import React, { useState } from 'react';

import { Modal, Checkbox } from 'antd';
import { Modal, Checkbox, Radio, RadioChangeEvent } from 'antd';
import type { CheckboxValueType } from 'antd/es/checkbox/Group';

import { exportProcesses, exportType } from '@/lib/process-export';
import { exportProcesses } from '@/lib/process-export';
import { ProcessExportOptions } from '@/lib/process-export/export-preparation';

const exportTypeOptions = [
{ label: 'BPMN', value: 'bpmn' },
{ label: 'PDF', value: 'pdf' },
{ label: 'SVG', value: 'svg' },
];

const exportSubOptions = {
bpmn: [{ label: 'Export with Artefacts', value: 'artefacts' }],
pdf: [],
svg: [],
};

type ProcessExportModalProps = {
processes: { definitionId: string; processVersion?: number | string }[]; // the processes to export; also used to decide if the modal should be opened
onClose: () => void;
};

const ProcessExportModal: React.FC<ProcessExportModalProps> = ({ processes = [], onClose }) => {
const [selectedTypes, setSelectedTypes] = useState<CheckboxValueType[]>([]);
const [selectedType, setSelectedType] = useState<ProcessExportOptions['type']>();
const [selectedOptions, setSelectedOptions] = useState<CheckboxValueType[]>([]);
const [finishedTypeSelection, setfinishedTypeSelection] = useState(false);

const handleTypeSelectionChange = (checkedValues: CheckboxValueType[]) => {
// allow selection of exactly one element
if (!checkedValues.length) return;
setSelectedTypes(checkedValues.filter((el) => !selectedTypes.includes(el)));
const handleTypeSelectionChange = ({ target: { value } }: RadioChangeEvent) => {
setSelectedType(value);
};

const handleProcessExport = async () => {
await exportProcesses(processes, selectedTypes[0] as exportType);
const handleOptionSelectionChange = (checkedValues: CheckboxValueType[]) => {
setSelectedOptions(checkedValues);
};

const handleClose = () => {
setSelectedType(undefined);
setfinishedTypeSelection(false);
onClose();
};

const handleOk = async () => {
if (!finishedTypeSelection) {
const subOptions = exportSubOptions[selectedType!];
if (subOptions && subOptions.length) {
// there are suboptions that the user might want to select => switch to the other modal view
setfinishedTypeSelection(true);
return;
}
}

await exportProcesses(
{
type: selectedType!,
artefacts: selectedOptions.some((el) => el === 'artefacts'),
},
processes,
);

handleClose();
};

const modalTitle = finishedTypeSelection
? `Select ${selectedType} export options`
: 'Select the file type';

const typeSelection = (
<Radio.Group
options={exportTypeOptions}
onChange={handleTypeSelectionChange}
value={selectedType}
style={{ flexDirection: 'column' }}
/>
);

const optionSelection = (
<Checkbox.Group
options={exportSubOptions[selectedType!]}
onChange={handleOptionSelectionChange}
value={selectedOptions}
style={{ flexDirection: 'column' }}
/>
);

return (
<>
<Modal
title="Export selected process"
title={modalTitle}
open={!!processes.length}
onOk={handleProcessExport}
onCancel={onClose}
onOk={handleOk}
onCancel={handleClose}
centered
okButtonProps={{ disabled: !selectedTypes.length }}
okButtonProps={{ disabled: !selectedType }}
>
<Checkbox.Group
options={exportTypeOptions}
onChange={handleTypeSelectionChange}
value={selectedTypes}
style={{ flexDirection: 'column' }}
/>
{finishedTypeSelection ? optionSelection : typeSelection}
</Modal>
</>
);
Expand Down
193 changes: 0 additions & 193 deletions src/management-system-v2/lib/process-export.ts

This file was deleted.

Loading