Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
* refs #564 : Backport into 2.6.X branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Assepo committed Sep 18, 2015
1 parent 58b3e36 commit fe446b8
Show file tree
Hide file tree
Showing 8 changed files with 534 additions and 444 deletions.
1 change: 1 addition & 0 deletions www/include/monitoring/status/Common/commonJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

var _search = '<?php global $url ; echo ($search ? $search : (isset($centreon->historySearchService[$url]) ? $centreon->historySearchService[$url] : ""));?>';
var _host_search = '<?php global $url ; echo (isset($search_host) && $search_host != "" ? $search_host : (isset($centreon->historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>';
var _sg_search = '<?php global $url ; echo (isset($search_sg) && $search_sg != "" ? $search_sg : (isset($centreon->historySearch[$url]) ? $centreon->historySearch[$url] : "")); ?>';
var _output_search = '<?php global $url ; echo (isset($search_output) && $search_output != "" ? $search_output : (isset($centreon->historySearchOutput[$url]) ? $centreon->historySearchOutput[$url] : "")); ?>';

var _num='<?php echo $num?>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,34 @@
$tpl->assign("mon_ip", _("IP"));
$tpl->assign("mon_last_check", _("Last Check"));
$tpl->assign("mon_duration", _("Duration"));
$tpl->assign('search', _('Search'));
$tpl->assign('search', _('Host'));
$tpl->assign('sgStr', _('Servicegroup'));
$tpl->assign('pollerStr', _('Poller'));
$tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing'));
$tpl->assign("mon_status_information", _("Status information"));



/*
* Get servicegroups list
*/
$query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg";
$DBRESULT = $pearDB->query($query);
$sgSearchSelect = '<select id="sg_search" name="sg_search"><option value=""></option>';
while ($row = $DBRESULT->fetchRow()) {
$sgSearchSelect .= '<option value="' . $row['sg_name'] . '">' . $row['sg_name'] .'</option>';
}
$DBRESULT->free();
$sgSearchSelect .= '</select>';
$tpl->assign("sgSearchSelect", $sgSearchSelect);


$form = new HTML_QuickForm('select_form', 'GET', "?p=".$p);


$tpl->assign("order", strtolower($order));
$tab_order = array("sort_asc" => "sort_desc", "sort_desc" => "sort_asc");
$tpl->assign("tab_order", $tab_order);






##Toolbar select $lang["lgd_more_actions"]
Expand Down Expand Up @@ -149,4 +165,4 @@ function setO(_i) {

$tpl->assign('form', $renderer->toArray());
$tpl->display("serviceGrid.ihtml");
?>
?>
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ function mainLoopLocal() {
}
}
_oldInputFieldValue = _currentInputFieldValue;

setTimeout("mainLoopLocal()", 250);
}

