|
|
|
@ -28,6 +28,7 @@ export class Exporter {
|
|
|
|
|
private _task: ExportTask; |
|
|
|
|
|
|
|
|
|
public async export(task: ExportTask, datasourceUrl: string) { |
|
|
|
|
try { |
|
|
|
|
this._task = _.cloneDeep(task); |
|
|
|
|
this._task.id = uuidv4(); |
|
|
|
|
this._task.progress = _.cloneDeep(DEFAULT_PROGRESS); |
|
|
|
@ -60,7 +61,6 @@ export class Exporter {
|
|
|
|
|
console.log(`Total days: ${days}`); |
|
|
|
|
|
|
|
|
|
const stream = this._initCsvStream(); |
|
|
|
|
try { |
|
|
|
|
for(let day = 0; day < days; day++) { |
|
|
|
|
to = from + MS_IN_DAY; |
|
|
|
|
|
|
|
|
@ -86,10 +86,10 @@ export class Exporter {
|
|
|
|
|
|
|
|
|
|
from += MS_IN_DAY; |
|
|
|
|
} |
|
|
|
|
stream.end(); |
|
|
|
|
} catch (e) { |
|
|
|
|
await this._updateProgress({ status: ExportStatus.ERROR, errorMessage: e.message }); |
|
|
|
|
} |
|
|
|
|
stream.end(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private _initCsvStream() { |
|
|
|
|