MCPcopy Index your code
hub / github.com/apache/caldera / downloadReport

Function downloadReport

static/js/shared.js:232–246  ·  view source on GitHub ↗
(endpoint, filename, data = {}, jsonifyData = false)

Source from the content-addressed store, hash-verified

230}
231
232function downloadReport(endpoint, filename, data = {}, jsonifyData = false) {
233 function downloadObjectAsJson(data) {
234 stream('Downloading report: ' + filename);
235 const parsedData = jsonifyData ? JSON.stringify(data, null, 2) : data;
236 let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(parsedData);
237 let downloadAnchorNode = document.createElement('a');
238 downloadAnchorNode.setAttribute("href", dataStr);
239 downloadAnchorNode.setAttribute("download", filename + ".json");
240 document.body.appendChild(downloadAnchorNode);
241 downloadAnchorNode.click();
242 downloadAnchorNode.remove();
243 }
244
245 restRequest('POST', data, downloadObjectAsJson, endpoint);
246}
247
248function sleep(ms) {
249 return new Promise((resolve) => setTimeout(resolve, ms));

Callers

nothing calls this directly

Calls 1

restRequestFunction · 0.85

Tested by

no test coverage detected