Add a slug to better track dashboards

Currently grafana will generate a slug based on the title name. For
now, we can use an existing python library to do this.  Ideally, we'll
need to make sure the slugs generated between both are kept in sync.

How hard can that be?

Also move our validation logic into parser.py, since they are closely
related.

Change-Id: Id43f51d3f9db9131c25a8130f957572344a7d8f1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger
2015-09-21 16:41:21 -04:00
parent aa97ba048d
commit 42ef61dde0
17 changed files with 310 additions and 175 deletions

View File

@@ -1,6 +1,8 @@
{
"dashboard": {
"rows": [],
"title": "New dashboard"
"new-dashboard": {
"rows": [],
"title": "New dashboard"
}
}
}

View File

@@ -1,15 +1,17 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
}
}
}

View File

@@ -1,27 +1,29 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"editable": true,
"error": false,
"limit": 10,
"mode": "starred",
"query": "",
"span": 12,
"tag": "",
"title": "Starred Dashboards",
"type": "dashlist"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"editable": true,
"error": false,
"limit": 10,
"mode": "starred",
"query": "",
"span": 12,
"tag": "",
"title": "Starred Dashboards",
"type": "dashlist"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
}
}
}

View File

@@ -1,25 +1,27 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"content": "Some example text is required.",
"editable": true,
"error": false,
"mode": "markdown",
"span": 12,
"title": "no title (click here)",
"type": "text"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"content": "Some example text is required.",
"editable": true,
"error": false,
"mode": "markdown",
"span": 12,
"title": "no title (click here)",
"type": "text"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
}
}
}

View File

@@ -1,35 +1,37 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"bars": false,
"editable": true,
"error": false,
"fill": 1,
"lines": true,
"linewidth": 2,
"percentage": false,
"pointradius": 5,
"points": false,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [],
"title": "no title (click here)",
"type": "graph",
"x-axis": true,
"y-axis": true
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"bars": false,
"editable": true,
"error": false,
"fill": 1,
"lines": true,
"linewidth": 2,
"percentage": false,
"pointradius": 5,
"points": false,
"span": 12,
"stack": false,
"steppedLine": false,
"targets": [],
"title": "no title (click here)",
"type": "graph",
"x-axis": true,
"y-axis": true
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
}
}
}

View File

@@ -1,35 +1,37 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"colorBackground": false,
"colorValue": false,
"editable": true,
"error": false,
"maxDataPoints": 100,
"span": 12,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [],
"thresholds": "",
"title": "no title (click here)",
"type": "singlestat",
"valueName": "avg"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"colorBackground": false,
"colorValue": false,
"editable": true,
"error": false,
"maxDataPoints": 100,
"span": 12,
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": false
},
"targets": [],
"thresholds": "",
"title": "no title (click here)",
"type": "singlestat",
"valueName": "avg"
}
],
"showTitle": false,
"title": "New row"
}
],
"title": "New dashboard"
}
}
}

View File

@@ -1,45 +1,47 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"editable": true,
"error": false,
"limit": 10,
"mode": "starred",
"query": "",
"span": 12,
"tag": "",
"title": "Starred Dashboards",
"type": "dashlist"
}
],
"showTitle": false,
"title": "foo"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"content": "Some example text is required.",
"editable": true,
"error": false,
"mode": "markdown",
"span": 12,
"title": "no title (click here)",
"type": "text"
}
],
"showTitle": false,
"title": "bar"
}
],
"title": "New dashboard"
"new-dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"editable": true,
"error": false,
"limit": 10,
"mode": "starred",
"query": "",
"span": 12,
"tag": "",
"title": "Starred Dashboards",
"type": "dashlist"
}
],
"showTitle": false,
"title": "foo"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"content": "Some example text is required.",
"editable": true,
"error": false,
"mode": "markdown",
"span": 12,
"title": "no title (click here)",
"type": "text"
}
],
"showTitle": false,
"title": "bar"
}
],
"title": "New dashboard"
}
}
}