Default dashboard timezone to UTC

We also allow the user to override the setting to browser as well.

Change-Id: Id7ebdc3140d8fc50d0e70876fa2341a102821e1f
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-11-12 13:53:26 -05:00
parent 1616bd8954
commit 5c620dcbc6
11 changed files with 35 additions and 3 deletions

View File

@ -21,6 +21,7 @@ class Dashboard(object):
def get_schema(self):
dashboard = {
v.Required('timezone', default='utc'): v.Any('browser', 'utc'),
v.Required('title'): v.All(str, v.Length(min=1)),
v.Optional('id'): int,
}

View File

@ -2,6 +2,7 @@
"dashboard": {
"new-dashboard": {
"rows": [],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -11,6 +11,7 @@
"title": "New row"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -23,6 +23,7 @@
"title": "New row"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -21,6 +21,7 @@
"title": "New row"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -31,6 +31,7 @@
"title": "New row"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -31,6 +31,7 @@
"title": "New row"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -41,6 +41,7 @@
"title": "bar"
}
],
"timezone": "utc",
"title": "New dashboard"
}
}

View File

@ -0,0 +1,9 @@
{
"dashboard": {
"new-dashboard": {
"rows": [],
"timezone": "browser",
"title": "New dashboard"
}
}
}

View File

@ -0,0 +1,3 @@
dashboard:
timezone: browser
title: New dashboard

View File

@ -33,8 +33,16 @@ class TestCaseParser(TestCase):
os.path.dirname(__file__), 'fixtures/parser/dashboard-0001.yaml')
self.parser.parse(path)
dashboard = {
'foobar': {'rows': [], 'title': 'foobar'},
'new-dashboard': {'rows': [], 'title': 'New dashboard'},
'foobar': {
'rows': [],
'timezone': 'utc',
'title': 'foobar',
},
'new-dashboard': {
'rows': [],
'timezone': 'utc',
'title': 'New dashboard',
},
}
# Get parsed dashboard
@ -61,7 +69,11 @@ class TestCaseParser(TestCase):
os.path.dirname(__file__), 'fixtures/parser/dashboard-0001.yaml')
self.parser.parse(path)
dashboard = {
'new-dashboard': {'rows': [], 'title': 'New dashboard'},
'new-dashboard': {
'rows': [],
'timezone': 'utc',
'title': 'New dashboard',
},
}
# Get parsed dashboard