Browse Source

hotfix

pull/3/head
rozetko 1 year ago
parent
commit
dd25cd1f60
  1. 2
      src/routes/tasks.ts
  2. 2
      src/services/exporter.ts

2
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()}`);
}
}

2
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);

Loading…
Cancel
Save