Skip to content

Commit

Permalink
10549 FIX Log views: Replace "State type" painter / filter with "Stat…
Browse files Browse the repository at this point in the history
…e information"

The "Log: State type", which was shown in the monitoring events views, was
problematic. Depending on the type of event the painter showed either the state
type (HARD/SOFT) or the actual state (WARNING/CRITICAL/...).

The original painter and the related filter still exist for compatibility, but
we have added a new one named "Log: State information" which presents these
information in a more structured way.

CMK-3145

Change-Id: Ic594dc8f6d4f5d68a330ce0f05819d3807b1a463
  • Loading branch information
LarsMichelsen committed Nov 13, 2019
1 parent cec7801 commit 6711f80
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 11 deletions.
17 changes: 17 additions & 0 deletions .werks/10549
@@ -0,0 +1,17 @@
Title: Log views: Replace "State type" painter / filter with "State information"
Class: fix
Compatible: compat
Component: multisite
Date: 1573655985
Edition: cre
Knowledge: doc
Level: 1
Version: 1.7.0i1

The "Log: State type", which was shown in the monitoring events views, was
problematic. Depending on the type of event the painter showed either the state
type (HARD/SOFT) or the actual state (WARNING/CRITICAL/...).

The original painter and the related filter still exist for compatibility, but
we have added a new one named "Log: State information" which presents these
information in a more structured way.
18 changes: 9 additions & 9 deletions cmk/gui/plugins/views/builtin.py
Expand Up @@ -623,12 +623,12 @@
('log_time', None),
('host', 'host_dt_hist'),
('service_description', 'svc_dt_hist'),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
'public': True,
'show_filters': ['logtime', 'hostregex', 'serviceregex', 'log_state_type'],
'show_filters': ['logtime', 'hostregex', 'serviceregex', 'log_state_info'],
'sorters': [
('log_what', True),
('log_time', True),
Expand Down Expand Up @@ -2629,7 +2629,7 @@
('log_type', None),
('host', 'hostsvcevents'),
('service_description', 'svcevents'),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2676,7 +2676,7 @@
('log_icon', None),
('log_time', None),
('log_type', None),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2710,7 +2710,7 @@
'painters': [
('log_icon', None),
('log_time', None),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2746,7 +2746,7 @@
('log_icon', None),
('log_time', None),
('log_type', None),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2780,7 +2780,7 @@
'painters': [
('log_icon', None),
('log_time', None),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2819,7 +2819,7 @@
('log_type', None),
('host', None),
('service_description', 'svcevents'),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down Expand Up @@ -2872,7 +2872,7 @@
('log_type', None),
('host', 'hostsvcevents'),
('service_description', 'svcevents'),
('log_state_type', None),
('log_state_info', None),
('log_plugin_output', None),
],
'play_sounds': False,
Expand Down
30 changes: 29 additions & 1 deletion cmk/gui/plugins/views/painters.py
Expand Up @@ -4611,7 +4611,7 @@ def ident(self):

@property
def title(self):
return _("Log: type of state (hard/soft/stopped/started)")
return _("Log: state type (DEPRECATED: Use \"state information\")")

@property
def short_title(self):
Expand All @@ -4625,6 +4625,34 @@ def render(self, row, cell):
return ("", row["log_state_type"])


@painter_registry.register
class PainterLogStateInfo(Painter):
@property
def ident(self):
return "log_state_info"

@property
def title(self):
return _("Log: State information")

@property
def short_title(self):
return _("State info")

@property
def columns(self):
return ['log_state_info', 'log_state_type']

def render(self, row, cell):
info = row["log_state_info"]

# be compatible to <1.7 remote sites and show log_state_type content as fallback
if not info:
info = row["log_state_type"]

return ("", html.attrencode(info))


@painter_registry.register
class PainterLogType(Painter):
@property
Expand Down
1 change: 1 addition & 0 deletions cmk/gui/plugins/views/sorters.py
Expand Up @@ -534,6 +534,7 @@ def cmp(self, r1, r2):
declare_1to1_sorter("log_plugin_output", cmp_simple_string)
declare_1to1_sorter("log_attempt", cmp_simple_string)
declare_1to1_sorter("log_state_type", cmp_simple_string)
declare_1to1_sorter("log_state_info", cmp_simple_string)
declare_1to1_sorter("log_type", cmp_simple_string)
declare_1to1_sorter("log_contact_name", cmp_simple_string)
declare_1to1_sorter("log_time", cmp_simple_number)
Expand Down
20 changes: 19 additions & 1 deletion cmk/gui/plugins/visuals/filters.py
Expand Up @@ -2163,7 +2163,7 @@ def ident(self):

@property
def title(self):
return _("Log: state type")
return _("Log: state type (DEPRECATED: Use \"state information\")")

@property
def sort_index(self):
Expand All @@ -2173,6 +2173,24 @@ def __init__(self):
FilterText.__init__(self, "log", "log_state_type", "log_state_type", "~~")


@filter_registry.register
class FilterLogStateInfo(FilterText):
@property
def ident(self):
return "log_state_info"

@property
def title(self):
return _("Log: state information")

@property
def sort_index(self):
return 204

def __init__(self):
FilterText.__init__(self, "log", "log_state_info", "log_state_info", "~~")


@filter_registry.register
class FilterLogContactName(FilterText):
@property
Expand Down

0 comments on commit 6711f80

Please sign in to comment.