diff --git a/src/components/task.vue b/src/components/task.vue index 5a50ec6f9..e75c807c1 100644 --- a/src/components/task.vue +++ b/src/components/task.vue @@ -115,7 +115,7 @@ export default { hasErrors: false, refreshScreen: 0, redirecting: null, - loadingButton: false + loadingButton: false, }; }, watch: { @@ -223,7 +223,7 @@ export default { } this.renderComponent = component; } - }, + } }, }, computed: { @@ -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,15 @@ export default { this.resetScreenState(); this.requestData = _.get(this.task, 'request_data', {}); this.loopContext = _.get(this.task, "loop_context", ""); + + if (this.task.draft) { + this.requestData = _.merge( + {}, + this.requestData, + this.task.draft.data + ); + } + this.refreshScreen++; } 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", 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 );