|
|
@ -21,6 +21,10 @@ type TRequest = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
async function getTasks(req, res) { |
|
|
|
async function getTasks(req, res) { |
|
|
|
|
|
|
|
const query = req.query; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const dashboardUid = query.dashboardUid; |
|
|
|
|
|
|
|
|
|
|
|
const resp: ExportTask[] = []; |
|
|
|
const resp: ExportTask[] = []; |
|
|
|
fs.readdir(CSV_PATH, (err, items) => { |
|
|
|
fs.readdir(CSV_PATH, (err, items) => { |
|
|
|
if(err) { |
|
|
|
if(err) { |
|
|
@ -35,8 +39,10 @@ async function getTasks(req, res) { |
|
|
|
// TODO: read async
|
|
|
|
// TODO: read async
|
|
|
|
let data = fs.readFileSync(path.join(CSV_PATH, item), 'utf8'); |
|
|
|
let data = fs.readFileSync(path.join(CSV_PATH, item), 'utf8'); |
|
|
|
try { |
|
|
|
try { |
|
|
|
let status = JSON.parse(data); |
|
|
|
let status: ExportTask = JSON.parse(data); |
|
|
|
|
|
|
|
if(dashboardUid && status.dashboardUid === dashboardUid) { |
|
|
|
resp.push(status); |
|
|
|
resp.push(status); |
|
|
|
|
|
|
|
} |
|
|
|
} catch(e) { |
|
|
|
} catch(e) { |
|
|
|
console.log(`Cannot read file /exporter/${item}. if this error doesn't repeat, maybe the file is being updated at the moment`); |
|
|
|
console.log(`Cannot read file /exporter/${item}. if this error doesn't repeat, maybe the file is being updated at the moment`); |
|
|
|
} |
|
|
|
} |
|
|
|