Commit 22e88856 by Torkel Ödegaard

feat(testdata): progress on test data stuff

parent 3ecd96e6
...@@ -6,6 +6,7 @@ type DataSourcePlugin struct { ...@@ -6,6 +6,7 @@ type DataSourcePlugin struct {
FrontendPluginBase FrontendPluginBase
Annotations bool `json:"annotations"` Annotations bool `json:"annotations"`
Metrics bool `json:"metrics"` Metrics bool `json:"metrics"`
Alerting bool `json:"alerting"`
BuiltIn bool `json:"builtIn"` BuiltIn bool `json:"builtIn"`
Mixed bool `json:"mixed"` Mixed bool `json:"mixed"`
App string `json:"app"` App string `json:"app"`
......
...@@ -227,8 +227,8 @@ export class AlertTabCtrl { ...@@ -227,8 +227,8 @@ export class AlertTabCtrl {
var datasourceName = foundTarget.datasource || this.panel.datasource; var datasourceName = foundTarget.datasource || this.panel.datasource;
this.datasourceSrv.get(datasourceName).then(ds => { this.datasourceSrv.get(datasourceName).then(ds => {
if (ds.meta.id !== 'graphite' && ds.meta.id !== 'prometheus') { if (!ds.meta.alerting) {
this.error = 'You datsource does not support alerting queries'; this.error = 'The datasource does not support alerting queries';
} else if (this.templateSrv.variableExists(foundTarget.target)) { } else if (this.templateSrv.variableExists(foundTarget.target)) {
this.error = 'Template variables are not supported in alert queries'; this.error = 'Template variables are not supported in alert queries';
} else { } else {
......
...@@ -30,6 +30,7 @@ export class DashboardModel { ...@@ -30,6 +30,7 @@ export class DashboardModel {
snapshot: any; snapshot: any;
schemaVersion: number; schemaVersion: number;
version: number; version: number;
revision: number;
links: any; links: any;
gnetId: any; gnetId: any;
meta: any; meta: any;
...@@ -42,6 +43,7 @@ export class DashboardModel { ...@@ -42,6 +43,7 @@ export class DashboardModel {
this.events = new Emitter(); this.events = new Emitter();
this.id = data.id || null; this.id = data.id || null;
this.revision = data.revision;
this.title = data.title || 'No Title'; this.title = data.title || 'No Title';
this.autoUpdate = data.autoUpdate; this.autoUpdate = data.autoUpdate;
this.description = data.description; this.description = data.description;
......
{ {
"revision": 2,
"title": "TestData - Graph Panel Last 1h", "title": "TestData - Graph Panel Last 1h",
"tags": ["testdata"], "tags": [
"revision": 1 "grafana-test"
],
"style": "dark",
"timezone": "browser",
"editable": true,
"hideControls": false,
"sharedCrosshair": false,
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 1,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "A",
"scenario": "random_walk",
"target": "",
"scenarioId": "no_data_points"
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "No Data Points Warning",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"links": []
},
{
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 2,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 4,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "A",
"scenario": "random_walk",
"target": "",
"scenarioId": "datapoints_outside_range"
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Datapoints Outside Range Warning",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"links": []
}
],
"title": "New row"
},
{
"title": "New row",
"height": "250px",
"editable": true,
"collapse": false,
"panels": [
{
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"editable": true,
"error": false,
"fill": 1,
"id": 3,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"span": 8,
"stack": false,
"steppedLine": false,
"targets": [
{
"refId": "A",
"scenario": "random_walk",
"target": "",
"scenarioId": "random_walk"
}
],
"thresholds": [],
"timeFrom": null,
"timeShift": null,
"title": "Random walk series",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"links": []
}
]
}
],
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"templating": {
"list": []
},
"annotations": {
"list": []
},
"schemaVersion": 13,
"version": 4,
"links": [],
"gnetId": null
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"id": "grafana-testdata-datasource", "id": "grafana-testdata-datasource",
"metrics": true, "metrics": true,
"alerting": true,
"annotations": true, "annotations": true,
"info": { "info": {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
], ],
"metrics": true, "metrics": true,
"alerting": true,
"annotations": true, "annotations": true,
"info": { "info": {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
], ],
"metrics": true, "metrics": true,
"alerting": true,
"annotations": true, "annotations": true,
"info": { "info": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment