change timescaledb to checkbox instead of select

This commit is contained in:
Sven Klemm
2018-08-09 09:19:16 +02:00
parent b987aee7cf
commit c3aad10047
4 changed files with 4 additions and 28 deletions

View File

@ -123,27 +123,9 @@ export class PostgresDatasource {
.then(data => this.responseParser.parseMetricFindQueryResult(refId, data));
}
testDatasource(control) {
testDatasource() {
return this.metricFindQuery('SELECT 1', {})
.then(res => {
if (control.current.jsonData.timescaledb === 'auto') {
return this.metricFindQuery("SELECT 1 FROM pg_extension WHERE extname='timescaledb'", {})
.then(res => {
if (res.length === 1) {
control.current.jsonData.timescaledb = 'enabled';
return this.backendSrv.put('/api/datasources/' + this.id, control.current).then(settings => {
control.current = settings.datasource;
control.updateFrontendSettings();
return { status: 'success', message: 'Database Connection OK, TimescaleDB found' };
});
}
throw new Error('timescaledb not found');
})
.catch(err => {
// query errored out or empty so timescaledb is not available
return { status: 'success', message: 'Database Connection OK' };
});
}
return { status: 'success', message: 'Database Connection OK' };
})
.catch(err => {