Module: check_mk
Branch: master
Commit: d579c2b76ed0c60c456e9c8aee0df8fd3ad64ad0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d579c2b76ed0c6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 6 18:23:43 2014 +0200
Small code cleanup: extract datasource selection to own VS
---
web/htdocs/views.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 88c454a..34b6d4c 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -204,20 +204,27 @@ def page_edit_views():
# '----------------------------------------------------------------------'
# First step: Select the data source
-def page_create_view(next_url = None):
+
+# Create datasource selection valuespec, also for other modules
+def DatasourceSelection():
datasources = []
for ds_name, ds in multisite_datasources.items():
datasources.append((ds_name, ds['title']))
- # FIXME: Sort the datasources by (assumed) common usage
- vs_ds = DropdownChoice(
+ return DropdownChoice(
title = _('Datasource'),
+ help = _('The datasources defines which type of objects should be displayed
with this view.'),
choices = datasources,
sorted = True,
- help = _('The datasources defines which type of objects should be displayed
with this view.'),
columns = 1,
+ default_value = 'services',
)
+def page_create_view(next_url = None):
+
+ # FIXME: Sort the datasources by (assumed) common usage
+ vs_ds = DatasourceSelection()
+
ds = 'services' # Default selection
html.header(_('Create View'), stylesheets=["pages"])