Add support to change the default time filter range

Default is 6h it seems.  This change allows adjusting the default
to/from range in the time filter.

Change-Id: I567b9cc5cd8c753f852066c9e6868dd0f1b30b60
This commit is contained in:
akrzos 2018-01-02 16:02:35 -05:00
parent 2cee4f2908
commit a53ce0ed3b
5 changed files with 68 additions and 0 deletions

View File

@ -25,6 +25,10 @@ class Dashboard(object):
v.Required('timezone', default='utc'): v.Any('browser', 'utc'),
v.Required('title'): v.All(str, v.Length(min=1)),
v.Optional('id'): int,
v.Optional('time'): {
v.Required('from'): v.Any(v.Datetime(), str),
v.Required('to'): v.Any(v.Datetime(), str),
},
}
rows = Row().get_schema()
dashboard.update(rows.schema)

View File

@ -50,6 +50,10 @@
}
]
},
"time": {
"from": "2018-02-07T08:42:27.000Z",
"to": "2018-02-07T13:48:32.000Z"
},
"timezone": "utc",
"title": "New dashboard"
}

View File

@ -1,4 +1,7 @@
dashboard:
time:
from: "2018-02-07T08:42:27.000Z"
to: "2018-02-07T13:48:32.000Z"
templating:
- name: hostname
type: query

View File

@ -0,0 +1,46 @@
{
"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"
}
],
"templating": {
"enabled": false,
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timezone": "utc",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,11 @@
dashboard:
title: New dashboard
time:
from: now-1h
to: now
rows:
- title: New row
height: 250px
panels:
- title: no title (click here)
type: graph