|
|
|
@ -21,7 +21,7 @@ const TIMESTAMP_COLUMN = 'timestamp';
|
|
|
|
|
export class Exporter { |
|
|
|
|
private exportedRows = 0; |
|
|
|
|
private createdTimestamp: number; |
|
|
|
|
private user: string; |
|
|
|
|
private username: string; |
|
|
|
|
private datasourceRef: DataSourceRef; |
|
|
|
|
|
|
|
|
|
private initCsvStream() { |
|
|
|
@ -44,9 +44,9 @@ export class Exporter {
|
|
|
|
|
let time = moment().valueOf(); |
|
|
|
|
let data = { |
|
|
|
|
time, |
|
|
|
|
user: this.user, |
|
|
|
|
username: this.username, |
|
|
|
|
exportedRows: this.exportedRows, |
|
|
|
|
progress: progress.toLocaleString('en', { style: 'percent' }), |
|
|
|
|
progress: progress, |
|
|
|
|
status, |
|
|
|
|
datasourceRef: this.datasourceRef, |
|
|
|
|
}; |
|
|
|
@ -58,8 +58,8 @@ export class Exporter {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async export(data: Target[], datasourceUrl: string, user: string, from: number, to: number) { |
|
|
|
|
this.user = user; |
|
|
|
|
public async export(data: Target[], datasourceUrl: string, username: string, from: number, to: number) { |
|
|
|
|
this.username = username; |
|
|
|
|
|
|
|
|
|
this.validateTargets(datasourceUrl, data); |
|
|
|
|
|
|
|
|
@ -82,7 +82,8 @@ export class Exporter {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.datasourceRef = data.length === 1 ? data[0].datasource : { uid: 'all', type: 'all' }; |
|
|
|
|
const datasource = data[0].datasource; |
|
|
|
|
this.datasourceRef = data.length === 1 ? { uid: datasource.uid, type: datasource.type } : { uid: 'all', type: 'all' }; |
|
|
|
|
|
|
|
|
|
await this.updateStatus(ExportStatus.EXPORTING, 0); |
|
|
|
|
|
|
|
|
|