Module: check_mk
Branch: master
Commit: 40edfc45eae56577ce7099323102d62366819f2e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=40edfc45eae565…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Sep 16 16:04:54 2015 +0200
Fix 'Reset to defaults' button after reload in availability view
---
web/htdocs/availability.py | 53 ++++++++++++++++++++-----------------
web/plugins/views/availability.py | 9 ++++---
2 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/web/htdocs/availability.py b/web/htdocs/availability.py
index ddf59f2..ee184d4 100644
--- a/web/htdocs/availability.py
+++ b/web/htdocs/availability.py
@@ -469,37 +469,40 @@ def get_avoption_entries(what):
def get_default_avoptions():
return {
- "range" : (time.time() - 86400, time.time()),
- "rangespec" : "d0",
- "labelling" : [],
- "downtimes" : {
+ "range" : (time.time() - 86400, time.time()),
+ "rangespec" : "d0",
+ "labelling" : [],
+ "av_levels" : None,
+ "av_filter_outages" : { "warn" : 0.0, "crit" :
0.0, "non-ok" : 0.0 },
+ "outage_statistics" : ([],[]),
+ "av_mode" : False,
+ "service_period" : "honor",
+ "notification_period" : "ignore",
+ "grouping" : None,
+ "dateformat" : "yyyy-mm-dd hh:mm:ss",
+ "timeformat" : "percentage_2",
+ "short_intervals" : 0,
+ "dont_merge" : False,
+ "summary" : "sum",
+ "show_timeline" : False,
+ "timelimit" : 30,
+
+ "downtimes" : {
"include" : "honor",
"exclude_ok" : False,
},
- "consider" : {
- "flapping" : True,
- "host_down" : True,
- "unmonitored" : True,
+
+ "consider" : {
+ "flapping" : True,
+ "host_down" : True,
+ "unmonitored" : True,
},
+
"state_grouping" : {
- "warn" : "warn",
- "unknown" : "unknown",
- "host_down" : "host_down",
+ "warn" : "warn",
+ "unknown" : "unknown",
+ "host_down" : "host_down",
},
- "av_levels" : None,
- "av_filter_outages" : { "warn" : 0.0, "crit" : 0.0,
"non-ok" : 0.0 },
- "outage_statistics" : ([],[]),
- "av_mode" : False,
- "service_period" : "honor",
- "notification_period" : "ignore",
- "grouping" : None,
- "dateformat" : "yyyy-mm-dd hh:mm:ss",
- "timeformat" : "percentage_2",
- "short_intervals" : 0,
- "dont_merge" : False,
- "summary" : "sum",
- "show_timeline" : False,
- "timelimit" : 30,
}
#.
diff --git a/web/plugins/views/availability.py b/web/plugins/views/availability.py
index 58b291f..fadc412 100644
--- a/web/plugins/views/availability.py
+++ b/web/plugins/views/availability.py
@@ -55,7 +55,7 @@ def get_availability_options_from_url(what):
def render_availability_options(what):
- if html.var("_reset") and html.check_transaction():
+ if html.var("_reset"):
config.save_user_file("avoptions", {})
for varname in html.vars.keys():
if varname.startswith("avo_"):
@@ -110,12 +110,13 @@ def render_availability_options(what):
html.write("<tr><td>")
html.button("apply", _("Apply"), "submit")
- html.button("_reset", _("Reset to defaults"),
"submit")
+ html.hidden_fields()
+ html.end_form()
+
+ html.buttonlink(html.makeuri([("_reset", "1")],
remove_prefix="avo_"), _("Reset to defaults"))
html.write("</td></tr></table>")
html.write("</div>")
- html.hidden_fields()
- html.end_form()
if html.form_submitted():
config.save_user_file("avoptions", avoptions)