From d9f6adc6e4f0b20cdc03ecc87f6e954f66e2a2ec Mon Sep 17 00:00:00 2001 From: rozetko Date: Fri, 21 Sep 2018 16:35:14 +0300 Subject: [PATCH] Change exported filenames #8 --- src/target.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/target.ts b/src/target.ts index 46d4c58..b8628c8 100644 --- a/src/target.ts +++ b/src/target.ts @@ -23,7 +23,8 @@ export class Target { datasource: Datasource, targets: Array, private from: number, - private to: number + private to: number, + private datasourceName: string, ) { this.metric = new Metric(datasource, targets); } @@ -35,7 +36,8 @@ export class Target { user: this.user, exportedRows: this.exportedRows, progress: (this.day / this.days).toLocaleString('en', { style: 'percent' }), - status + status, + datasourceName: this.datasourceName }; return new Promise((resolve, reject) => { fs.writeFile(this.getFilePath('json'), JSON.stringify(data), 'utf8', err => { @@ -105,9 +107,7 @@ export class Target { } private getFilename(extension) { - // TODO: use something unique instead of measurement in filename - // as measurement field exists only in influxDB metric - return `${this.metric.targets[0].measurement}.${this.from}-${this.to}.${extension}`; + return `${this.datasourceName}.${this.from}-${this.to}.${extension}`; } private getFilePath(extension) {