|
|
|
@ -154,7 +154,7 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO |
|
|
|
|
|
|
|
|
|
private checkForDatabaseIssue(request: DataQueryRequest<SQLQuery>) { |
|
|
|
|
// If the datasource is Postgres and there is no default database configured - either never configured or removed - return a database issue.
|
|
|
|
|
if (this.type === 'postgres' && !this.preconfiguredDatabase) { |
|
|
|
|
if (this.type === 'grafana-postgresql-datasource' && !this.preconfiguredDatabase) { |
|
|
|
|
return `You do not currently have a default database configured for this data source. Postgres requires a default
|
|
|
|
|
database with which to connect. Please configure one through the Data Sources Configuration page, or if you |
|
|
|
|
are using a provisioning file, update that configuration file with a default database.`;
|
|
|
|
@ -170,7 +170,11 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO |
|
|
|
|
if (!!this.preconfiguredDatabase) { |
|
|
|
|
for (const target of request.targets) { |
|
|
|
|
// Test for database configuration change only if query was made in `builder` mode.
|
|
|
|
|
if (target.editorMode === EditorMode.Builder && target.dataset !== this.preconfiguredDatabase) { |
|
|
|
|
if ( |
|
|
|
|
target.editorMode === EditorMode.Builder && |
|
|
|
|
target.dataset && |
|
|
|
|
target.dataset !== this.preconfiguredDatabase |
|
|
|
|
) { |
|
|
|
|
return `The configuration for this panel's data source has been modified. The previous database used in this panel's
|
|
|
|
|
saved query is no longer available. Please update the query to use the new database option. |
|
|
|
|
Previous query parameters will be preserved until the query is updated.`;
|
|
|
|
|