Expand All @@ -136,12 +135,19 @@ function initM(_time_reload, _sid, _o ){
construct_HostGroupSelectList('hostgroups_selected');

if (document.getElementById("host_search") && document.getElementById("host_search").value) {
_search = document.getElementById("host_search").value;
_host_search = document.getElementById("host_search").value;
viewDebugInfo('search: '+document.getElementById("host_search").value);
} else if (document.getElementById("host_search").lenght == 0) {
_search = "";
} else if (document.getElementById("host_search").value.length === 0) {
_host_search = "";
}


if (document.getElementById("sg_search") && document.getElementById("sg_search").value) {
_sg_search = document.getElementById("sg_search").value;
viewDebugInfo('search: '+document.getElementById("sg_search").value);
} else if (document.getElementById("sg_search").value.length === 0) {
_sg_search = "";
}

if (_first){
mainLoopLocal();
_first = 0;
Expand All @@ -157,12 +163,13 @@ function goM(_time_reload, _sid, _o) {
_lock = 1;
var proc = new Transformation();
proc.setCallback(monitoringCallBack);
proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time=<?php print time(); ?>');
proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time=<?php print time(); ?>');
proc.setXslt(_addrXSL);
proc.transform("forAjax");

if (_counter == 0) {
document.getElementById("host_search").value = _host_search;
document.getElementById("sg_search").value = _sg_search;
_counter += 1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@
!isset($_GET["search_type_service"]) ? $search_type_service = 1 : $search_type_service = $_GET["search_type_service"];
!isset($_GET["sort_type"]) ? $sort_type = "host_name" : $sort_type = $_GET["sort_type"];
!isset($_GET["host_search"]) ? $host_search = 0 : $host_search = $_GET["host_search"];
!isset($_GET["sg_search"]) ? $sg_search = 0 : $sg_search = $_GET["sg_search"];

/*
* Check search value in Host search field
*/
if (isset($_GET["host_search"])) {
$centreon->historySearch[$url] = $_GET["host_search"];
}

/*
* Check search value in Service Group search field
*/
if (isset($_GET["sg_search"])) {
$centreon->historySearch[$url] = $_GET["sg_search"];
}

$tab_class = array("0" => "list_one", "1" => "list_two");
$rows = 10;
Expand All @@ -75,10 +83,25 @@
$tpl->assign("mon_ip", _("IP"));
$tpl->assign("mon_last_check", _("Last Check"));
$tpl->assign("mon_duration", _("Duration"));
$tpl->assign('search', _('Search'));
$tpl->assign('search', _('Host'));
$tpl->assign('sgStr', _('Servicegroup'));
$tpl->assign('pollerStr', _('Poller'));
$tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing'));
$tpl->assign("mon_status_information", _("Status information"));


/*
* Get servicegroups list
*/
$query = "SELECT DISTINCT sg.sg_name FROM servicegroup sg";
$DBRESULT = $pearDB->query($query);
$sgSearchSelect = '<select id="sg_search" name="sg_search"><option value=""></option>';
while ($row = $DBRESULT->fetchRow()) {
$sgSearchSelect .= '<option value="' . $row['sg_name'] . '">' . $row['sg_name'] .'</option>';
}
$DBRESULT->free();
$sgSearchSelect .= '</select>';
$tpl->assign("sgSearchSelect", $sgSearchSelect);


$form = new HTML_QuickForm('select_form', 'GET', "?p=".$p);
Expand Down Expand Up @@ -148,4 +171,4 @@ function setO(_i) {

$tpl->assign('form', $renderer->toArray());
$tpl->display("serviceGrid.ihtml");
?>
?>
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function mainLoopLocal() {
if (!_lock) {
set_search_host(escapeURI(_currentInputFieldValue));
_host_search = _currentInputFieldValue;
_sg_search = _currentInputFieldValue;

monitoring_refresh();

Expand All @@ -115,7 +116,6 @@ function mainLoopLocal() {
}
}
_oldInputFieldValue = _currentInputFieldValue;

setTimeout("mainLoopLocal()", 250);
}

Expand All @@ -128,10 +128,17 @@ function initM(_time_reload, _sid, _o ){
if (document.getElementById("host_search") && document.getElementById("host_search").value) {
_host_search = document.getElementById("host_search").value;
viewDebugInfo('search: '+document.getElementById("host_search").value);
} else if (document.getElementById("host_search").lenght == 0) {
} else if (document.getElementById("host_search").value.length === 0) {
_host_search = "";
}


if (document.getElementById("sg_search") && document.getElementById("sg_search").value) {
_sg_search = document.getElementById("sg_search").value;
viewDebugInfo('search: '+document.getElementById("sg_search").value);
} else if (document.getElementById("sg_search").value.length == 0) {
_sg_search = "";
}

if (_first){
mainLoopLocal();
_first = 0;
Expand All @@ -147,12 +154,13 @@ function goM(_time_reload, _sid, _o) {
_lock = 1;
var proc = new Transformation();
proc.setCallback(monitoringCallBack);
proc.setXml(_addrXML+"?"+'sid='+_sid+'&search='+_host_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time=<?php print time(); ?>');
proc.setXml(_addrXML+"?"+'sid='+_sid+'&host_search='+_host_search+'&sg_search='+_sg_search+'&num='+_num+'&limit='+_limit+'&sort_type='+_sort_type+'&order='+_order+'&date_time_format_status='+_date_time_format_status+'&o='+_o+'&p='+_p+'&time=<?php print time(); ?>');
proc.setXslt(_addrXSL);
proc.transform("forAjax");

if (_counter == 0) {
document.getElementById("host_search").value = _host_search;
document.getElementById("sg_search").value = _sg_search;
_counter += 1;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
<form name='form'>
<input name="p" value="{$p}" type="hidden">
<input name="o" value="svc" type="hidden">
<table class="ajaxOption">
<tr>
<td>{$search}</td>
<td><input size="15" id="host_search" class="search_input" style="padding-top:1px;padding-bottom:1px;" name="host_search" type="text" /></td>
{if $poller_listing}
<td>{$pollerStr}:</td>
<td><span id="instance_selected"></span></td>
{/if}
<td>{$search}</td>
<td><input size="15" id="host_search" class="search_input" style="padding-top:1px;padding-bottom:1px;" name="host_search" type="text" /></td>
<td>{$sgStr}</td>
<td>{$sgSearchSelect}</td>
{if $poller_listing}
<td>{$pollerStr}:</td>
<td><span id="instance_selected"></span></td>
{/if}
</tr>
</table>
<br/>
<table class="ToolbarTable">
<tr class="ToolbarTR">
<td class="Toolbar_TDSelectAction_Top" width="300">
<span class="consol_button"><a id="JS_monitoring_refresh" href="#" onclick="javascript:monitoring_refresh('');"><img src='./img/icones/16x16/refresh.gif' alt='Refresh' title='Refresh'></a></span>
<span class="consol_button"><a id="JS_monitoring_play" class="cachediv" href="#" onclick="javascript:monitoring_play('');"><img src='./img/icones/16x16/media_play.gif' alt='Play' title='Play'></a></span>
<span class="consol_button"><img id="JS_monitoring_play_gray" src='./img/icones/16x16/media_play_gray.gif' alt='Play' title='Play'></span>
<span class="consol_button"><a class="" id="JS_monitoring_pause" href="#" onclick="javascript:monitoring_pause('');"><img src='./img/icones/16x16/media_pause.gif' alt='Pause' title='Pause'></a></span>
<span class="consol_button"><img id="JS_monitoring_pause_gray" class="cachediv" src='./img/icones/16x16/media_pause_gray.gif' alt='Pause' title='Pause'></span>
<span class="consol_button" id="instance_selected"></span>
<input name="p" value="{$p}" type="hidden">
<span class="consol_button"><a id="JS_monitoring_refresh" href="#" onclick="javascript:monitoring_refresh('');"><img src='./img/icones/16x16/refresh.gif' alt='Refresh' title='Refresh'></a></span>
<span class="consol_button"><a id="JS_monitoring_play" class="cachediv" href="#" onclick="javascript:monitoring_play('');"><img src='./img/icones/16x16/media_play.gif' alt='Play' title='Play'></a></span>
<span class="consol_button"><img id="JS_monitoring_play_gray" src='./img/icones/16x16/media_play_gray.gif' alt='Play' title='Play'></span>
<span class="consol_button"><a class="" id="JS_monitoring_pause" href="#" onclick="javascript:monitoring_pause('');"><img src='./img/icones/16x16/media_pause.gif' alt='Pause' title='Pause'></a></span>
<span class="consol_button"><img id="JS_monitoring_pause_gray" class="cachediv" src='./img/icones/16x16/media_pause_gray.gif' alt='Pause' title='Pause'></span>
<span class="consol_button" id="instance_selected"></span>
<input name="p" value="{$p}" type="hidden">
</td>
<td id="pagination1" class="ToolbarPagination"></td>
<td id="sel1" class="Toolbar_pagelimit"></td>
Expand All @@ -36,11 +35,10 @@
<td id="sel2" class="Toolbar_pagelimit"></td>
</tr>
</table>
{if $host_name}
<input type='hidden' name='host_name' value='{$host_name}'>
{/if}
<input name='cmd' id='cmd' value='42' type='hidden'>
<input name='o' value='{$o}' type='hidden'>
<input type='hidden' id='limit' name='limit' value='{$limit}'>
{$form.hidden}
</form>
<script type="text/javascript">
{literal}
jQuery("#sg_search").on('change', function(){
monitoring_refresh();
});
{/literal}
</script>
Loading

0 comments on commit fe446b8

Please sign in to comment.