Bladeren bron

add postgres version to datasource config

Sven Klemm 7 jaren geleden
bovenliggende
commit
9d022766ee

+ 8 - 0
public/app/plugins/datasource/postgres/module.ts

@@ -10,6 +10,14 @@ class PostgresConfigCtrl {
   constructor($scope) {
     this.current.jsonData.sslmode = this.current.jsonData.sslmode || 'verify-full';
   }
+
+  // the value portion is derived from postgres server_version_num/100
+  postgresVersions = [
+    { name: '9.3.x', value: 903 },
+    { name: '9.4.x', value: 904 },
+    { name: '9.5.x', value: 905 },
+    { name: '9.6.x', value: 906 },
+  ];
 }
 
 const defaultQuery = `SELECT

+ 11 - 0
public/app/plugins/datasource/postgres/partials/config.html

@@ -41,6 +41,17 @@
 <h3 class="page-heading">PostgreSQL details</h3>
 
 <div class="gf-form-group">
+	<div class="gf-form">
+		<span class="gf-form-label width-9">
+			Version
+			<info-popover mode="right-normal" position="top center">
+				This option controls what functions are available in the PostgreSQL query builder.
+			</info-popover>
+		</span>
+		<span class="gf-form-select-wrapper">
+			<select class="gf-form-input gf-size-auto" ng-model="ctrl.current.jsonData.postgresVersion" ng-options="f.value as f.name for f in ctrl.postgresVersions"></select>
+		</span>
+	</div>
 	<div class="gf-form">
 		<gf-form-switch class="gf-form" label="TimescaleDB" tooltip="Use TimescaleDB features (e.g., time_bucket) in Grafana" label-class="width-9" checked="ctrl.current.jsonData.timescaledb" switch-class="max-width-6"></gf-form-switch>
 	</div>