UI/Sparklines: Change sparkline code to serverside only

fixes #6124
This commit is contained in:
Marius Hein 2014-06-06 16:35:33 +02:00
parent 4587f26476
commit 06296f29d8
4 changed files with 4 additions and 35 deletions

View File

@ -50,10 +50,14 @@ class InlinePie extends AbstractWidget
* @var string
*/
private $template =<<<'EOD'
<span class="sparkline" sparkTitle="{title}" sparkWidth="{width}" sparkHeight="{height}" style="{style}"
sparkSliceColors="[{colors}]" values="{data}" sparkType="pie"></span>
<noscript>
<img class="inlinepie"
title="{title}" src="{url}" style="width: {width}px; height: {height}px; {style}"
data-icinga-colors="{colors}" data-icinga-values="{data}"
/>
</noscript>
EOD;
/**

View File

@ -69,10 +69,6 @@
$('input.autofocus', el).focus();
$('img.inlinepie', el).each(function() {
icinga.ui.initializeSparklines($(this));
});
// replace all sparklines
$('span.sparkline', el).sparkline('html', { enableTagOptions: true });

View File

@ -409,11 +409,6 @@
this.icinga.ui.initializeTriStates($resp);
// Replace images with sparklines.
$resp.find('img.inlinepie').each(function(){
self.icinga.ui.initializeSparklines($(this));
});
/* Should we try to fiddle with responses containing full HTML? */
/*
if ($('body', $resp).length) {

View File

@ -631,32 +631,6 @@
}
},
/**
* Search and replace all inlinepies with html for sparklines.
*
* @param parent
*/
initializeSparklines: function($container) {
// replace all remaining images with sparklines
var title = $container.attr('title'),
values = $container.data('icinga-values'),
colors = $container.data('icinga-colors'),
width = $container.css('width'),
height = $container.css('height');
if (!values) {
return;
}
$container.replaceWith(
'<span sparkTitle="' + title +
'" sparkWidth="' + width +
'" sparkHeight="' + height +
'" sparkType="pie" sparkSliceColors="[' +
colors + ']" values="' +
values + '" class="sparkline"></span>'
);
},
initializeControls: function (parent) {
var self = this;