-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
None
-
2
-
Severity 3 - Minor
Issue Summary
This is reproducible on Data Center: (no)
Steps to Reproduce
- Create a template form for a project
- Click ... on the right and then click `Response (XLSX)`
Expected Results
It should show a flag with progress, and a flag with download link after it's ready.
Actual Results
After click the button:
- The API calls to prepare file is called
- The API calls to check download readiness returns completes
- There is neither progress flag nor download flag for user to download the file.
Workaround
Use F12 to open devtool and go to console, or use shortcut Ctrl Shift J (on Windows) or Cmd Option J (on Mac) to go to console.
Find <Project-Key>, <Form-Id> and use then paste and run following code.
```
function downloadFormResponseXLSX(key, id) {
fetch(`/rest/proforma/api/2/reports/all-form-responses/${key}/${id}`,
)
.then((res) => res.json())
.then(
(resJson) => new Promise((resolve) => { const taskId = resJson.id;
let resolved = false; const resolveOnce = () => { if (!resolved)
};
let interval = setInterval(() => {
fetch(
`/rest/proforma/api/2/reports/all-form-responses/${key}/${id}/${taskId}`
)
.then((res) => res.json())
.then((resJson) => { if (resJson.status.complete)
});
}, 300);
setTimeout(() => { if (interval)
}, 10000);
})
)
.then((taskId) =>
fetch(
`/rest/proforma/api/2/reports/all-form-responses/${key}/${id}/${taskId}/ProForma-${key}form${id}.xlsx`
)
.then((r) => r.blob())
.then((xlsxBlob) => { const downloadLink = window.document.createElement("a");
downloadLink.href = URL.createObjectURL(xlsxBlob);
downloadLink.setAttribute( "download",
`ProForma-${key}form${id}.xlsx`
);
window.document.body.appendChild(downloadLink);
downloadLink.click();
window.document.body.removeChild(downloadLink);
})
);
}
downloadFormResponseXLSX(<Project-Key>, <Form-Id>);