Private GIT

Skip to content
Snippets Groups Projects
Commit 8b86683b authored by Maximilien Bersoult's avatar Maximilien Bersoult
Browse files

Change to new chart style on object detail

parent bf13b9b6
Branches
Tags
No related merge requests found
......@@ -316,7 +316,7 @@ if (!$is_admin && !$haveAccess) {
/* Get Graphs Listing */
$graphLists = array();
$query = "SELECT DISTINCT id, host_name, service_description " .
$query = "SELECT DISTINCT id, host_name, service_description, host_id, service_id " .
" FROM index_data, metrics " . ((!$is_admin) ? ', centreon_acl acl' : '') .
" WHERE metrics.index_id = index_data.id " .
" AND index_data.host_id = '$host_id' ".
......@@ -324,7 +324,7 @@ if (!$is_admin && !$haveAccess) {
" ORDER BY service_description ASC";
$DBRESULT = $pearDBO->query($query);
while ($g = $DBRESULT->fetchRow()) {
$graphLists[$g["id"]] = $g['host_name'].";".$g['service_description'];
$graphLists[$g["host_id"] . '_' . $g['service_id']] = $g['host_name'].";".$g['service_description'];
}
$host_status[$host_name]["status_class"] = $tab_color_host[strtolower($host_status[$host_name]["current_state"])];
......
<link href="./include/common/javascript/charts/c3.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
<table class="table">
<tr>
......@@ -83,7 +84,10 @@
{foreach key=graphId item=HS from=$graphs}
<tr>
<td class="ListColLeft ColPopup" style='text-align:center;'>
<a href='./main.php?p=204&mode=0&svc_id={$HS}'><img src='./include/views/graphs/generateGraphs/generateImage.php?index={$graphId}&start={$start}&end={$end}'></a>
<a href='./main.php?p=204&mode=0&svc_id={$HS}'>
<div class="chart" data-graph-id="{$graphId}" data-graph-type="service">
</div>
</a>
</td>
</tr>
{/foreach}
......@@ -476,3 +480,21 @@
</td>
</tr>
</table>
<script src="./include/common/javascript/moment-with-locales.js"></script>
<script src="./include/common/javascript/moment-timezone-with-data.min.js"></script>
<script src="./include/common/javascript/charts/d3.min.js"></script>
<script src="./include/common/javascript/charts/c3.min.js"></script>
<script src="./include/common/javascript/charts/d3-timeline.js"></script>
<script src="./include/views/graphs/javascript/centreon-graph.js"></script>
<script src="./include/views/graphs/javascript/centreon-c3.js"></script>
{literal}
<script>
jQuery(function () {
var times = {
height: 240,
interval: '12h'
};
jQuery('.chart').centreonGraph(times);
});
</script>
{/literal}
\ No newline at end of file
<link href="./include/common/javascript/charts/c3.min.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
<table class="table"> <!-- Global Table -->
<tr>
......@@ -142,7 +143,12 @@
<h4>{$detailed_graph}</h4></td>
</tr>
<tr class='list_one'>
<td class="ListColCenter" colspan="2"><a href="./main.php?p=20401&mode=0&svc_id={$host_name};{$svc_description}"><img src="./include/views/graphs/generateGraphs/generateImage.php?{$options2}"></a></td>
<td class="ListColCenter" colspan="2">
<a href="./main.php?p=20401&mode=0&svc_id={$host_name};{$svc_description}">
<div class="chart" id="chart-detailed" data-graph-id="{$h.host_id}_{$service_id}" data-graph-type="service">
</div>
</a>
</td>
</tr>
</table>
{/if}
......@@ -213,7 +219,6 @@
<td class="ColPopup">
{if $lcaTopo.307 || $admin == 1}
<a href='./main.php?p=307&host={$h.host_id}'>{$lnk_host_reports}</a>
</p>
{/if}
</td>
......@@ -451,7 +456,7 @@
<td class="ListColLeft ColPopup">{$servicegroups_label}</td>
<td class="ListColLeft ColPopup">
{foreach item=sg from=$servicegroups}
&nbsp;&nbsp;&nbsp;-&nbsp;{$sg}</a><br>
&nbsp;&nbsp;&nbsp;-&nbsp;{$sg}<br>
{/foreach}
</td>
</tr>
......@@ -567,3 +572,21 @@
{/foreach}
</table>
{/if}
<script src="./include/common/javascript/moment-with-locales.js"></script>
<script src="./include/common/javascript/moment-timezone-with-data.min.js"></script>
<script src="./include/common/javascript/charts/d3.min.js"></script>
<script src="./include/common/javascript/charts/c3.min.js"></script>
<script src="./include/common/javascript/charts/d3-timeline.js"></script>
<script src="./include/views/graphs/javascript/centreon-graph.js"></script>
<script src="./include/views/graphs/javascript/centreon-c3.js"></script>
{literal}
<script>
jQuery(function () {
var times = {
height: 240,
interval: '24h'
};
jQuery('#chart-detailed').centreonGraph(times);
});
</script>
{/literal}
......@@ -16,6 +16,17 @@
unit: parseInterval[2]
};
if ($elem.attr('id') === undefined) {
$elem.attr('id', function () {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return 'c' + s4() + s4() + s4() + s4();
});
}
/* Define tick for timeseries */
this.timeFormat = d3.time.format.multi([
[".%L", function(d) { return d.getMilliseconds(); }],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment