Module: check_mk
Branch: master
Commit: 83eb80f74057a1e2f54e44a2d159b6367d5ff8cd
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=83eb80f74057a1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 14:42:57 2013 +0100
Improved view row selection handling
* When having row selections enabled and no selected and performing
actions an error message is displayed instead of performing the action on
all rows
---
.bugs/788 | 7 +++++--
ChangeLog | 3 +++
web/htdocs/js/checkmk.js | 32 ++++++++++++++++++++++++++------
web/htdocs/views.py | 17 +++++++++++------
4 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/.bugs/788 b/.bugs/788
index 0d1f9bd..894d7ab 100644
--- a/.bugs/788
+++ b/.bugs/788
@@ -1,11 +1,14 @@
Title: Command while no row selected show not do any command
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2012-07-29 23:00:06
Targetversion: 1.2.2
-Class: nastiness
Currently if no row is checked then it behaves like *all*
rows are selected. Better would be a warning message
that no row is selected. An no command executed.
+
+2013-01-10 14:42:01: changed state open -> done
+Has been implemented like written here.
diff --git a/ChangeLog b/ChangeLog
index 4df185b..44cb12c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@
Multisite:
* FIX: Fixed rendering of dashboard globes in opera
+ * When having row selections enabled and no selected and performing
+ actions an error message is displayed instead of performing the action on
+ all rows
1.2.1i4:
Core:
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 1f135e6..7c99fea 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -1004,6 +1004,8 @@ function toggle_foldable_container(treename, id) {
* +----------------------------------------------------------------------+
*/
+// Tells us if the row selection is enabled at the moment
+var g_selection_enabled = false;
// Holds the row numbers of all selected rows
var g_selected_rows = [];
@@ -1362,18 +1364,31 @@ function init_rowselect() {
// Adds a hidden field with the selected rows to the form if
// some are selected
+// Send an empty field to tell the server code that the checkbox
+// handling is enabled in GUI but no row has been selected
function add_row_selections(form) {
- var num_selected = g_selected_rows.length;
- // Skip when none selected
- if(num_selected == 0)
+ // Skip when selection is not enabled
+ if(!g_selection_enabled) {
+ // Remove var from form before submission
+ if(form.elements['selected_rows'] !== undefined) {
+ form.removeChild(form.elements['selected_rows']);
+ }
return true;
+ }
+
+ var num_selected = g_selected_rows.length;
+
+ if(form.elements['selected_rows'] === undefined) {
+ var field = document.createElement('input');
+ form.appendChild(field);
+ } else {
+ var field = form.elements['selected_rows'];
+ }
- var field = document.createElement('input');
field.name = 'selected_rows';
field.type = 'hidden';
field.value = g_selected_rows.join(',');
- form.appendChild(field);
field = null;
}
@@ -1814,7 +1829,12 @@ function view_switch_option(oDiv, viewname, option, choices) {
get_url_sync("ajax_set_viewoption.py?view_name=" + viewname +
"&option=" + option + "&value=" + new_choice[0]);
- if (option == "refresh")
+
+ if (option == "refresh") {
setReload(new_choice[0]);
+ } else if (option == "show_checkboxes") {
+ g_selection_enabled = new_value;
+ }
+
handleReload('');
}
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index b6a0dbe..0b50323 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1370,7 +1370,7 @@ def render_view(view, rows, datasource, group_painters, painters,
if command_form:
# If we are currently within an action (confirming or executing), then
# we display only the selected rows (if checkbox mode is active)
- if html.var("selected_rows", "") and html.do_actions():
+ if html.var("selected_rows", None) != None and html.do_actions():
rows = get_selected_rows(view, rows, html.var("selected_rows"))
if html.do_actions() and html.transaction_valid(): # submit button pressed, no reload
@@ -1614,7 +1614,7 @@ def view_optiondial(view, option, choices, help):
html.begin_context_buttons() # just to be sure
# Remove unicode strings
choices = [ [c[0], str(c[1])] for c in choices ]
- html.write('<div title="%s" id="optiondial_%s" class="optiondial %s val_%s"'
+ html.write('<div title="%s" id="optiondial_%s" class="optiondial %s val_%s" '
'onclick="view_dial_option(this, \'%s\', \'%s\', %r);"><div>%s</div></div>' % (
help, option, option, value, view["name"], option, choices, title))
html.final_javascript("init_optiondial('optiondial_%s');" % option)
@@ -1628,7 +1628,7 @@ def view_option_toggler(id, view, option, icon, help, hidden = False):
value = vo.get(option, view.get(option, False))
html.begin_context_buttons() # just to be sure
hide = hidden and ' style="display:none"' or ''
- html.write('<div id="%s_on" title="%s" class="togglebutton %s %s"'
+ html.write('<div id="%s_on" title="%s" class="togglebutton %s %s" '
'onclick="view_switch_option(this, \'%s\', \'%s\');"%s></div>' % (
id, help, icon, value and "down" or "up", view["name"], option, hide))
@@ -1699,10 +1699,12 @@ def show_context_links(thisview, active_filters, show_filters, display_options,
hidden = not enable_commands)
togglebutton_off("commands", "commands", hidden = enable_commands)
+ selection_enabled = enable_commands and enable_checkboxes
view_option_toggler("checkbox", thisview, "show_checkboxes", "checkbox",
_("Enable/Disable checkboxes for selecting rows for commands"),
- hidden = not enable_commands or not enable_checkboxes)
- togglebutton_off("checkbox", "checkbox", hidden = enable_commands and enable_checkboxes)
+ hidden = not selection_enabled)
+ togglebutton_off("checkbox", "checkbox", hidden = selection_enabled)
+ html.javascript('g_selection_enabled = %s;' % (selection_enabled and 'true' or 'false'))
if 'O' in display_options:
if config.may("general.view_option_columns"):
@@ -2162,7 +2164,10 @@ def do_actions(view, what, action_rows, backurl):
return False # no actions done
if not action_rows:
- html.show_error(_("No rows selected to perform actions for."))
+ message = _("No rows selected to perform actions for.")
+ if html.output_format == "html": # sorry for this hack
+ message += '<br><a href="%s">%s</a>' % (backurl, _('Back to view'))
+ html.show_error(message)
return False # no actions done
command = None
Module: check_mk
Branch: master
Commit: f0ca2632f462bca74c89d62be4aeeee405742c58
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f0ca2632f462bc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 10 14:30:44 2013 +0100
Added user attributes for not seeing all objects
Not yet functional...
---
web/htdocs/wato.py | 23 ++++++++++++++---------
web/plugins/wato/user_attributes.py | 26 ++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 943922a..7e823c3 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7519,11 +7519,14 @@ def delete_distributed_wato_file():
# | Mode for managing users and contacts. |
# '----------------------------------------------------------------------'
-def declare_user_attribute(name, vs, user_editable = True):
+def declare_user_attribute(name, vs, user_editable = True, permission = None):
userdb.user_attributes[name] = {
'valuespec': vs,
'user_editable': user_editable,
}
+ # Permission needed for editing this attribute
+ if permission:
+ userdb.user_attributes[name]["permission"] = permission
def load_notification_scripts_from(adir):
scripts = {}
@@ -8219,10 +8222,11 @@ def mode_edit_user(phase):
select_language(user.get('language', ''))
for name, attr in userdb.get_user_attributes():
if attr['user_editable']:
- vs = attr['valuespec']
- forms.section(vs.title())
- vs.render_input("ua_" + name, user.get(name, vs.default_value()))
- html.help(vs.help())
+ if not attr.get("permission") or config.may(attr["permission"]):
+ vs = attr['valuespec']
+ forms.section(vs.title())
+ vs.render_input("ua_" + name, user.get(name, vs.default_value()))
+ html.help(vs.help())
# TODO: Later we could add custom macros here, which
# then could be used for notifications. On the other hand,
@@ -10850,10 +10854,11 @@ def page_user_profile():
if config.may('general.edit_user_attributes'):
for name, attr in userdb.get_user_attributes():
if attr['user_editable']:
- vs = attr['valuespec']
- value = vs.from_html_vars('ua_' + name)
- vs.validate_value(value, "ua_" + name)
- users[config.user_id][name] = value
+ if not attr.get("permission") or config.may(attr["permission"]):
+ vs = attr['valuespec']
+ value = vs.from_html_vars('ua_' + name)
+ vs.validate_value(value, "ua_" + name)
+ users[config.user_id][name] = value
# Change the password if requested
if config.may('general.change_password'):
diff --git a/web/plugins/wato/user_attributes.py b/web/plugins/wato/user_attributes.py
new file mode 100644
index 0000000..22ef473
--- /dev/null
+++ b/web/plugins/wato/user_attributes.py
@@ -0,0 +1,26 @@
+
+declare_user_attribute(
+ "force_authuser",
+ Checkbox(
+ title = _("Visibility of Hosts/Services"),
+ label = _("Only show hosts and services the user is a contact for"),
+ help = _("When this option is checked, then the status GUI will only "
+ "display hosts and services that the user is a contact for - "
+ "even if he has the permission for seeing all objects."),
+ ),
+ permission = "general.see_all"
+)
+
+declare_user_attribute(
+ "force_authuser_webservice",
+ Checkbox(
+ title = _("Visibility of Hosts/Services (Webservice)"),
+ label = _("Export only hosts and services the user is a contact for"),
+ help = _("When this option is checked, then the Multisite webservice "
+ "will only export hosts and services that the user is a contact for - "
+ "even if he has the permission for seeing all objects."),
+ ),
+ permission = "general.see_all"
+)
+
+
Module: check_mk
Branch: master
Commit: c74f217038a80776d9de17654436d7937a5fdca8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c74f217038a807…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 12:10:31 2013 +0100
Improved handling of CTRL+C (SIGINT) to terminate long runnining tasks (e.g. inventory of SNMP hosts)
---
.bugs/808 | 7 +++++--
ChangeLog | 8 ++++++--
modules/check_mk_base.py | 6 +++++-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/.bugs/808 b/.bugs/808
index d553fdf..965c7c0 100644
--- a/.bugs/808
+++ b/.bugs/808
@@ -1,9 +1,9 @@
Title: Handle ctrl-c for inventory
Component: core
-State: open
+Class: nastiness
+State: done
Date: 2012-10-10 13:37:24
Targetversion: 1.2.2
-Class: nastiness
Currently, trying to abort an inventory only kills the current inventory. If you
have simply specified cmk -I you'll need to abort as many times as there are hosts
@@ -14,3 +14,6 @@ Currently we have the problem, that the snmp commands get the Ctrl-C and not
Python. Can we start the snmp commands without a controlling terminal?
And the gracefully handle Ctrl-C in Check_MK.
+
+2013-01-10 12:09:04: changed state open -> done
+This could simply be solved by adding a SIGINT handler to check_mk
diff --git a/ChangeLog b/ChangeLog
index cf69e5e..4df185b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,15 @@
1.2.1i5
- Checks & Agents
+ Core:
+ * Improved handling of CTRL+C (SIGINT) to terminate long runnining tasks
+ (e.g. inventory of SNMP hosts)
+
+ Checks & Agents:
* Linux Agent, diskstat: Now supporting /dev/emcpower* devices (Thanks to Claas Rockmann-Buchterkirche)
* FIX: winperf_processor: Showing 0% on "cmk -nv" now instead of 100%
* FIX: win_dhcp_pools: removed faulty output on non-german windows 2003 servers
with no dhcp server installed (Thanks to Mathias Decker)
- Multisite
+ Multisite:
* FIX: Fixed rendering of dashboard globes in opera
1.2.1i4:
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index d87eee8..bb45386 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -75,7 +75,6 @@ else:
def tty(fg=-1, bg=-1, attr=-1):
return ''
-
# global variables used to cache temporary values
g_dns_cache = {}
g_infocache = {} # In-memory cache of host info.
@@ -105,6 +104,11 @@ opt_use_snmp_walk = False
opt_cleanup_autochecks = False
fake_dns = False
+# register SIGINT handler for consistenct CTRL+C handling
+def interrupt_handler(signum, frame):
+ sys.stderr.write('<Interrupted>\n')
+ sys.exit(1)
+signal.signal(signal.SIGINT, interrupt_handler)
class MKGeneralException(Exception):
def __init__(self, reason):
Module: check_mk
Branch: master
Commit: 138c6c208f8c6ff0a30f67e9607968869874fe7e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=138c6c208f8c6f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 11:37:14 2013 +0100
Fixed changelog entry in wrong version
---
ChangeLog | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 63501f8..cf69e5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,9 @@
* FIX: win_dhcp_pools: removed faulty output on non-german windows 2003 servers
with no dhcp server installed (Thanks to Mathias Decker)
+ Multisite
+ * FIX: Fixed rendering of dashboard globes in opera
+
1.2.1i4:
Core:
* Better exception handling when executing "Check_MK"-Check. Printing python
@@ -88,7 +91,6 @@
* FIX: Dashboard: Fixed wrong display options in links after data reloads
* FIX: Fixed "remove all downtimes" button in views when no downtimes to be deleted
* FIX: Services in hosttables now use the service name as header (if no custom title set)
- * FIX: Fixed rendering of dashboard globes in opera
* New filter for host_contact and service_contact
WATO:
Module: check_mk
Branch: master
Commit: 85e7d44f3549f5f226c968c4769c4d2faaaaf6df
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=85e7d44f3549f5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 11:35:02 2013 +0100
Fixed changelog entries in wrong version
---
ChangeLog | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2c4b5ec..63501f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
1.2.1i5
Checks & Agents
+ * Linux Agent, diskstat: Now supporting /dev/emcpower* devices (Thanks to Claas Rockmann-Buchterkirche)
* FIX: winperf_processor: Showing 0% on "cmk -nv" now instead of 100%
* FIX: win_dhcp_pools: removed faulty output on non-german windows 2003 servers
with no dhcp server installed (Thanks to Mathias Decker)
@@ -23,7 +24,6 @@
* Linux Agent, mk_postgres: Supporting pgsql and postgres as user
* Linux Agent, mk_postgres: Fixed database stats query to be compatible
with more versions of postgres
- * Linux Agent, diskstat: Now supporting /dev/emcpower* devices (Thanks to Claas Rockmann-Buchterkirche)
* apache_status: Modified to be usable on python < 2.6 (eg RHEL 5.x)
* apache_status: Fixed handling of PIDs with more than 4 numbers
* Add: New Check for Rittal CMC PSM-M devices
Module: check_mk
Branch: master
Commit: 1e9cd1334430e44f77b243df57a378d1b97971fe
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1e9cd1334430e4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 10 09:21:34 2013 +0100
Updated bug entries #0752, #0874
---
.bugs/752 | 7 +++++--
.bugs/874 | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/.bugs/752 b/.bugs/752
index 9cbea8e..7bf4311 100644
--- a/.bugs/752
+++ b/.bugs/752
@@ -1,9 +1,9 @@
Title: Opera: Globes are only displayed half
Component: multisite
-State: open
+Class: nastiness
+State: done
Date: 2012-05-20 15:58:01
Targetversion: 1.2.2
-Class: nastiness
Only the right half of the actual data is being displayed.
Maybe Opera has problems with negative values somewhere.
@@ -14,3 +14,6 @@ in opera the negative scale for flipping the thing does not work:
context.scale(x_scale, 1);
Maybe simply draw the figure vice versa instead of flipping it after drawing?
+
+2013-01-09 16:11:23: changed state open -> done
+fixed rendering algorithm
diff --git a/.bugs/874 b/.bugs/874
index fb4152c..c0e4af8 100644
--- a/.bugs/874
+++ b/.bugs/874
@@ -1,9 +1,9 @@
Title: Cleanup OMD manpage paths
Component: core
-State: open
+Class: nastiness
+State: done
Date: 2013-01-03 11:09:30
Targetversion: 1.2.2
-Class: nastiness
The regular check manpage path in OMD is share/doc/check_mk/checks but the
local path is local/share/check_mk/checkman. This is confusing. Cleanup the
@@ -12,3 +12,6 @@ normal/local paths to make them equal.
Resolution: Change the OMD path to share/check_mk/checkman. Move the
directory around. No symlinking. Manpages are not intended for manual
reading.
+
+2013-01-09 16:18:00: changed state open -> done
+Has been changed in omd. Was an integration issue