Module: check_mk
Branch: master
Commit: bd23966d62fa9242f55ab60340a26db2c5eecb35
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd23966d62fa92…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 7 09:02:47 2014 +0200
Fixed several "back" button navigation issues in dashboard editor
---
.bugs/2192 | 7 +++++--
web/htdocs/dashboard.py | 11 +++++++----
web/htdocs/views.py | 2 +-
web/plugins/dashboard/dashlets.py | 3 ++-
4 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/.bugs/2192 b/.bugs/2192
index b163378..5df5f1d 100644
--- a/.bugs/2192
+++ b/.bugs/2192
@@ -1,11 +1,14 @@
Title: Dashboard: Back button (abort) while adding view to dashboard leads away
Component: multisite
-State: open
+Class: bug
+State: done
Date: 2014-10-06 18:38:23
Targetversion: future
-Class: bug
When you add a view to a dashboard, and in the process press "Back", then
you do not get back but to the list of views.
Solution: Either remove the button or make it work as expected.
+
+2014-10-07 09:02:32: changed state open -> done
+Done.
diff --git a/web/htdocs/dashboard.py b/web/htdocs/dashboard.py
index 7ac8255..abf730a 100644
--- a/web/htdocs/dashboard.py
+++ b/web/htdocs/dashboard.py
@@ -388,7 +388,8 @@ def render_dashboard(name):
add_existing_view_type = dashlet_types['view'].copy()
add_existing_view_type['title'] = _('Existing View')
- add_existing_view_type['add_urlfunc'] = lambda:
'create_view_dashlet.py?name=%s&create=0' % html.urlencode(name)
+ add_existing_view_type['add_urlfunc'] = lambda:
'create_view_dashlet.py?name=%s&create=0&back=%s' % \
+ (html.urlencode(name),
html.urlencode(html.makeuri([('edit', '1')])))
choices = [ ('view', add_existing_view_type) ]
choices += sorted(dashlet_types.items(), key = lambda x:
x[1].get('sort_index', 0))
@@ -679,9 +680,10 @@ def page_create_view_dashlet():
if create:
import views
+ # %s can not be added using html.makeuri(), replaced with datasource later
url = html.makeuri([], filename = "create_view_dashlet_infos.py")
- url += '&datasource=%s' # %s can not be added using html.makeuri()
- # Note: %s will later be replaced by datasource
+ url += '&datasource=%s'
+
views.page_create_view(next_url=url)
else:
@@ -710,7 +712,8 @@ def choose_view(name):
html.header(_('Create Dashlet from existing View'),
stylesheets=["pages"])
html.begin_context_buttons()
- html.context_button(_("Back"), html.makeuri([('edit', 1)], filename
= "dashboard.py"), "back")
+ back_url = html.var("back", "dashboard.py?edit=1&name=%s" %
html.urlencode(html.var('name')))
+ html.context_button(_("Back"), back_url, "back")
html.end_context_buttons()
if html.var('save') and html.check_transaction():
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 34b6d4c..a646a88 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -207,6 +207,7 @@ def page_edit_views():
# Create datasource selection valuespec, also for other modules
def DatasourceSelection():
+ # FIXME: Sort the datasources by (assumed) common usage
datasources = []
for ds_name, ds in multisite_datasources.items():
datasources.append((ds_name, ds['title']))
@@ -222,7 +223,6 @@ def DatasourceSelection():
def page_create_view(next_url = None):
- # FIXME: Sort the datasources by (assumed) common usage
vs_ds = DatasourceSelection()
ds = 'services' # Default selection
diff --git a/web/plugins/dashboard/dashlets.py b/web/plugins/dashboard/dashlets.py
index 4be7271..554445a 100644
--- a/web/plugins/dashboard/dashlets.py
+++ b/web/plugins/dashboard/dashlets.py
@@ -525,7 +525,8 @@ def dashlet_view(nr, params):
views.show_view(params, True, True, True)
def dashlet_view_add_url():
- return 'create_view_dashlet.py?name=%s' %
html.urlencode(html.var('name'))
+ return 'create_view_dashlet.py?name=%s&back=%s' % \
+ (html.urlencode(html.var('name')),
html.urlencode(html.makeuri([('edit', '1')])))
def dashlet_view_parameters():
return dashlet_view_render_input, dashlet_view_handle_input