Commit b37444f3 by Torkel Ödegaard Committed by GitHub

InputDataSource: Fixed issue with config editor (#19818)

parent 945b815f
......@@ -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++) {
......
......@@ -141,6 +141,10 @@ export class DashboardImportCtrl {
this.autoGenerateUidValue = 'value set';
}
if (!this.dash.uid) {
return;
}
this.backendSrv
// @ts-ignore
.getDashboardByUid(this.dash.uid)
......
......@@ -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)));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment