Skip to content

Commit

Permalink
Merge branch 'next' into feature/FOUR-18103
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanpro committed Sep 24, 2024
2 parents 1001388 + a576745 commit 7e70c77
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@processmaker/screen-builder",
"version": "2.98.4",
"version": "2.99.1",
"scripts": {
"dev": "VITE_COVERAGE=true vite",
"build": "vite build",
Expand Down
19 changes: 19 additions & 0 deletions src/components/renderer/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@upload-start="start"
@file-removed="removed"
@file-success="fileUploaded"
@file-error="fileError"
@file-added="addFile"
:class="{'was-validated': required}"
>
Expand Down Expand Up @@ -503,6 +504,24 @@ export default {
e.target.click();
}
},
fileError(rootFile, file, messages, chunk)
{
let displayMessage = '';
try {
const messagesArray = JSON.parse(messages);
displayMessage = messagesArray.join(', ');
}
catch (e) {
displayMessage = messages;
}
if (displayMessage.length > 0) {
window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger');
}
window.onbeforeunload = function() {};
this.$emit('file-error', messages);
},
fileUploaded(rootFile, file, message) {
this.uploading = false;
let name = file.name;
Expand Down
38 changes: 32 additions & 6 deletions src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default {
this.loadNextAssignedTask();
}
},
loadTask() {
loadTask(mounting = false) {
if (!this.taskId) {
return;
}
Expand All @@ -277,7 +277,7 @@ export default {
.getTasks(url)
.then((response) => {
this.task = response.data;
this.linkTask();
this.linkTask(mounting);
this.checkTaskStatus();
if (
window.PM4ConfigOverrides
Expand All @@ -297,12 +297,27 @@ export default {
});
});
},
linkTask() {
linkTask(mounting) {
this.nodeId = this.task.element_id;
this.listenForParentChanges();
if (this.task.process_request.status === 'COMPLETED') {
if (!this.taskPreview) {
this.$emit('completed', this.task.process_request.id);
// When the process ends before the request is opened
if (mounting) {
// get end event element destination config
window.ProcessMaker.apiClient.get(`/requests/${this.requestId}/end-event-destination`)
.then((response) => {
if (!response.data?.data?.endEventDestination) {
// by default it goes to summary
window.location.href = `/requests/${this.requestId}`;
return;
}
// process the end event destination
this.processCompletedRedirect(response.data.data, this.userId, this.requestId);
});
}
}
}
if (this.taskPreview && this.task.status === "CLOSED") {
Expand Down Expand Up @@ -826,9 +841,9 @@ export default {
*/
isSameUser(currentTask, redirectData) {
const userIdMatch = currentTask.user?.id === redirectData.params[0].userId;
const typeMatch = currentTask.elementDestination?.type === null
const typeMatch = currentTask.elementDestination?.type === null
|| currentTask.elementDestination?.type === 'taskSource';
return userIdMatch && typeMatch;
},
Expand All @@ -839,6 +854,17 @@ export default {
* @param {Object} data - The event data containing the process update information.
*/
handleProcessUpdated(data) {
const elementDestinationValue = this.task.elementDestination?.value;
if (
elementDestinationValue &&
data?.params[0]?.tokenId === this.taskId &&
data?.params[0]?.requestStatus === 'ACTIVE'
) {
window.location.href = elementDestinationValue;
return;
}
if (
['ACTIVITY_ACTIVATED', 'ACTIVITY_COMPLETED'].includes(data.event)
&& data.elementType === 'task'
Expand Down Expand Up @@ -967,7 +993,7 @@ export default {
this.nodeId = this.initialNodeId;
this.requestData = this.value;
this.loopContext = this.initialLoopContext;
this.loadTask();
this.loadTask(true);
},
destroyed() {
this.unsubscribeSocketListeners();
Expand Down

0 comments on commit 7e70c77

Please sign in to comment.