From 583538199dffca507eace66da09f211c25821c44 Mon Sep 17 00:00:00 2001 From: danloa Date: Tue, 3 Sep 2024 09:12:34 -0400 Subject: [PATCH 01/15] Handle errors when file upload fails --- src/components/renderer/file-upload.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index a055be113..a22666ee2 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -13,6 +13,7 @@ @upload-start="start" @file-removed="removed" @file-success="fileUploaded" + @file-error="fileError" @file-added="addFile" :class="{'was-validated': required}" > @@ -503,6 +504,10 @@ export default { e.target.click(); } }, + fileError(rootFile, file, message, chunk) + { + this.$emit('file-error', message); + }, fileUploaded(rootFile, file, message) { this.uploading = false; let name = file.name; From 2210268c4e2bb02be2dbffa9116a7417e9097a7c Mon Sep 17 00:00:00 2001 From: danloa Date: Thu, 5 Sep 2024 10:35:06 -0400 Subject: [PATCH 02/15] Display message if file upload fails --- src/components/renderer/file-upload.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index a22666ee2..3e9062ece 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -504,9 +504,22 @@ export default { e.target.click(); } }, - fileError(rootFile, file, message, chunk) + fileError(rootFile, file, messages, chunk) { - this.$emit('file-error', message); + 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'); + } + + this.$emit('file-error', messages); }, fileUploaded(rootFile, file, message) { this.uploading = false; From 2f75bdf22778065eea310dc7106a3778cd4029df Mon Sep 17 00:00:00 2001 From: Miguel Angel Date: Thu, 5 Sep 2024 12:45:54 -0400 Subject: [PATCH 03/15] fix: redirect parallel task completed --- src/components/task.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/components/task.vue b/src/components/task.vue index caae40eba..89c04bb70 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -826,9 +826,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; }, @@ -839,6 +839,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' From d8ad6423f943ab3a224e7f76586e3373701600d8 Mon Sep 17 00:00:00 2001 From: danloa Date: Fri, 6 Sep 2024 10:02:15 -0400 Subject: [PATCH 04/15] Remove unload if upload fails --- src/components/renderer/file-upload.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index 3e9062ece..fef21486c 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -519,6 +519,7 @@ export default { window.ProcessMaker.alert(`${this.$t('File Upload Error:')} ${displayMessage}`, 'danger'); } + window.onbeforeunload = function() {}; this.$emit('file-error', messages); }, fileUploaded(rootFile, file, message) { From f5be3f848cd734f7c816f6f65d140a9237d49c2a Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Tue, 10 Sep 2024 16:35:54 -0700 Subject: [PATCH 05/15] 2.99.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8d23dc62e..e7c304627 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@processmaker/screen-builder", - "version": "2.98.4", + "version": "2.99.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@processmaker/screen-builder", - "version": "2.98.4", + "version": "2.99.0", "dependencies": { "@chantouchsek/validatorjs": "1.2.3", "@storybook/addon-docs": "^7.6.13", diff --git a/package.json b/package.json index bd7f995d4..068b31cc2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@processmaker/screen-builder", - "version": "2.98.4", + "version": "2.99.0", "scripts": { "dev": "VITE_COVERAGE=true vite", "build": "vite build", From 2f39f9132946acd18f6620b32caba3a38b9b25bc Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 12 Sep 2024 21:43:38 -0400 Subject: [PATCH 06/15] Redirect whe the process ends before load the request --- src/components/task.vue | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/components/task.vue b/src/components/task.vue index 89c04bb70..86ddfc60b 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -260,7 +260,7 @@ export default { this.loadNextAssignedTask(); } }, - loadTask() { + loadTask(mounting = false) { if (!this.taskId) { return; } @@ -276,7 +276,7 @@ export default { .getTasks(url) .then((response) => { this.task = response.data; - this.linkTask(); + this.linkTask(mounting); this.checkTaskStatus(); if ( window.PM4ConfigOverrides @@ -296,12 +296,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") { @@ -978,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(); From 788022d7ec17c3e92bdc06de0d3fe88eebcbf49c Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 12 Sep 2024 22:04:28 -0400 Subject: [PATCH 07/15] Validate if there is no answer from endpoint --- src/components/task.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/task.vue b/src/components/task.vue index 86ddfc60b..bf3f5b623 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -307,7 +307,7 @@ export default { // get end event element destination config window.ProcessMaker.apiClient.get(`/requests/${this.requestId}/end-event-destination`) .then((response) => { - if (!response.data.data.endEventDestination) { + if (!response.data?.data?.endEventDestination) { // by default it goes to summary window.location.href = `/requests/${this.requestId}`; return; From a576745b1f16ecb8697ed947dc24d5c45462c702 Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Fri, 13 Sep 2024 14:36:46 -0700 Subject: [PATCH 08/15] 2.99.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7c304627..2591cd2de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.0", + "version": "2.99.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@processmaker/screen-builder", - "version": "2.99.0", + "version": "2.99.1", "dependencies": { "@chantouchsek/validatorjs": "1.2.3", "@storybook/addon-docs": "^7.6.13", diff --git a/package.json b/package.json index 068b31cc2..17690ee97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.0", + "version": "2.99.1", "scripts": { "dev": "VITE_COVERAGE=true vite", "build": "vite build", From 44b80582485d07b1505e62e1fd992aa8a7e0e45e Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Fri, 27 Sep 2024 10:00:23 -0600 Subject: [PATCH 09/15] feat: implement cache-busting with version parameter to ensure screen updates are reflected - Added a version parameter to screen URLs based on the last modified id. - Ensures that changes in the screen trigger a new URL, bypassing cached versions. - Prevents stale data by forcing the browser to fetch the updated resource when changes occur. --- src/DataProvider.js | 6 +++++- src/components/task.vue | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DataProvider.js b/src/DataProvider.js index 38c09ac2c..148397f01 100644 --- a/src/DataProvider.js +++ b/src/DataProvider.js @@ -81,6 +81,10 @@ export default { const hasIncludeScreen = params.match(/include=.*,screen,/); const hasIncludeNested = params.match(/include=.*,nested,/); + // Extract screen_version from params. + const screenVersionMatch = params.match(/screen_version=([^&]+)/); + const screenVersion = screenVersionMatch ? screenVersionMatch[1] : ""; + // remove params ?... promises.push( this.get(endpoint + params.replace(/,screen,|,nested,/g, ",")) @@ -90,7 +94,7 @@ export default { const screenEndpoint = `${(endpoint + params).replace( /\?.+$/, "" - )}/screen?include=screen${hasIncludeNested ? ",nested" : ""}`; + )}/screen?include=screen${hasIncludeNested ? ",nested" : ""}&screen_version=${screenVersion}`; promises.push(this.get(screenEndpoint)); } // Await for both promises to resolve diff --git a/src/components/task.vue b/src/components/task.vue index bf3f5b623..bf8a106e7 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -94,6 +94,7 @@ export default { initialRequestId: { type: Number, default: null }, initialProcessId: { type: Number, default: null }, initialNodeId: { type: String, default: null }, + screenVersion: { type: Number, default: null }, userId: { type: Number, default: null }, csrfToken: { type: String, default: null }, value: { type: Object, default: () => {} }, @@ -265,7 +266,7 @@ export default { return; } - const url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination`; + const url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination&screen_version=${this.screenVersion}`; // For Vocabularies if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) { window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`; From 7f68a0e5838695de83581a1778a3f4531d70e875 Mon Sep 17 00:00:00 2001 From: Eleazar Resendez Date: Fri, 27 Sep 2024 10:47:45 -0600 Subject: [PATCH 10/15] Fix cypress tests --- src/DataProvider.js | 12 +++++++++--- src/components/task.vue | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/DataProvider.js b/src/DataProvider.js index 148397f01..6faea6b49 100644 --- a/src/DataProvider.js +++ b/src/DataProvider.js @@ -83,7 +83,7 @@ export default { // Extract screen_version from params. const screenVersionMatch = params.match(/screen_version=([^&]+)/); - const screenVersion = screenVersionMatch ? screenVersionMatch[1] : ""; + const screenVersion = screenVersionMatch ? screenVersionMatch[1] : null; // remove params ?... promises.push( @@ -91,10 +91,16 @@ export default { ); // Get the screen from a separated cached endpoint if (hasIncludeScreen) { - const screenEndpoint = `${(endpoint + params).replace( + let screenEndpoint = `${(endpoint + params).replace( /\?.+$/, "" - )}/screen?include=screen${hasIncludeNested ? ",nested" : ""}&screen_version=${screenVersion}`; + )}/screen?include=screen${hasIncludeNested ? ",nested" : ""}`; + + // Append screen_version only if screenVersion is not empty. + if (screenVersion) { + screenEndpoint += `&screen_version=${screenVersion}`; + } + promises.push(this.get(screenEndpoint)); } // Await for both promises to resolve diff --git a/src/components/task.vue b/src/components/task.vue index bf8a106e7..bd93e153c 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -266,7 +266,12 @@ export default { return; } - const url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination&screen_version=${this.screenVersion}`; + let url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission,elementDestination`; + + if (this.screenVersion) { + url += `&screen_version=${this.screenVersion}`; + } + // For Vocabularies if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) { window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`; From 9b43f2593926d12e6e74b7ad81e6af9f7506b9e2 Mon Sep 17 00:00:00 2001 From: "Marco A. Nina" Date: Fri, 27 Sep 2024 19:50:39 -0400 Subject: [PATCH 11/15] Set disabled after load next assigned task --- src/components/task.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/task.vue b/src/components/task.vue index bf3f5b623..32adb58c0 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -532,6 +532,7 @@ export default { } else if (this.parentRequest && ['COMPLETED', 'CLOSED'].includes(this.task.process_request.status)) { this.$emit('completed', this.getAllowedRequestId()); } + this.disabled = false; }); }, emitIfTaskCompleted(requestId) { From bf666ec5394c553226ff7faf47df0bb3877c2312 Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Sun, 29 Sep 2024 10:22:48 -0700 Subject: [PATCH 12/15] Update Vue Form Elements --- package-lock.json | 10 +++++----- package.json | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2591cd2de..afdc5448a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "@fortawesome/fontawesome-free": "^5.6.1", "@originjs/vite-plugin-commonjs": "^1.0.3", "@panter/vue-i18next": "^0.15.2", - "@processmaker/vue-form-elements": "0.59.0", + "@processmaker/vue-form-elements": "0.60.0", "@processmaker/vue-multiselect": "2.3.0", "@storybook/addon-essentials": "^7.6.13", "@storybook/addon-interactions": "^7.6.13", @@ -96,7 +96,7 @@ }, "peerDependencies": { "@panter/vue-i18next": "^0.15.0", - "@processmaker/vue-form-elements": "0.59.0", + "@processmaker/vue-form-elements": "0.60.0", "i18next": "^15.0.8", "vue": "^2.6.12", "vuex": "^3.1.1" @@ -4005,9 +4005,9 @@ } }, "node_modules/@processmaker/vue-form-elements": { - "version": "0.59.0", - "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.59.0.tgz", - "integrity": "sha512-LHOehmt5DjM1uIfR+WO42T5MnWn8fOmoaFHZWawKvcAsHiXkKChvnU7u88sZEK+H1Ba+57exd0SDizxmiJPpKg==", + "version": "0.60.0", + "resolved": "https://registry.npmjs.org/@processmaker/vue-form-elements/-/vue-form-elements-0.60.0.tgz", + "integrity": "sha512-Rndk+TlCl3SXGx7VeZq0207fzA3ALNEjfapXazra1yI+AQFqPYAdSLrisckSvGYPTG0TFGGBhpzh+cHjOWlwug==", "dev": true, "dependencies": { "@chantouchsek/validatorjs": "1.2.3", diff --git a/package.json b/package.json index 17690ee97..e935e91f5 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@fortawesome/fontawesome-free": "^5.6.1", "@originjs/vite-plugin-commonjs": "^1.0.3", "@panter/vue-i18next": "^0.15.2", - "@processmaker/vue-form-elements": "0.59.0", + "@processmaker/vue-form-elements": "0.60.0", "@processmaker/vue-multiselect": "2.3.0", "@storybook/addon-essentials": "^7.6.13", "@storybook/addon-interactions": "^7.6.13", @@ -115,7 +115,7 @@ }, "peerDependencies": { "@panter/vue-i18next": "^0.15.0", - "@processmaker/vue-form-elements": "0.59.0", + "@processmaker/vue-form-elements": "0.60.0", "i18next": "^15.0.8", "vue": "^2.6.12", "vuex": "^3.1.1" From f18387ae1b3432de75db0561d00bb70512cd4d85 Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Sun, 29 Sep 2024 10:23:14 -0700 Subject: [PATCH 13/15] 2.99.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index afdc5448a..68788631b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.1", + "version": "2.99.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@processmaker/screen-builder", - "version": "2.99.1", + "version": "2.99.2", "dependencies": { "@chantouchsek/validatorjs": "1.2.3", "@storybook/addon-docs": "^7.6.13", diff --git a/package.json b/package.json index e935e91f5..9bc01d0fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.1", + "version": "2.99.2", "scripts": { "dev": "VITE_COVERAGE=true vite", "build": "vite build", From 8b3f4655b6e37e8a2375a690e62d4fb72a84bb8c Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Fri, 4 Oct 2024 11:47:22 -0700 Subject: [PATCH 14/15] Set self-service property on mounted --- src/components/task.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/task.vue b/src/components/task.vue index 005de17d2..200c5f480 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -1001,6 +1001,7 @@ export default { this.requestData = this.value; this.loopContext = this.initialLoopContext; this.loadTask(true); + this.setSelfService(); }, destroyed() { this.unsubscribeSocketListeners(); From 3115ef5750e1ba3296d7edbddee4ceb76eec4087 Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Mon, 7 Oct 2024 12:14:27 -0700 Subject: [PATCH 15/15] 2.99.3 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 68788631b..522f346e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.2", + "version": "2.99.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@processmaker/screen-builder", - "version": "2.99.2", + "version": "2.99.3", "dependencies": { "@chantouchsek/validatorjs": "1.2.3", "@storybook/addon-docs": "^7.6.13", diff --git a/package.json b/package.json index 9bc01d0fb..56c153031 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@processmaker/screen-builder", - "version": "2.99.2", + "version": "2.99.3", "scripts": { "dev": "VITE_COVERAGE=true vite", "build": "vite build",