From 201bc6ecee8d2bbcfd607d829d21d73ea8779bc8 Mon Sep 17 00:00:00 2001 From: cigamit Date: Fri, 24 Mar 2017 22:49:04 -0500 Subject: [PATCH] Resolving Issue #469 Allow changing of Re-Index Method from Device Edit Updating ChangeLog from other commit --- docs/CHANGELOG | 4 ++ host.php | 109 ++++++++++++++++++++++++++++++-------- include/global_arrays.php | 13 +++-- include/layout.js | 17 ++++-- lib/api_device.php | 61 +++++++++++++++++++-- 5 files changed, 172 insertions(+), 32 deletions(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index a617d487c7..211ce53546 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -11,7 +11,11 @@ Cacti CHANGELOG -issue#467: Reduce the number of queries in log function -issue#472: Schema changes to improve performance -issue: Back button issues due to syntax problems in JavaScript +-issue: Zoom periodically would looks it's crosshairs after zooming +-issue: Zoom would zoom out into the future when disabled +-feature#469: Change re-index method of Data Query from Device Edit -feature: Support generalized date format approach in the GUI +-feature: Use localStorage over a Cookie for Zoom setting storage 1.1.0 -issue#337: Generic SNMP OID Graph Template damanged diff --git a/host.php b/host.php index 748fd4560d..f0257afa8b 100644 --- a/host.php +++ b/host.php @@ -83,6 +83,13 @@ switch (get_request_var('action')) { host_remove_query(); + header('Location: host.php?header=false&action=edit&id=' . get_request_var('host_id')); + break; + case 'query_change': + get_filter_request_var('host_id'); + + host_change_query(); + header('Location: host.php?header=false&action=edit&id=' . get_request_var('host_id')); break; case 'query_reload': @@ -570,13 +577,7 @@ function host_add_query() { get_filter_request_var('reindex_method'); /* ==================================================== */ - db_execute_prepared('REPLACE INTO host_snmp_query - (host_id, snmp_query_id, reindex_method) - VALUES (?, ?, ?)', - array(get_nfilter_request_var('host_id'), get_nfilter_request_var('snmp_query_id'), get_nfilter_request_var('reindex_method'))); - - /* recache snmp data */ - run_data_query(get_nfilter_request_var('host_id'), get_nfilter_request_var('snmp_query_id')); + api_device_dq_add(get_request_var('host_id'), get_request_var('snmp_query_id'), get_request_var('reindex_method')); } function host_reload_query() { @@ -597,6 +598,16 @@ function host_remove_query() { api_device_dq_remove(get_request_var('host_id'), get_request_var('id')); } +function host_change_query() { + /* ================= input validation ================= */ + get_filter_request_var('data_query_id'); + get_filter_request_var('host_id'); + get_filter_request_var('reindex_method'); + /* ==================================================== */ + + api_device_dq_change(get_request_var('host_id'), get_request_var('data_query_id'), get_request_var('reindex_method')); +} + function host_add_gt() { /* ================= input validation ================= */ get_filter_request_var('host_id'); @@ -653,7 +664,7 @@ function host_edit() { if (!empty($host['id'])) { ?> - +
- - $type) { + if (get_selected_theme() != 'classic') { + if ($i == 0) { + print "
\n"; + } + print "\n"; + print "\n"; + }else{ + print $reindex_types[$item['reindex_method']]; + break; + } + + $i++; + } + + if (get_selected_theme() != 'classic') { + print "
\n"; + } +} + function device_javascript() { ?>
() @@ -805,7 +816,14 @@ function host_edit() { html_start_box(__('Associated Data Queries'), '100%', '', '3', 'center', ''); - html_header(array(__('Data Query Name'), __('Debugging'), __('Re-Index Method'), __('Status')), 2); + html_header( + array( + array('display' => __('Data Query Name'), 'align' => 'left'), + array('display' => __('Re-Index Method'), 'align' => 'left'), + array('display' => __('Status'), 'align' => 'left'), + array('display' => __('Actions'), 'align' => 'right') + ) + ); if ($host['snmp_version'] == 0) { $sql_where1 = ' AND snmp_query.data_input_id != 2'; @@ -858,18 +876,16 @@ function host_edit() { ) - (' class='linkEditMain' data-id=''>Verbose Query) - - + + " . __('Success') . "" : "" . __('Fail') . "");?> [ Item, Row] - ' data-id=''> - ' data-id=''> + ' title='' data-id=''> + ' title='' id='reload' data-id=''> + ' title='' data-id=''>