influxdb: validate database exist when saving data source, fixes #7864
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user