From dd25cd1f60b0b33726b1fde0db5aa82019536564 Mon Sep 17 00:00:00 2001 From: rozetko Date: Fri, 30 Dec 2022 14:29:06 +0300 Subject: [PATCH] hotfix --- src/routes/tasks.ts | 2 +- src/services/exporter.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/routes/tasks.ts b/src/routes/tasks.ts index 9c5f646..37ba9ca 100644 --- a/src/routes/tasks.ts +++ b/src/routes/tasks.ts @@ -75,7 +75,6 @@ async function addTask(req: TRequest, res) { res.status(400).send('Range error: "from" should be less than "to"'); } else { const names = tasks.map(item => item.datasource.name).join(', '); - res.status(200).send(`Exporting ${names} data from ${new Date(from).toLocaleString()} to ${new Date(to).toLocaleString()}`); const targets = tasks.map((task: Task) => new Target( task.panel, @@ -83,6 +82,7 @@ async function addTask(req: TRequest, res) { )); const exporter = exporterFactory.getExporter(); exporter.export(targets, datasourceUrl, username, from, to); + res.status(200).send(`Exporting ${names} data from ${new Date(from).toLocaleString()} to ${new Date(to).toLocaleString()}`); } } diff --git a/src/services/exporter.ts b/src/services/exporter.ts index e7899b2..1bda0d6 100644 --- a/src/services/exporter.ts +++ b/src/services/exporter.ts @@ -84,6 +84,8 @@ export class Exporter { this.datasourceRef = data.length === 1 ? data[0].datasource : { uid: 'all', type: 'all' }; + await this.updateStatus(ExportStatus.EXPORTING, 0); + const stream = this.initCsvStream(); const days = Math.ceil((to - from) / MS_IN_DAY);