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

Commit

Permalink
Fix a Javascript bug when the new header is selected
Browse files Browse the repository at this point in the history
The new header does not have the same identifier (header-react). Creating a variable containing the header identifier based on the selected header version.
  • Loading branch information
callapa committed Sep 4, 2018
1 parent 0c5e251 commit 93b303f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion www/include/monitoring/status/Common/commonJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,20 @@
include_once "./include/monitoring/status/Common/default_poller.php";
}

// Get the current header version to define the correct header id in javascript
$headerVersion = 1;
$userFeatures = $centreonFeature->userFeaturesValue(
$centreon->user->get_id()
);
foreach($userFeatures as $feature) {
if($feature['name'] == 'Header' && $feature['enabled'] == 1) {
$headerVersion = (int) $feature['version'];
}
}

?>
// Dynamique
var _headerId='<?= ($headerVersion == 1) ? 'header' : 'header-react'?>';
var _sid='<?php echo $sid?>';
<?php if (isset($search_type_host)) { ?>
var _search_type_host='<?php echo $search_type_host?>';
Expand Down Expand Up @@ -1015,7 +1027,7 @@ function initM(_time_reload, _sid, _o) {
var _debugtr = document.createElement("tr");
_debugtable.appendChild(_debugtr);
_divdebug.appendChild(_debugtable);
_header = document.getElementById('header');
var _header = document.getElementById(_headerId);
_header.appendChild(_divdebug);
}

Expand Down

0 comments on commit 93b303f

Please sign in to comment.