InputDataSource: Fixed issue with config editor (#19818)

This commit is contained in:
Torkel Ödegaard
2019-10-16 12:58:49 +02:00
committed by GitHub
parent 945b815fe0
commit b37444f3ea
3 changed files with 13 additions and 1 deletions

View File

@@ -271,6 +271,12 @@ export function toCSV(data: DataFrame[], config?: CSVConfig): string {
for (const series of data) {
const { fields } = series;
// ignore frames with no fields
if (fields.length === 0) {
continue;
}
if (config.headerStyle === CSVHeaderStyle.full) {
csv =
csv +
@@ -287,7 +293,9 @@ export function toCSV(data: DataFrame[], config?: CSVConfig): string {
}
csv += config.newline;
}
const length = fields[0].values.length;
if (length > 0) {
const writers = fields.map(field => makeFieldWriter(field, config!));
for (let i = 0; i < length; i++) {

View File

@@ -141,6 +141,10 @@ export class DashboardImportCtrl {
this.autoGenerateUidValue = 'value set';
}
if (!this.dash.uid) {
return;
}
this.backendSrv
// @ts-ignore
.getDashboardByUid(this.dash.uid)

View File

@@ -4,5 +4,5 @@ export function dataFrameToCSV(dto?: DataFrameDTO[]) {
if (!dto || !dto.length) {
return '';
}
return toCSV(dto.map(v => toDataFrame(dto)));
return toCSV(dto.map(v => toDataFrame(v)));
}