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

[SPRING] feature/FOUR-14257 autosave #1563

Merged
merged 10 commits into from
Mar 15, 2024
15 changes: 12 additions & 3 deletions src/components/task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default {
hasErrors: false,
refreshScreen: 0,
redirecting: null,
loadingButton: false
loadingButton: false,
};
},
watch: {
Expand Down Expand Up @@ -223,7 +223,7 @@ export default {
}
this.renderComponent = component;
}
},
}
},
},
computed: {
Expand Down Expand Up @@ -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}`;
Expand Down Expand Up @@ -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++;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/MultiInstanceLoopContext.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
42 changes: 21 additions & 21 deletions tests/e2e/specs/Task.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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();
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
);

Expand All @@ -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
);

Expand All @@ -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",
Expand Down Expand Up @@ -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
);

Expand All @@ -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
);

Expand All @@ -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",
Expand Down Expand Up @@ -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
);

Expand All @@ -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
);

Expand All @@ -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",
Expand Down Expand Up @@ -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
);

Expand All @@ -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",
Expand Down Expand Up @@ -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
);

Expand All @@ -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",
Expand Down Expand Up @@ -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
);

Expand Down
Loading