|
|
@ -129,15 +129,15 @@ export class Exporter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private _validateQueries(queries: DashboardQuery[]) { |
|
|
|
private _validateQueries(queries: DashboardQuery[]) { |
|
|
|
if(!queries || !Array.isArray(queries)) { |
|
|
|
if(!_.isArray(queries)) { |
|
|
|
throw new Error('`queries` field is required and should be an array'); |
|
|
|
throw new Error('`queries` field is required and should be an array'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(const query of queries) { |
|
|
|
for(const query of queries) { |
|
|
|
if(!_.isEmpty(query.datasource)) { |
|
|
|
if(_.isEmpty(query.datasource)) { |
|
|
|
throw new Error('all queries should have a `datasource` field'); |
|
|
|
throw new Error('all queries should have a `datasource` field'); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!_.isEmpty(query.panel.targets)) { |
|
|
|
if(_.isEmpty(query.panel.targets)) { |
|
|
|
throw new Error('all queries should have a `panel` field with non-empty `targets` field'); |
|
|
|
throw new Error('all queries should have a `panel` field with non-empty `targets` field'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|