Module: check_mk
Branch: master
Commit: fc52f1c77b8a02ef965e3caf35e1007008f1c781
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fc52f1c77b8a02…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 2 10:45:32 2018 +0200
Refactored ajax_set_foldertree call to WatoWebApiMode
Change-Id: I3bb1aaa1fce85c071ca52a3bb0e46b21c54a1602
---
web/htdocs/wato.py | 6 ++++--
web/plugins/pages/wato.py | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 430ff78..71d6edf 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1339,8 +1339,10 @@ def mode_editfolder(phase, new):
html.end_form()
-def ajax_set_foldertree():
- config.user.save_file("foldertree", (html.var('topic'),
html.var('target')))
+class ModeAjaxSetFoldertree(WatoWebApiMode):
+ def page(self):
+ request = self.webapi_request()
+ config.user.save_file("foldertree", (request.get('topic'),
request.get('target')))
#.
diff --git a/web/plugins/pages/wato.py b/web/plugins/pages/wato.py
index 0c2992e..a4b4e68 100644
--- a/web/plugins/pages/wato.py
+++ b/web/plugins/pages/wato.py
@@ -37,7 +37,7 @@ register_handlers({
"noauth:automation" : wato.page_automation,
"user_profile" : wato.page_user_profile,
"user_change_pw" : lambda:
wato.page_user_profile(change_pw=True),
- "ajax_set_foldertree" : wato.ajax_set_foldertree,
+ "ajax_set_foldertree" : lambda:
wato.ModeAjaxSetFoldertree().handle_page(),
"wato_ajax_diag_host" : lambda:
wato.ModeAjaxDiagHost().handle_page(),
"wato_ajax_profile_repl" : watolib.ajax_profile_repl,
"wato_ajax_execute_check" : lambda:
wato.ModeAjaxExecuteCheck().handle_page(),