Commit 89a7c2c6 by Torkel Ödegaard

influxdb: validate database exist when saving data source, fixes #7864

parent 83e0f69c
......@@ -119,5 +119,3 @@ export function identityRenderer(part, innerExpr) {
export function quotedIdentityRenderer(part, innerExpr) {
return '"' + part.params[0] + '"';
}
......@@ -193,8 +193,17 @@ export default class InfluxDatasource {
}
testDatasource() {
return this.metricFindQuery('SHOW MEASUREMENTS LIMIT 1').then(() => {
return this.metricFindQuery('SHOW DATABASES').then(res => {
let found = _.find(res, {text: this.database});
if (!found) {
return { status: "error", message: "Could not find the specified database name.", title: "DB Not found" };
}
return { status: "success", message: "Data source is working", title: "Success" };
}).catch(err => {
if (err.data && err.message) {
return { status: "error", message: err.data.message, title: "InfluxDB Error" };
}
return { status: "error", message: err.toString(), title: "InfluxDB Error" };
});
}
......
......@@ -292,7 +292,6 @@ register({
renderer: functionRenderer,
});
debugger;
register({
type: 'holt_winters_with_fit',
addStrategy: addTransformationStrategy,
......
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