From b196dcb0fdb49f253c7704abfd9db79938a9d4c7 Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Fri, 1 Mar 2024 18:19:02 -0400 Subject: [PATCH 1/8] modify the formdata with the draft data --- src/components/task.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/task.vue b/src/components/task.vue index 5a50ec6f9..a512b7a65 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -289,7 +289,7 @@ export default { } }, loadTask() { - const url = `/${this.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`; + const url = `/${this.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`; // For Vocabularies if (window.ProcessMaker && window.ProcessMaker.packages && window.ProcessMaker.packages.includes('package-vocabularies')) { window.ProcessMaker.VocabulariesSchemaUrl = `vocabularies/task_schema/${this.taskId}`; @@ -324,6 +324,14 @@ export default { this.resetScreenState(); this.requestData = _.get(this.task, 'request_data', {}); this.loopContext = _.get(this.task, "loop_context", ""); + + if (this.task.draft) { + this.requestData = { + ...this.requestData, + ...this.task.data + }; + } + this.refreshScreen++; } From 973441e340f95343f9de0c4aa479fa5f6cdf5365 Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Fri, 1 Mar 2024 18:24:29 -0400 Subject: [PATCH 2/8] Work in progress --- 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 a512b7a65..cd0c5f786 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -328,7 +328,7 @@ export default { if (this.task.draft) { this.requestData = { ...this.requestData, - ...this.task.data + ...this.task.draft.data }; } From b43868f57ea3509df5ce6888d9cb91e268079516 Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Mon, 4 Mar 2024 18:30:45 -0400 Subject: [PATCH 3/8] work in progress --- src/components/task.vue | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/task.vue b/src/components/task.vue index cd0c5f786..4c5311d2d 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -115,7 +115,8 @@ export default { hasErrors: false, refreshScreen: 0, redirecting: null, - loadingButton: false + loadingButton: false, + firstRun: true }; }, watch: { @@ -223,7 +224,19 @@ export default { } this.renderComponent = component; } + } + }, + requestData: { + handler(newValue, oldValue) { + if (!_.isEqual(oldValue, {})) { + if (this.firstRun) { + this.firstRun = false; + } else { + this.$emit('form-data-changed', newValue); + } + } }, + deep: true }, }, computed: { @@ -326,10 +339,11 @@ export default { this.loopContext = _.get(this.task, "loop_context", ""); if (this.task.draft) { - this.requestData = { - ...this.requestData, - ...this.task.draft.data - }; + this.requestData = _.merge( + {}, + this.requestData, + this.task.draft.data + ); } this.refreshScreen++; From 64a99ccbd3c1bf946b19492c22204f2cd83142e2 Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Tue, 5 Mar 2024 18:26:06 -0400 Subject: [PATCH 4/8] Added a task form auto save --- src/components/task.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/task.vue b/src/components/task.vue index 4c5311d2d..d094ced3b 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -116,7 +116,8 @@ export default { refreshScreen: 0, redirecting: null, loadingButton: false, - firstRun: true + firstRun: true, + debounceTimeout: null }; }, watch: { From 5ef21a39dd267b3b8ca82392ffb2f560e674927f Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Wed, 6 Mar 2024 16:00:41 -0400 Subject: [PATCH 5/8] Move task form data watcher --- src/components/task.vue | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/components/task.vue b/src/components/task.vue index d094ced3b..c3d041e53 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -227,18 +227,6 @@ export default { } } }, - requestData: { - handler(newValue, oldValue) { - if (!_.isEqual(oldValue, {})) { - if (this.firstRun) { - this.firstRun = false; - } else { - this.$emit('form-data-changed', newValue); - } - } - }, - deep: true - }, }, computed: { shouldAddSubmitButton() { From a1a125dc56d66093469ba75bb78251cd1c3f1807 Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Tue, 12 Mar 2024 17:49:45 -0400 Subject: [PATCH 6/8] clean code --- src/components/task.vue | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/task.vue b/src/components/task.vue index c3d041e53..e75c807c1 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -116,8 +116,6 @@ export default { refreshScreen: 0, redirecting: null, loadingButton: false, - firstRun: true, - debounceTimeout: null }; }, watch: { From 6483da998266c73dce3ed75aed54e0181d5d7386 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 13 Mar 2024 14:29:53 -0700 Subject: [PATCH 7/8] Update test --- tests/e2e/specs/Task.spec.js | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/e2e/specs/Task.spec.js b/tests/e2e/specs/Task.spec.js index 596820f9f..9eabf940d 100644 --- a/tests/e2e/specs/Task.spec.js +++ b/tests/e2e/specs/Task.spec.js @@ -24,7 +24,7 @@ describe("Task component", () => { it("Task inside a Request", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -79,7 +79,7 @@ describe("Task component", () => { it("Completes the Task", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -141,7 +141,7 @@ describe("Task component", () => { .then(function () { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "completed", @@ -158,7 +158,7 @@ describe("Task component", () => { it("Progresses to the interstitial screen", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -312,7 +312,7 @@ describe("Task component", () => { }); cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { body: completedBodyRequest } ); cy.reload(); @@ -328,7 +328,7 @@ describe("Task component", () => { it("It updates the PM4ConfigOverrides", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -394,7 +394,7 @@ describe("Task component", () => { it("Task with display next assigned task checked with another pending task in same request should redirect to the next task of same request", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -424,7 +424,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); @@ -450,7 +450,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask2 ); @@ -470,7 +470,7 @@ describe("Task component", () => { it("Task with display next assigned task checked in subprocess and no pending task and status closed or open should redirect to parent requests", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -501,7 +501,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); @@ -520,7 +520,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask2 ); @@ -541,7 +541,7 @@ describe("Task component", () => { it("Task with display next assigned task checked in different process request should redirect to the next task of parent request", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -571,7 +571,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); @@ -596,7 +596,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask2.taskId}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask2 ); @@ -616,7 +616,7 @@ describe("Task component", () => { it("Task with display next assigned task unchecked should redirect to tasks list", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -646,7 +646,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); @@ -666,7 +666,7 @@ describe("Task component", () => { it("Process without pending task should redirect to request", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -696,7 +696,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); @@ -723,7 +723,7 @@ describe("Task component", () => { it("Subprocess without pending task should redirect to parent request", () => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open", @@ -760,7 +760,7 @@ describe("Task component", () => { }; getTask( - `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, + `http://localhost:5173/api/1.0/tasks/${responseDataTask1.id}?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission`, responseDataTask1 ); From d750b0c8e15f93c47363d86b3a1660230150006a Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 13 Mar 2024 14:48:21 -0700 Subject: [PATCH 8/8] Update MultiInstanceLoopContext.spec.js --- tests/e2e/specs/MultiInstanceLoopContext.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/specs/MultiInstanceLoopContext.spec.js b/tests/e2e/specs/MultiInstanceLoopContext.spec.js index 18a1577ca..8c4a9fdf6 100644 --- a/tests/e2e/specs/MultiInstanceLoopContext.spec.js +++ b/tests/e2e/specs/MultiInstanceLoopContext.spec.js @@ -5,7 +5,7 @@ describe("FOUR-3375 FileUpload inside MultiInstance Task", () => { beforeEach(() => { cy.intercept( "GET", - "http://localhost:5173/api/1.0/tasks/1?include=data,user,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", + "http://localhost:5173/api/1.0/tasks/1?include=data,user,draft,requestor,processRequest,component,screen,requestData,loopContext,bpmnTagName,interstitial,definition,nested,userRequestPermission", { id: 1, advanceStatus: "open",