Module: check_mk
Branch: master
Commit: 48a16c9eb3ad583d79ae2886f5b62a8a2510ec47
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=48a16c9eb3ad58…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jun 1 14:53:31 2016 +0200
3618 Better layout for role & permission matrix, also allow sorting and searching
---
.werks/3618 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 33 +++++++++++----------------------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/.werks/3618 b/.werks/3618
new file mode 100644
index 0000000..54c13b6
--- /dev/null
+++ b/.werks/3618
@@ -0,0 +1,10 @@
+Title: Better layout for role & permission matrix, also allow sorting and searching
+Level: 2
+Component: wato
+Class: feature
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464785582
+
+
diff --git a/ChangeLog b/ChangeLog
index 6c15638..bb495a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -343,6 +343,7 @@
* 3130 periodic service discovery can now be configured to not activate specific
service changes...
* 3472 Service list of a host: Move section of vanished services to top of the
page...
* 3538 Now hiding the activate changes button as long as another activation process
is running
+ * 3618 Better layout for role & permission matrix, also allow sorting and
searching
* 3060 FIX: Folder properties: Fixed exception when a user has no alias set...
* 3062 FIX: Git integration: Fixed not adding files in WATO folders to git control
* 3203 FIX: Distributed WATO: Fixed exception in remote host service discovery...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 069afdc..279fdbb 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10990,22 +10990,13 @@ def mode_role_matrix(phase):
role_list = roles.items()
role_list.sort(cmp = lambda a,b: cmp((a[1]["alias"],a[0]),
(b[1]["alias"],b[0])))
- html.write("<table class=data>")
- html.write("<tr class=dualheader><th></th>")
- num_roles = 1
- for role_id, role in role_list:
- html.write('<th>%s</th>' % role_id)
- num_roles += 1
- html.write("</tr>\n")
-
# Loop all permission sections, but sorted plz
- odd = "even"
for section, (prio, section_title, do_sort) in
sorted(config.permission_sections.iteritems(),
key = lambda x: x[1][0], reverse =
True):
- html.write('<tr>')
- html.write('<th colspan=%d>%s</th>' % (num_roles,
section_title))
- html.write('</tr>')
+ html.begin_foldable_container("perm_matrix", section, section ==
"general", section_title, indent = True)
+
+ table.begin(section)
# Loop all permissions
permlist = config.permissions_by_order[:]
@@ -11018,13 +11009,11 @@ def mode_role_matrix(phase):
if section != this_section:
continue # Skip permissions of other sections
- odd = odd == "odd" and "even" or "odd"
-
- html.write('<tr class="data %s0">' % odd)
- html.write('<td class=title>%s</td>' %
perm["title"])
-
- for id, role in role_list:
- base_on_id = role.get('basedon', id)
+ table.row()
+ table.cell(_("Permission"), perm["title"],
css="wide")
+ html.help(perm["description"])
+ for role_id, role in role_list:
+ base_on_id = role.get('basedon', role_id)
pvalue = role["permissions"].get(pname)
if pvalue is None:
if base_on_id in perm["defaults"]:
@@ -11034,12 +11023,12 @@ def mode_role_matrix(phase):
else:
icon_name = "perm_%s" % (pvalue and "yes" or
"no")
- html.write('<td align=center>')
+ table.cell(role_id, css="center")
if icon_name:
html.icon(None, icon_name)
- html.write('</td>')
- html.write('</tr>')
+ table.end()
+ html.end_foldable_container()
html.write("</table>")