Kaynağa Gözat

Merge branch 'master' of github.com:grafana/grafana

Torkel Ödegaard 8 yıl önce
ebeveyn
işleme
3ed1600b90

+ 1 - 0
CHANGELOG.md

@@ -15,6 +15,7 @@
 * **Cloudwatch**: Correctly obtain IAM roles within ECS container tasks [#7892](https://github.com/grafana/grafana/issues/7892) thx [@gomlgs](https://github.com/gomlgs)
 * **Units**: New number format: Scientific notation [#7781](https://github.com/grafana/grafana/issues/7781) thx [@cadnce](https://github.com/cadnce)
 * **Oauth**: Add common type for oauth authorization errors [#6428](https://github.com/grafana/grafana/issues/6428) thx [@amenzhinsky](https://github.com/amenzhinsky)
+* **Templating**: Data source variable now supports multi value and panel repeats [#7030](https://github.com/grafana/grafana/issues/7030) thx [@mtanda](https://github.com/mtanda)
 
 # 4.2.0 (2017-03-22)
 ## Minor Enhancements

+ 3 - 3
conf/defaults.ini

@@ -60,14 +60,14 @@ cert_key =
 #################################### Database ############################
 [database]
 # You can configure the database connection by specifying type, host, name, user and password
-# as seperate properties or as on string using the url propertie.
+# as separate properties or as on string using the url property.
 
 # Either "mysql", "postgres" or "sqlite3", it's your choice
 type = sqlite3
 host = 127.0.0.1:3306
 name = grafana
 user = root
-# If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;"""
+# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
 password =
 # Use either URL or the previous fields to configure the database
 # Example: mysql://user:secret@host:port/database
@@ -132,7 +132,7 @@ logging = false
 reporting_enabled = true
 
 # Set to false to disable all checks to https://grafana.com
-# for new vesions (grafana itself and plugins), check is used
+# for new versions (grafana itself and plugins), check is used
 # in some UI views to notify that grafana or plugin update exists
 # This option does not cause any auto updates, nor send any information
 # only a GET request to https://grafana.com to get latest versions

+ 1 - 1
docs/sources/http_api/dashboard.md

@@ -232,7 +232,7 @@ Get all tags of dashboards
 Status Codes:
 
 - **query** – Search Query
-- **tags** – Tags to use
+- **tag** – Tag to use
 - **starred** – Flag indicating if only starred Dashboards should be returned
 - **tagcloud** - Flag indicating if a tagcloud should be returned
 

+ 2 - 2
public/app/core/services/datasource_srv.js

@@ -14,12 +14,12 @@ function (angular, _, coreModule, config) {
       this.datasources = {};
     };
 
-    this.get = function(name) {
+    this.get = function(name, scopedDsVars) {
       if (!name) {
         return this.get(config.defaultDatasource);
       }
 
-      name = templateSrv.replace(name);
+      name = templateSrv.replace(name, scopedDsVars || {});
 
       if (name === 'default') {
         return this.get(config.defaultDatasource);

+ 1 - 1
public/app/features/panel/metrics_panel_ctrl.ts

@@ -92,7 +92,7 @@ class MetricsPanelCtrl extends PanelCtrl {
 
     // load datasource service
     this.setTimeQueryStart();
-    this.datasourceSrv.get(this.panel.datasource)
+    this.datasourceSrv.get(this.panel.datasource, this.panel.scopedVars)
     .then(this.updateTimeRange.bind(this))
     .then(this.issueQueries.bind(this))
     .then(this.handleQueryResult.bind(this))

+ 15 - 0
public/app/features/templating/datasource_variable.ts

@@ -10,6 +10,8 @@ export class DatasourceVariable implements Variable {
   query: string;
   options: any;
   current: any;
+  multi: boolean;
+  includeAll: boolean;
   refresh: any;
 
  defaults = {
@@ -21,6 +23,8 @@ export class DatasourceVariable implements Variable {
     regex: '',
     options: [],
     query: '',
+    multi: false,
+    includeAll: false,
     refresh: 1,
   };
 
@@ -71,9 +75,16 @@ export class DatasourceVariable implements Variable {
     }
 
     this.options = options;
+    if (this.includeAll) {
+      this.addAllOption();
+    }
     return this.variableSrv.validateVariableSelectionState(this);
   }
 
+  addAllOption() {
+    this.options.unshift({text: 'All', value: "$__all"});
+  }
+
   dependsOn(variable) {
     if (this.regex) {
       return containsVariable(this.regex, variable.name);
@@ -86,6 +97,9 @@ export class DatasourceVariable implements Variable {
   }
 
   getValueForUrl() {
+    if (this.current.text === 'All') {
+      return 'All';
+    }
     return this.current.value;
   }
 }
@@ -93,5 +107,6 @@ export class DatasourceVariable implements Variable {
 variableTypes['datasource'] = {
   name: 'Datasource',
   ctor: DatasourceVariable,
+  supportsMulti: true,
   description: 'Enabled you to dynamically switch the datasource for multiple panels',
 };