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

Allow Visio file as process diagram #57

Draft
wants to merge 28 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b1a4d93
Disable mock-login route on production (#52)
MartijnBogaert Oct 3, 2024
fd0ffb0
Use mu-search for process steps (#51)
MartijnBogaert Oct 15, 2024
5574f17
Reintroduce links to help page (#53)
MartijnBogaert Oct 22, 2024
c9f23a0
Rename links
MartijnBogaert Oct 22, 2024
2e7f901
Add impersonation service
MartijnBogaert Nov 13, 2024
771bfd9
Adapt current session service to impersonation service
MartijnBogaert Nov 13, 2024
516726f
Add impersonate route
MartijnBogaert Nov 13, 2024
1155ace
Use temporary isAdmin functionality
MartijnBogaert Nov 13, 2024
98e24e7
Add impersonation dropdown
MartijnBogaert Nov 13, 2024
8dc2fd2
Reenable normal isAdmin functionality
MartijnBogaert Nov 15, 2024
ff9de06
Allow changing impersonating account
MartijnBogaert Nov 20, 2024
737e360
Add admin functionality (#54)
MartijnBogaert Nov 20, 2024
1fc12b3
Revert "Add admin functionality (#54)" (#55)
MartijnBogaert Nov 21, 2024
0e1c5c0
Add admin functionality (#56)
MartijnBogaert Nov 22, 2024
7345e6c
Fetch vsdx as diagram
MartijnBogaert Dec 3, 2024
8c5d61b
Forbid vsdx as attachment
MartijnBogaert Dec 3, 2024
38ef595
Allow uploading vsdx
MartijnBogaert Dec 3, 2024
1c2d2dd
Rename bpmn files to diagram
MartijnBogaert Dec 4, 2024
70988bd
Make multiple filter values work
MartijnBogaert Dec 4, 2024
625f0b7
Fix upload bug
MartijnBogaert Dec 4, 2024
65e0cf8
Fetch bpmn from visio file
MartijnBogaert Dec 4, 2024
3182648
Update Visio text
MartijnBogaert Dec 4, 2024
78fd37e
Allow downloading vsdx files
MartijnBogaert Dec 4, 2024
a3844b5
Merge remote-tracking branch 'origin/development' into feature/visio
MartijnBogaert Dec 4, 2024
2d4016e
Merge branch 'development' into feature/visio
MartijnBogaert Jan 8, 2025
dd0ba12
Merge branch 'development' into feature/visio
MartijnBogaert Jan 9, 2025
0a3f01a
Merge branch 'development' into feature/visio
MartijnBogaert Jan 13, 2025
04f60d9
Merge branch 'development' into feature/visio
MartijnBogaert Jan 15, 2025
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
35 changes: 34 additions & 1 deletion app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
import JSONAPIAdapter from '@ember-data/adapter/json-api';

export default class ApplicationAdapter extends JSONAPIAdapter {}
export default class ApplicationAdapter extends JSONAPIAdapter {
buildURL(modelName, id, snapshot, requestType, query) {
// Query object containing
// 'paramKey': ['paramValueA', 'paramValueB']
// Should lead to URL containing query params
// paramKey=paramValueA&paramKey=paramValueB
// Instead of
// paramKey[]=paramValueA&paramKey[]=paramValueB

let url = super.buildURL(modelName, id, snapshot, requestType, query);

if (query) {
const customParams = [];

for (let key in query) {
if (Array.isArray(query[key])) {
query[key].forEach((item) => {
customParams.push(
`${encodeURIComponent(key)}=${encodeURIComponent(item)}`
);
});
delete query[key];
}
}

if (customParams.length > 0) {
const customQueryString = customParams.join('&');
url += `?${customQueryString}`;
}
}

return url;
}
}
12 changes: 4 additions & 8 deletions app/components/bpmn-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export default class BpmnViewerComponent extends Component {
element.tabIndex = 0; // Make element focusable
this.viewer = new NavigatedViewer({ container: element });

const bpmnFile = this.args.bpmnFile;
if (!bpmnFile) return;
const latestBpmnFileId = this.args.diagram?.bpmnFile?.id;
if (!latestBpmnFileId) return;

const bpmnXml = await this.downloadBpmnFile.perform(bpmnFile.id);
const bpmnXml = await this.downloadBpmnFile.perform(latestBpmnFileId);
if (!bpmnXml) return;

await this.viewer.importXML(bpmnXml);
Expand All @@ -40,11 +40,7 @@ export default class BpmnViewerComponent extends Component {
@restartableTask
*downloadBpmnFile(bpmnFileId) {
const url = generateFileDownloadUrl(bpmnFileId);
const response = yield fetch(url, {
headers: {
Accept: 'text/xml',
},
});
const response = yield fetch(url);
if (!response.ok) throw Error(response.status);
return yield response.text();
}
Expand Down
11 changes: 10 additions & 1 deletion app/components/custom-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,22 @@ export default class AuFileUpload extends Component {
*upload(file) {
this.resetErrors();

if (this.args.bpmnForbidden && file.name.endsWith('.bpmn')) {
const forbidden = this.args.forbidden?.split(',') ?? [];

if (forbidden.includes('.bpmn') && file.name.endsWith('.bpmn')) {
this.addError(
file,
'BPMN-bestanden kunnen niet worden toegevoegd aan bijlagen.'
);
this.removeFileFromQueue(file);
return;
} else if (forbidden.includes('.vsdx') && file.name.endsWith('.vsdx')) {
this.addError(
file,
'Visiobestanden kunnen niet worden toegevoegd aan bijlagen.'
);
this.removeFileFromQueue(file);
return;
}

let uploadedFileId = yield this.uploadFileTask.perform(file);
Expand Down
Loading