Просмотр исходного кода

Merge remote-tracking branch 'upstream/master' into postgres-query-builder

Sven Klemm 7 лет назад
Родитель
Сommit
6b656094fc

+ 9 - 0
CHANGELOG.md

@@ -1,3 +1,12 @@
+# 5.1.0 (unreleased)
+
+* **Postgres/MySQL**: Ability to insert 0s or nulls for missing intervals [#9487](https://github.com/grafana/grafana/issues/9487), thanks [@svenklemm](https://github.com/svenklemm)
+
+
+# 5.0.1 (unreleased)
+
+* **Postgres**: PostgreSQL error when using ipv6 address as hostname in connection string [#11055](https://github.com/grafana/grafana/issues/11055), thanks [@svenklemm](https://github.com/svenklemm)
+
 # 5.0.0-stable (2018-03-01)
 
 ### Fixes

+ 1 - 0
docs/versions.json

@@ -1,4 +1,5 @@
 [
+  { "version": "v5.1", "path": "/v5.1", "archived": false },
   { "version": "v5.0", "path": "/", "archived": false, "current": true },
   { "version": "v4.6", "path": "/v4.6", "archived": true },
   { "version": "v4.5", "path": "/v4.5", "archived": true },

+ 2 - 1
pkg/tsdb/postgres/postgres.go

@@ -54,7 +54,8 @@ func generateConnectionString(datasource *models.DataSource) string {
 	}
 
 	sslmode := datasource.JsonData.Get("sslmode").MustString("verify-full")
-	return fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=%s", url.PathEscape(datasource.User), url.PathEscape(password), url.PathEscape(datasource.Url), url.PathEscape(datasource.Database), url.QueryEscape(sslmode))
+	u := &url.URL{Scheme: "postgres", User: url.UserPassword(datasource.User, password), Host: datasource.Url, Path: datasource.Database, RawQuery: "sslmode=" + sslmode}
+	return u.String()
 }
 
 func (e *PostgresQueryEndpoint) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {

+ 25 - 0
public/app/core/utils/kbn.ts

@@ -571,6 +571,17 @@ kbn.valueFormats.degree = kbn.formatBuilders.fixedUnit('°');
 kbn.valueFormats.radian = kbn.formatBuilders.fixedUnit('rad');
 kbn.valueFormats.grad = kbn.formatBuilders.fixedUnit('grad');
 
+// Radiation
+kbn.valueFormats.radbq = kbn.formatBuilders.decimalSIPrefix('Bq');
+kbn.valueFormats.radci = kbn.formatBuilders.decimalSIPrefix('Ci');
+kbn.valueFormats.radgy = kbn.formatBuilders.decimalSIPrefix('Gy');
+kbn.valueFormats.radrad = kbn.formatBuilders.decimalSIPrefix('rad');
+kbn.valueFormats.radsv = kbn.formatBuilders.decimalSIPrefix('Sv');
+kbn.valueFormats.radrem = kbn.formatBuilders.decimalSIPrefix('rem');
+kbn.valueFormats.radexpckg = kbn.formatBuilders.decimalSIPrefix('C/kg');
+kbn.valueFormats.radr = kbn.formatBuilders.decimalSIPrefix('R');
+kbn.valueFormats.radsvh = kbn.formatBuilders.decimalSIPrefix('Sv/h');
+
 // Time
 kbn.valueFormats.hertz = kbn.formatBuilders.decimalSIPrefix('Hz');
 
@@ -1036,6 +1047,20 @@ kbn.getUnitFormats = function() {
         { text: 'G unit', value: 'accG' },
       ],
     },
+    {
+      text: 'radiation',
+      submenu: [
+        { text: 'Becquerel (Bq)', value: 'radbq' },
+        { text: 'curie (Ci)', value: 'radci' },
+        { text: 'Gray (Gy)', value: 'radgy' },
+        { text: 'rad', value: 'radrad' },
+        { text: 'Sievert (Sv)', value: 'radsv' },
+        { text: 'rem', value: 'radrem' },
+        { text: 'Exposure (C/kg)', value: 'radexpckg' },
+        { text: 'roentgen (R)', value: 'radr' },
+        { text: 'Sievert/hour (Sv/h)', value: 'radsvh' },
+      ],
+    },
   ];
 };
 

+ 5 - 0
public/app/features/dashboard/specs/unsaved_changes_srv_specs.ts

@@ -66,6 +66,11 @@ describe('unsavedChangesSrv', function() {
     expect(tracker.hasChanges()).to.be(false);
   });
 
+  it('Should ignore .iteration changes', () => {
+    dash.iteration = new Date().getTime() + 1;
+    expect(tracker.hasChanges()).to.be(false);
+  });
+
   it.skip('Should ignore row collapse change', function() {
     dash.rows[0].collapse = true;
     expect(tracker.hasChanges()).to.be(false);

+ 3 - 0
public/app/features/dashboard/unsaved_changes_srv.ts

@@ -97,6 +97,9 @@ export class Tracker {
     dash.refresh = 0;
     dash.schemaVersion = 0;
 
+    // ignore iteration property
+    delete dash.iteration;
+
     // filter row and panels properties that should be ignored
     dash.rows = _.filter(dash.rows, function(row) {
       if (row.repeatRowId) {

+ 2 - 2
public/app/plugins/panel/heatmap/rendering.ts

@@ -649,13 +649,13 @@ export default function link(scope, elem, attrs, ctrl) {
       selection.x2 = limitSelection(event.offsetX);
       drawSelection(selection.x1, selection.x2);
     } else {
-      emitGraphHoverEvet(event);
+      emitGraphHoverEvent(event);
       drawCrosshair(event.offsetX);
       tooltip.show(event, data);
     }
   }
 
-  function emitGraphHoverEvet(event) {
+  function emitGraphHoverEvent(event) {
     let x = xScale.invert(event.offsetX - yAxisWidth).valueOf();
     let y = yScale.invert(event.offsetY);
     let pos = {