Commit c6bcf13d by Torkel Ödegaard Committed by GitHub

Devenv testdata dashboards (#12615)

* devenv: working on dev env setup & dashboards

* devenv: refactored testdata app to a built in datasource instead, and moved dashboards to a devenv provisioned dashboards
parent a13b4f2b
......@@ -14,6 +14,9 @@ datasources:
isDefault: true
url: http://localhost:9090
- name: gdev-testdata
type: testdata
- name: gdev-influxdb
type: influxdb
access: proxy
......
{
"revision": 2,
"title": "TestData - Alerts",
"title": "Alerting with TestData",
"tags": [
"grafana-test"
],
......@@ -48,7 +48,7 @@
},
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"datasource": "gdev-testdata",
"editable": true,
"error": false,
"fill": 1,
......@@ -161,7 +161,7 @@
},
"aliasColors": {},
"bars": false,
"datasource": "Grafana TestData",
"datasource": "gdev-testdata",
"editable": true,
"error": false,
"fill": 1,
......
#/bin/bash
#!/bin/bash
bulkDashboard() {
......@@ -22,31 +22,37 @@ requiresJsonnet() {
fi
}
defaultDashboards() {
devDashboards() {
echo -e "\xE2\x9C\x94 Setting up all dev dashboards using provisioning"
ln -s -f ../../../devenv/dashboards.yaml ../conf/provisioning/dashboards/dev.yaml
}
defaultDatasources() {
echo "setting up all default datasources using provisioning"
devDatasources() {
echo -e "\xE2\x9C\x94 Setting up all dev datasources using provisioning"
ln -s -f ../../../devenv/datasources.yaml ../conf/provisioning/datasources/dev.yaml
}
usage() {
echo -e "install.sh\n\tThis script setups dev provision for datasources and dashboards"
echo -e "\n"
echo "Usage:"
echo " bulk-dashboards - create and provisioning 400 dashboards"
echo " no args - provisiong core datasources and dev dashboards"
}
main() {
echo -e "------------------------------------------------------------------"
echo -e "This script setups provisioning for dev datasources and dashboards"
echo -e "------------------------------------------------------------------"
echo -e "\n"
local cmd=$1
if [[ $cmd == "bulk-dashboards" ]]; then
bulkDashboard
else
defaultDashboards
defaultDatasources
devDashboards
devDatasources
fi
if [[ -z "$cmd" ]]; then
......
......@@ -21,7 +21,7 @@ func NewTestDataExecutor(dsInfo *models.DataSource) (tsdb.TsdbQueryEndpoint, err
}
func init() {
tsdb.RegisterTsdbQueryEndpoint("grafana-testdata-datasource", NewTestDataExecutor)
tsdb.RegisterTsdbQueryEndpoint("testdata", NewTestDataExecutor)
}
func (e *TestDataExecutor) Query(ctx context.Context, dsInfo *models.DataSource, tsdbQuery *tsdb.TsdbQuery) (*tsdb.Response, error) {
......
......@@ -9,6 +9,7 @@ import * as mysqlPlugin from 'app/plugins/datasource/mysql/module';
import * as postgresPlugin from 'app/plugins/datasource/postgres/module';
import * as prometheusPlugin from 'app/plugins/datasource/prometheus/module';
import * as mssqlPlugin from 'app/plugins/datasource/mssql/module';
import * as testDataDSPlugin from 'app/plugins/datasource/testdata/module';
import * as textPanel from 'app/plugins/panel/text/module';
import * as graphPanel from 'app/plugins/panel/graph/module';
......@@ -20,9 +21,6 @@ import * as tablePanel from 'app/plugins/panel/table/module';
import * as singlestatPanel from 'app/plugins/panel/singlestat/module';
import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module';
import * as testDataAppPlugin from 'app/plugins/app/testdata/module';
import * as testDataDSPlugin from 'app/plugins/app/testdata/datasource/module';
const builtInPlugins = {
'app/plugins/datasource/graphite/module': graphitePlugin,
'app/plugins/datasource/cloudwatch/module': cloudwatchPlugin,
......@@ -35,8 +33,7 @@ const builtInPlugins = {
'app/plugins/datasource/postgres/module': postgresPlugin,
'app/plugins/datasource/mssql/module': mssqlPlugin,
'app/plugins/datasource/prometheus/module': prometheusPlugin,
'app/plugins/app/testdata/module': testDataAppPlugin,
'app/plugins/app/testdata/datasource/module': testDataDSPlugin,
'app/plugins/datasource/testdata/module': testDataDSPlugin,
'app/plugins/panel/text/module': textPanel,
'app/plugins/panel/graph/module': graphPanel,
......
export class ConfigCtrl {
static template = '';
appEditCtrl: any;
/** @ngInject **/
constructor(private backendSrv) {
this.appEditCtrl.setPreUpdateHook(this.initDatasource.bind(this));
}
initDatasource() {
return this.backendSrv.get('/api/datasources').then(res => {
var found = false;
for (let ds of res) {
if (ds.type === 'grafana-testdata-datasource') {
found = true;
}
}
if (!found) {
var dsInstance = {
name: 'Grafana TestData',
type: 'grafana-testdata-datasource',
access: 'direct',
jsonData: {},
};
return this.backendSrv.post('/api/datasources', dsInstance);
}
return Promise.resolve();
});
}
}
{
"type": "app",
"name": "Grafana TestData",
"id": "testdata",
"info": {
"description": "Grafana test data app",
"author": {
"name": "Grafana Project",
"url": "https://grafana.com"
},
"version": "1.0.17",
"updated": "2016-09-26"
},
"includes": [
{
"type": "dashboard",
"name": "TestData - Graph Last 1h",
"path": "dashboards/graph_last_1h.json"
},
{
"type": "dashboard",
"name": "TestData - Alerts",
"path": "dashboards/alerts.json"
}
],
"dependencies": {
"grafanaVersion": "4.x.x"
}
}
{
"type": "datasource",
"name": "Grafana TestDataDB",
"id": "grafana-testdata-datasource",
"name": "TestData DB",
"id": "testdata",
"metrics": true,
"alerting": true,
......@@ -13,8 +13,8 @@
"url": "https://grafana.com"
},
"logos": {
"small": "",
"large": ""
"small": "../../../../img/grafana_icon.svg",
"large": "../../../../img/grafana_icon.svg"
}
}
}
......@@ -56,10 +56,10 @@
<h5 class="section-heading">Coloring</h5>
<div class="gf-form-inline">
<gf-form-switch class="gf-form" label-class="width-8" label="Background" checked="ctrl.panel.colorBackground" on-change="ctrl.render()"></gf-form-switch>
<gf-form-switch class="gf-form" label-class="width-4" label="Value" checked="ctrl.panel.colorValue" on-change="ctrl.render()"></gf-form-switch>
<gf-form-switch class="gf-form" label-class="width-6" label="Value" checked="ctrl.panel.colorValue" on-change="ctrl.render()"></gf-form-switch>
</div>
<div class="gf-form-inline">
<gf-form-switch class="gf-form" label-class="width-6" label="Prefix" checked="ctrl.panel.colorPrefix" on-change="ctrl.render()" ng-disabled="!ctrl.canModifyText()"></gf-form-switch>
<gf-form-switch class="gf-form" label-class="width-8" label="Prefix" checked="ctrl.panel.colorPrefix" on-change="ctrl.render()" ng-disabled="!ctrl.canModifyText()"></gf-form-switch>
<gf-form-switch class="gf-form" label-class="width-6" label="Postfix" checked="ctrl.panel.colorPostfix" on-change="ctrl.render()" ng-disabled="!ctrl.canModifyText()"></gf-form-switch>
</div>
<div class="gf-form-inline">
......
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