Merge remote-tracking branch 'origin/develop' into ent-4559-desajuste-en-custom-fields
This commit is contained in:
commit
5973c0b350
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-agent-unix
|
package: pandorafms-agent-unix
|
||||||
Version: 7.0NG.738-190827
|
Version: 7.0NG.738-190828
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190827"
|
pandora_version="7.0NG.738-190828"
|
||||||
|
|
||||||
echo "Test if you has the tools for to make the packages."
|
echo "Test if you has the tools for to make the packages."
|
||||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||||
|
|
|
@ -42,7 +42,7 @@ my $Sem = undef;
|
||||||
my $ThreadSem = undef;
|
my $ThreadSem = undef;
|
||||||
|
|
||||||
use constant AGENT_VERSION => '7.0NG.738';
|
use constant AGENT_VERSION => '7.0NG.738';
|
||||||
use constant AGENT_BUILD => '190827';
|
use constant AGENT_BUILD => '190828';
|
||||||
|
|
||||||
# Agent log default file size maximum and instances
|
# Agent log default file size maximum and instances
|
||||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_agent_unix
|
%define name pandorafms_agent_unix
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
Summary: Pandora FMS Linux agent, PERL version
|
Summary: Pandora FMS Linux agent, PERL version
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.738"
|
PI_VERSION="7.0NG.738"
|
||||||
PI_BUILD="190827"
|
PI_BUILD="190828"
|
||||||
OS_NAME=`uname -s`
|
OS_NAME=`uname -s`
|
||||||
|
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
|
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Version
|
Version
|
||||||
{190827}
|
{190828}
|
||||||
|
|
||||||
ViewReadme
|
ViewReadme
|
||||||
{Yes}
|
{Yes}
|
||||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("7.0NG.738(Build 190827)")
|
#define PANDORA_VERSION ("7.0NG.738(Build 190828)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
VALUE "LegalCopyright", "Artica ST"
|
VALUE "LegalCopyright", "Artica ST"
|
||||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||||
VALUE "ProductVersion", "(7.0NG.738(Build 190827))"
|
VALUE "ProductVersion", "(7.0NG.738(Build 190828))"
|
||||||
VALUE "FileVersion", "1.0.0.0"
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-console
|
package: pandorafms-console
|
||||||
Version: 7.0NG.738-190827
|
Version: 7.0NG.738-190828
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190827"
|
pandora_version="7.0NG.738-190828"
|
||||||
|
|
||||||
package_pear=0
|
package_pear=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 30);
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 31);
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
|
||||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
/**
|
/**
|
||||||
* Pandora build version and version
|
* Pandora build version and version
|
||||||
*/
|
*/
|
||||||
$build_version = 'PC190827';
|
$build_version = 'PC190828';
|
||||||
$pandora_version = 'v7.0NG.738';
|
$pandora_version = 'v7.0NG.738';
|
||||||
|
|
||||||
// Do not overwrite default timezone set if defined.
|
// Do not overwrite default timezone set if defined.
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ function events_get_all(
|
||||||
ON ts.id = te.server_id';
|
ON ts.id = te.server_id';
|
||||||
if (!empty($filter['server_id'])) {
|
if (!empty($filter['server_id'])) {
|
||||||
$server_join = sprintf(
|
$server_join = sprintf(
|
||||||
' LEFT JOIN tmetaconsole_setup ts
|
' INNER JOIN tmetaconsole_setup ts
|
||||||
ON ts.id = te.server_id AND ts.id= %d',
|
ON ts.id = te.server_id AND ts.id= %d',
|
||||||
$filter['server_id']
|
$filter['server_id']
|
||||||
);
|
);
|
||||||
|
|
|
@ -56,7 +56,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
// Maximum redraw attempts when fitting labels within the plot
|
// Maximum redraw attempts when fitting labels within the plot
|
||||||
|
|
||||||
var REDRAW_ATTEMPTS = 10;
|
var REDRAW_ATTEMPTS = 10;
|
||||||
|
@ -66,7 +65,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
var REDRAW_SHRINK = 0.95;
|
var REDRAW_SHRINK = 0.95;
|
||||||
|
|
||||||
function init(plot) {
|
function init(plot) {
|
||||||
|
|
||||||
var canvas = null,
|
var canvas = null,
|
||||||
target = null,
|
target = null,
|
||||||
options = null,
|
options = null,
|
||||||
|
@ -84,7 +82,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
plot.hooks.processOptions.push(function(plot, options) {
|
plot.hooks.processOptions.push(function(plot, options) {
|
||||||
if (options.series.pie.show) {
|
if (options.series.pie.show) {
|
||||||
|
|
||||||
options.grid.show = false;
|
options.grid.show = false;
|
||||||
|
|
||||||
// set labels.show
|
// set labels.show
|
||||||
|
@ -150,7 +147,7 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function processDatapoints(plot, series, datapoints) {
|
function processDatapoints(plot) {
|
||||||
if (!processed) {
|
if (!processed) {
|
||||||
processed = true;
|
processed = true;
|
||||||
canvas = plot.getCanvas();
|
canvas = plot.getCanvas();
|
||||||
|
@ -161,7 +158,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
|
|
||||||
function combine(data) {
|
function combine(data) {
|
||||||
|
|
||||||
var total = 0,
|
var total = 0,
|
||||||
combined = 0,
|
combined = 0,
|
||||||
numCombined = 0,
|
numCombined = 0,
|
||||||
|
@ -171,7 +167,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
// Fix up the raw data from Flot, ensuring the data is numeric
|
// Fix up the raw data from Flot, ensuring the data is numeric
|
||||||
|
|
||||||
for (var i = 0; i < data.length; ++i) {
|
for (var i = 0; i < data.length; ++i) {
|
||||||
|
|
||||||
var value = data[i].data;
|
var value = data[i].data;
|
||||||
|
|
||||||
// If the data is an array, we'll assume that it's a standard
|
// If the data is an array, we'll assume that it's a standard
|
||||||
|
@ -223,14 +218,18 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
for (var i = 0; i < data.length; ++i) {
|
for (var i = 0; i < data.length; ++i) {
|
||||||
var value = data[i].data[0][1];
|
var value = data[i].data[0][1];
|
||||||
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
if (
|
||||||
|
numCombined < 2 ||
|
||||||
|
value / total > options.series.pie.combine.threshold
|
||||||
|
) {
|
||||||
newdata.push(
|
newdata.push(
|
||||||
$.extend(data[i], { /* extend to allow keeping all other original data values
|
$.extend(data[i], {
|
||||||
|
/* extend to allow keeping all other original data values
|
||||||
and using them e.g. in labelFormatter. */
|
and using them e.g. in labelFormatter. */
|
||||||
data: [[1, value]],
|
data: [[1, value]],
|
||||||
color: data[i].color,
|
color: data[i].color,
|
||||||
label: data[i].label,
|
label: data[i].label,
|
||||||
angle: value * Math.PI * 2 / total,
|
angle: (value * Math.PI * 2) / total,
|
||||||
percent: value / (total / 100)
|
percent: value / (total / 100)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -242,7 +241,7 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
data: [[1, combined]],
|
data: [[1, combined]],
|
||||||
color: color,
|
color: color,
|
||||||
label: options.series.pie.combine.label,
|
label: options.series.pie.combine.label,
|
||||||
angle: combined * Math.PI * 2 / total,
|
angle: (combined * Math.PI * 2) / total,
|
||||||
percent: combined / (total / 100)
|
percent: combined / (total / 100)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -251,14 +250,18 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
|
|
||||||
function draw(plot, newCtx) {
|
function draw(plot, newCtx) {
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return; // if no series were passed
|
return; // if no series were passed
|
||||||
}
|
}
|
||||||
|
|
||||||
var canvasWidth = plot.getPlaceholder().width(),
|
var canvasWidth = plot.getPlaceholder().width(),
|
||||||
canvasHeight = plot.getPlaceholder().height(),
|
canvasHeight = plot.getPlaceholder().height(),
|
||||||
legendWidth = target.children().filter(".legend").children().width() || 0;
|
legendWidth =
|
||||||
|
target
|
||||||
|
.children()
|
||||||
|
.filter(".legend")
|
||||||
|
.children()
|
||||||
|
.width() || 0;
|
||||||
|
|
||||||
ctx = newCtx;
|
ctx = newCtx;
|
||||||
|
|
||||||
|
@ -287,7 +290,8 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
// calculate maximum radius and center point
|
// calculate maximum radius and center point
|
||||||
|
|
||||||
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
maxRadius =
|
||||||
|
Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
||||||
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
||||||
centerLeft = canvasWidth / 2;
|
centerLeft = canvasWidth / 2;
|
||||||
|
|
||||||
|
@ -321,11 +325,13 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
if (options.series.pie.tilt <= 0.8) {
|
if (options.series.pie.tilt <= 0.8) {
|
||||||
drawShadow();
|
drawShadow();
|
||||||
}
|
}
|
||||||
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
} while (!drawPie() && attempts < REDRAW_ATTEMPTS);
|
||||||
|
|
||||||
if (attempts >= REDRAW_ATTEMPTS) {
|
if (attempts >= REDRAW_ATTEMPTS) {
|
||||||
clear();
|
clear();
|
||||||
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
target.prepend(
|
||||||
|
"<div class='error'>Could not draw pie with labels contained inside canvas</div>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plot.setSeries && plot.insertLegend) {
|
if (plot.setSeries && plot.insertLegend) {
|
||||||
|
@ -337,18 +343,27 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
||||||
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
target
|
||||||
|
.children()
|
||||||
|
.filter(".pieLabel, .pieLabelBackground")
|
||||||
|
.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawShadow() {
|
function drawShadow() {
|
||||||
|
|
||||||
var shadowLeft = options.series.pie.shadow.left;
|
var shadowLeft = options.series.pie.shadow.left;
|
||||||
var shadowTop = options.series.pie.shadow.top;
|
var shadowTop = options.series.pie.shadow.top;
|
||||||
var edge = 10;
|
var edge = 10;
|
||||||
var alpha = options.series.pie.shadow.alpha;
|
var alpha = options.series.pie.shadow.alpha;
|
||||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
var radius =
|
||||||
|
options.series.pie.radius > 1
|
||||||
|
? options.series.pie.radius
|
||||||
|
: maxRadius * options.series.pie.radius;
|
||||||
|
|
||||||
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
if (
|
||||||
|
radius >= canvasWidth / 2 - shadowLeft ||
|
||||||
|
radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop ||
|
||||||
|
radius <= edge
|
||||||
|
) {
|
||||||
return; // shadow would be outside canvas, so don't draw it
|
return; // shadow would be outside canvas, so don't draw it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,9 +390,11 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawPie() {
|
function drawPie() {
|
||||||
|
|
||||||
var startAngle = Math.PI * options.series.pie.startAngle;
|
var startAngle = Math.PI * options.series.pie.startAngle;
|
||||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
var radius =
|
||||||
|
options.series.pie.radius > 1
|
||||||
|
? options.series.pie.radius
|
||||||
|
: maxRadius * options.series.pie.radius;
|
||||||
|
|
||||||
// center and rotate to starting position
|
// center and rotate to starting position
|
||||||
|
|
||||||
|
@ -421,7 +438,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
} else return true;
|
} else return true;
|
||||||
|
|
||||||
function drawSlice(angle, color, fill) {
|
function drawSlice(angle, color, fill) {
|
||||||
|
|
||||||
if (angle <= 0 || isNaN(angle)) {
|
if (angle <= 0 || isNaN(angle)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +456,14 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
||||||
ctx.arc(0, 0, radius, currentAngle, currentAngle + angle / 2, false);
|
ctx.arc(0, 0, radius, currentAngle, currentAngle + angle / 2, false);
|
||||||
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
ctx.arc(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
radius,
|
||||||
|
currentAngle + angle / 2,
|
||||||
|
currentAngle + angle,
|
||||||
|
false
|
||||||
|
);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
//ctx.rotate(angle); // This doesn't work properly in Opera
|
//ctx.rotate(angle); // This doesn't work properly in Opera
|
||||||
currentAngle += angle;
|
currentAngle += angle;
|
||||||
|
@ -453,9 +476,12 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawLabels() {
|
function drawLabels() {
|
||||||
|
var labels = [];
|
||||||
var currentAngle = startAngle;
|
var currentAngle = startAngle;
|
||||||
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
var radius =
|
||||||
|
options.series.pie.label.radius > 1
|
||||||
|
? options.series.pie.label.radius
|
||||||
|
: maxRadius * options.series.pie.label.radius;
|
||||||
|
|
||||||
for (var i = 0; i < slices.length; ++i) {
|
for (var i = 0; i < slices.length; ++i) {
|
||||||
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
||||||
|
@ -469,14 +495,15 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
function drawLabel(slice, startAngle, index) {
|
function drawLabel(slice, startAngle, index) {
|
||||||
|
|
||||||
if (slice.data[0][1] == 0) {
|
if (slice.data[0][1] == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// format label text
|
// format label text
|
||||||
|
|
||||||
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
var lf = options.legend.labelFormatter,
|
||||||
|
text,
|
||||||
|
plf = options.series.pie.label.formatter;
|
||||||
|
|
||||||
if (lf) {
|
if (lf) {
|
||||||
text = lf(slice.label, slice);
|
text = lf(slice.label, slice);
|
||||||
|
@ -488,28 +515,76 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
text = plf(text, slice);
|
text = plf(text, slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
var halfAngle = (startAngle + slice.angle + startAngle) / 2;
|
||||||
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
||||||
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
var y =
|
||||||
|
centerTop +
|
||||||
|
Math.round(Math.sin(halfAngle) * radius) *
|
||||||
|
options.series.pie.tilt;
|
||||||
|
|
||||||
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
var html =
|
||||||
|
"<span class='pieLabel' id='pieLabel" +
|
||||||
|
index +
|
||||||
|
"' style='position:absolute;top:" +
|
||||||
|
y +
|
||||||
|
"px;left:" +
|
||||||
|
x +
|
||||||
|
"px;'>" +
|
||||||
|
text +
|
||||||
|
"</span>";
|
||||||
target.append(html);
|
target.append(html);
|
||||||
|
|
||||||
var label = target.children("#pieLabel" + index);
|
var label = target.children("#pieLabel" + index);
|
||||||
var labelTop = (y - label.height() / 2);
|
var labelTop = y - label.height() / 2;
|
||||||
var labelLeft = (x - label.width() / 2);
|
var labelLeft = x - label.width() / 2;
|
||||||
|
|
||||||
label.css("top", labelTop);
|
label.css("top", labelTop);
|
||||||
label.css("left", labelLeft);
|
label.css("left", labelLeft);
|
||||||
|
|
||||||
|
// check to make sure that the label doesn't overlap one of the other labels
|
||||||
|
var label_pos = getPositions(label);
|
||||||
|
for (var j = 0; j < labels.length; j++) {
|
||||||
|
var tmpPos = getPositions(labels[j]);
|
||||||
|
var horizontalMatch = comparePositions(label_pos[0], tmpPos[0]);
|
||||||
|
var verticalMatch = comparePositions(label_pos[1], tmpPos[1]);
|
||||||
|
var match = horizontalMatch && verticalMatch;
|
||||||
|
if (match) {
|
||||||
|
var newTop = tmpPos[1][0] - (label.height() + 1);
|
||||||
|
label.css("top", newTop);
|
||||||
|
labelTop = newTop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositions(box) {
|
||||||
|
var $box = $(box);
|
||||||
|
var pos = $box.position();
|
||||||
|
var width = $box.width();
|
||||||
|
var height = $box.height();
|
||||||
|
return [
|
||||||
|
[pos.left, pos.left + width],
|
||||||
|
[pos.top, pos.top + height]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function comparePositions(p1, p2) {
|
||||||
|
var x1 = p1[0] < p2[0] ? p1 : p2;
|
||||||
|
var x2 = p1[0] < p2[0] ? p2 : p1;
|
||||||
|
return x1[1] > x2[0] || x1[0] === x2[0] ? true : false;
|
||||||
|
}
|
||||||
|
labels.push(label);
|
||||||
|
|
||||||
// check to make sure that the label is not outside the canvas
|
// check to make sure that the label is not outside the canvas
|
||||||
|
|
||||||
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
if (
|
||||||
|
0 - labelTop > 0 ||
|
||||||
|
0 - labelLeft > 0 ||
|
||||||
|
canvasHeight - (labelTop + label.height()) < 0 ||
|
||||||
|
canvasWidth - (labelLeft + label.width()) < 0
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.series.pie.label.background.opacity != 0) {
|
if (options.series.pie.label.background.opacity != 0) {
|
||||||
|
|
||||||
// put in the transparent background separately to avoid blended labels and label boxes
|
// put in the transparent background separately to avoid blended labels and label boxes
|
||||||
|
|
||||||
var c = options.series.pie.label.background.color;
|
var c = options.series.pie.label.background.color;
|
||||||
|
@ -519,7 +594,17 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
||||||
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
$(
|
||||||
|
"<div class='pieLabelBackground' style='position:absolute;width:" +
|
||||||
|
label.width() +
|
||||||
|
"px;height:" +
|
||||||
|
label.height() +
|
||||||
|
"px;" +
|
||||||
|
pos +
|
||||||
|
"background-color:" +
|
||||||
|
c +
|
||||||
|
";'></div>"
|
||||||
|
)
|
||||||
.css("opacity", options.series.pie.label.background.opacity)
|
.css("opacity", options.series.pie.label.background.opacity)
|
||||||
.insertBefore(label);
|
.insertBefore(label);
|
||||||
}
|
}
|
||||||
|
@ -534,11 +619,13 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
function drawDonutHole(layer) {
|
function drawDonutHole(layer) {
|
||||||
if (options.series.pie.innerRadius > 0) {
|
if (options.series.pie.innerRadius > 0) {
|
||||||
|
|
||||||
// subtract the center
|
// subtract the center
|
||||||
|
|
||||||
layer.save();
|
layer.save();
|
||||||
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
var innerRadius =
|
||||||
|
options.series.pie.innerRadius > 1
|
||||||
|
? options.series.pie.innerRadius
|
||||||
|
: maxRadius * options.series.pie.innerRadius;
|
||||||
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
||||||
layer.beginPath();
|
layer.beginPath();
|
||||||
layer.fillStyle = options.series.pie.stroke.color;
|
layer.fillStyle = options.series.pie.stroke.color;
|
||||||
|
@ -565,31 +652,50 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
|
|
||||||
function isPointInPoly(poly, pt) {
|
function isPointInPoly(poly, pt) {
|
||||||
for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
||||||
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) ||
|
||||||
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
(poly[j][1] <= pt[1] && pt[1] < poly[i][1])) &&
|
||||||
&& (c = !c);
|
pt[0] <
|
||||||
|
((poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1])) /
|
||||||
|
(poly[j][1] - poly[i][1]) +
|
||||||
|
poly[i][0] &&
|
||||||
|
(c = !c);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
function findNearbySlice(mouseX, mouseY) {
|
function findNearbySlice(mouseX, mouseY) {
|
||||||
|
|
||||||
var slices = plot.getData(),
|
var slices = plot.getData(),
|
||||||
options = plot.getOptions(),
|
options = plot.getOptions(),
|
||||||
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
radius =
|
||||||
x, y;
|
options.series.pie.radius > 1
|
||||||
|
? options.series.pie.radius
|
||||||
|
: maxRadius * options.series.pie.radius,
|
||||||
|
x,
|
||||||
|
y;
|
||||||
|
|
||||||
for (var i = 0; i < slices.length; ++i) {
|
for (var i = 0; i < slices.length; ++i) {
|
||||||
|
|
||||||
var s = slices[i];
|
var s = slices[i];
|
||||||
|
|
||||||
if (s.pie.show) {
|
if (s.pie.show) {
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, 0); // Center of the pie
|
ctx.moveTo(0, 0); // Center of the pie
|
||||||
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
||||||
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
ctx.arc(
|
||||||
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
0,
|
||||||
|
0,
|
||||||
|
radius,
|
||||||
|
s.startAngle,
|
||||||
|
s.startAngle + s.angle / 2,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
ctx.arc(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
radius,
|
||||||
|
s.startAngle + s.angle / 2,
|
||||||
|
s.startAngle + s.angle,
|
||||||
|
false
|
||||||
|
);
|
||||||
ctx.closePath();
|
ctx.closePath();
|
||||||
x = mouseX - centerLeft;
|
x = mouseX - centerLeft;
|
||||||
y = mouseY - centerTop;
|
y = mouseY - centerTop;
|
||||||
|
@ -605,7 +711,6 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
||||||
|
|
||||||
var p1X = radius * Math.cos(s.startAngle),
|
var p1X = radius * Math.cos(s.startAngle),
|
||||||
|
@ -618,7 +723,14 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
||||||
p5X = radius * Math.cos(s.startAngle + s.angle),
|
p5X = radius * Math.cos(s.startAngle + s.angle),
|
||||||
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
||||||
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
arrPoly = [
|
||||||
|
[0, 0],
|
||||||
|
[p1X, p1Y],
|
||||||
|
[p2X, p2Y],
|
||||||
|
[p3X, p3Y],
|
||||||
|
[p4X, p4Y],
|
||||||
|
[p5X, p5Y]
|
||||||
|
],
|
||||||
arrPoint = [x, y];
|
arrPoint = [x, y];
|
||||||
|
|
||||||
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
||||||
|
@ -652,14 +764,12 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
// trigger click or hover event (they send the same parameters so we share their code)
|
// trigger click or hover event (they send the same parameters so we share their code)
|
||||||
|
|
||||||
function triggerClickHoverEvent(eventname, e) {
|
function triggerClickHoverEvent(eventname, e) {
|
||||||
|
|
||||||
var offset = plot.offset();
|
var offset = plot.offset();
|
||||||
var canvasX = parseInt(e.pageX - offset.left);
|
var canvasX = parseInt(e.pageX - offset.left);
|
||||||
var canvasY = parseInt(e.pageY - offset.top);
|
var canvasY = parseInt(e.pageY - offset.top);
|
||||||
var item = findNearbySlice(canvasX, canvasY);
|
var item = findNearbySlice(canvasX, canvasY);
|
||||||
|
|
||||||
if (options.grid.autoHighlight) {
|
if (options.grid.autoHighlight) {
|
||||||
|
|
||||||
// clear auto-highlights
|
// clear auto-highlights
|
||||||
|
|
||||||
for (var i = 0; i < highlights.length; ++i) {
|
for (var i = 0; i < highlights.length; ++i) {
|
||||||
|
@ -718,17 +828,18 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
function indexOfHighlight(s) {
|
function indexOfHighlight(s) {
|
||||||
for (var i = 0; i < highlights.length; ++i) {
|
for (var i = 0; i < highlights.length; ++i) {
|
||||||
var h = highlights[i];
|
var h = highlights[i];
|
||||||
if (h.series == s)
|
if (h.series == s) return i;
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawOverlay(plot, octx) {
|
function drawOverlay(plot, octx) {
|
||||||
|
|
||||||
var options = plot.getOptions();
|
var options = plot.getOptions();
|
||||||
|
|
||||||
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
var radius =
|
||||||
|
options.series.pie.radius > 1
|
||||||
|
? options.series.pie.radius
|
||||||
|
: maxRadius * options.series.pie.radius;
|
||||||
|
|
||||||
octx.save();
|
octx.save();
|
||||||
octx.translate(centerLeft, centerTop);
|
octx.translate(centerLeft, centerTop);
|
||||||
|
@ -743,19 +854,33 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
octx.restore();
|
octx.restore();
|
||||||
|
|
||||||
function drawHighlight(series) {
|
function drawHighlight(series) {
|
||||||
|
|
||||||
if (series.angle <= 0 || isNaN(series.angle)) {
|
if (series.angle <= 0 || isNaN(series.angle)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
||||||
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
octx.fillStyle =
|
||||||
|
"rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
||||||
octx.beginPath();
|
octx.beginPath();
|
||||||
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
||||||
octx.moveTo(0, 0); // Center of the pie
|
octx.moveTo(0, 0); // Center of the pie
|
||||||
}
|
}
|
||||||
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
octx.arc(
|
||||||
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
0,
|
||||||
|
0,
|
||||||
|
radius,
|
||||||
|
series.startAngle,
|
||||||
|
series.startAngle + series.angle / 2,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
octx.arc(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
radius,
|
||||||
|
series.startAngle + series.angle / 2,
|
||||||
|
series.startAngle + series.angle,
|
||||||
|
false
|
||||||
|
);
|
||||||
octx.closePath();
|
octx.closePath();
|
||||||
octx.fill();
|
octx.fill();
|
||||||
}
|
}
|
||||||
|
@ -769,7 +894,7 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
pie: {
|
pie: {
|
||||||
show: false,
|
show: false,
|
||||||
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
||||||
innerRadius: 0, /* for donut */
|
innerRadius: 0 /* for donut */,
|
||||||
startAngle: 3 / 2,
|
startAngle: 3 / 2,
|
||||||
tilt: 1,
|
tilt: 1,
|
||||||
shadow: {
|
shadow: {
|
||||||
|
@ -788,7 +913,15 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
label: {
|
label: {
|
||||||
show: "auto",
|
show: "auto",
|
||||||
formatter: function(label, slice) {
|
formatter: function(label, slice) {
|
||||||
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
return (
|
||||||
|
"<div style='font-size:x-small;text-align:center;padding:2px;color:" +
|
||||||
|
slice.color +
|
||||||
|
";'>" +
|
||||||
|
label +
|
||||||
|
"<br/>" +
|
||||||
|
Math.round(slice.percent) +
|
||||||
|
"%</div>"
|
||||||
|
);
|
||||||
}, // formatter function
|
}, // formatter function
|
||||||
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
||||||
background: {
|
background: {
|
||||||
|
@ -816,5 +949,4 @@ More detail and specific examples can be found in the included HTML file.
|
||||||
name: "pie",
|
name: "pie",
|
||||||
version: "1.1"
|
version: "1.1"
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* global $ */
|
/* global $ */
|
||||||
|
/* exported pandoraFlotPie, pandoraFlotPieCustom */
|
||||||
|
|
||||||
function pandoraFlotPie(
|
function pandoraFlotPie(
|
||||||
graph_id,
|
graph_id,
|
||||||
|
@ -14,7 +15,7 @@ function pandoraFlotPie(
|
||||||
colors,
|
colors,
|
||||||
hide_labels
|
hide_labels
|
||||||
) {
|
) {
|
||||||
var labels = labels.split(separator);
|
labels = labels.split(separator);
|
||||||
var data = values.split(separator);
|
var data = values.split(separator);
|
||||||
|
|
||||||
if (colors != "") {
|
if (colors != "") {
|
||||||
|
@ -92,7 +93,7 @@ function pandoraFlotPie(
|
||||||
function pieHover(event, pos, obj) {
|
function pieHover(event, pos, obj) {
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|
||||||
index = obj.seriesIndex;
|
var index = obj.seriesIndex;
|
||||||
legends.css("color", "#3F3F3D");
|
legends.css("color", "#3F3F3D");
|
||||||
legends.eq(index).css("color", "");
|
legends.eq(index).css("color", "");
|
||||||
}
|
}
|
||||||
|
@ -144,21 +145,14 @@ function pandoraFlotPieCustom(
|
||||||
.pop()
|
.pop()
|
||||||
.split(".")
|
.split(".")
|
||||||
.shift();
|
.shift();
|
||||||
var labels = labels.split(separator);
|
labels = labels.split(separator);
|
||||||
var legend = legend.split(separator);
|
legend = legend.split(separator);
|
||||||
var data = values.split(separator);
|
var data = values.split(separator);
|
||||||
var no_data = 0;
|
var no_data = 0;
|
||||||
if (colors != "") {
|
if (colors != "") {
|
||||||
colors = colors.split(separator);
|
colors = colors.split(separator);
|
||||||
}
|
}
|
||||||
var colors_data = [
|
|
||||||
"#e63c52",
|
|
||||||
"#FFA631",
|
|
||||||
"#f3b200",
|
|
||||||
"#5BB6E5",
|
|
||||||
"#F2919D",
|
|
||||||
"#82b92e"
|
|
||||||
];
|
|
||||||
var color = null;
|
var color = null;
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
if (colors != "") {
|
if (colors != "") {
|
||||||
|
@ -174,28 +168,31 @@ function pandoraFlotPieCustom(
|
||||||
|
|
||||||
if (width <= 450) {
|
if (width <= 450) {
|
||||||
show_legend = false;
|
show_legend = false;
|
||||||
label_conf = {
|
|
||||||
show: false
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
label_conf = {
|
label_conf = {
|
||||||
show: true,
|
show: true,
|
||||||
radius: 0.75,
|
radius: 5 / 8,
|
||||||
formatter: function(label, series) {
|
formatter: function(label, series) {
|
||||||
|
console.log(series);
|
||||||
return (
|
return (
|
||||||
'<div style="font-size:' +
|
'<div style="font-size:' +
|
||||||
font_size +
|
font_size +
|
||||||
"pt;" +
|
"pt; font-weight:bolder;" +
|
||||||
'text-align:center;padding:2px;color:white;">' +
|
"text-align:center;padding:2px;color:rgb(63, 63, 61)" +
|
||||||
series.percent.toFixed(2) +
|
'">' +
|
||||||
"%</div>"
|
label +
|
||||||
|
":<br>" +
|
||||||
|
series.data[0][1] +
|
||||||
|
"</div>"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
background: {
|
background: {
|
||||||
opacity: 0.5,
|
opacity: 0.5
|
||||||
color: ""
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
label_conf = {
|
||||||
|
show: false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var conf_pie = {
|
var conf_pie = {
|
||||||
|
@ -203,8 +200,8 @@ function pandoraFlotPieCustom(
|
||||||
pie: {
|
pie: {
|
||||||
show: true,
|
show: true,
|
||||||
radius: 3 / 4,
|
radius: 3 / 4,
|
||||||
innerRadius: 0.4
|
innerRadius: 0.4,
|
||||||
//label: label_conf
|
label: label_conf
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
@ -234,7 +231,7 @@ function pandoraFlotPieCustom(
|
||||||
var legends = $("#" + graph_id + " .legendLabel");
|
var legends = $("#" + graph_id + " .legendLabel");
|
||||||
var j = 0;
|
var j = 0;
|
||||||
legends.each(function() {
|
legends.each(function() {
|
||||||
//$(this).css('width', $(this).width());
|
//$(this).css("width", $(this).width());
|
||||||
$(this).css("font-size", font_size + "pt");
|
$(this).css("font-size", font_size + "pt");
|
||||||
$(this).removeClass("legendLabel");
|
$(this).removeClass("legendLabel");
|
||||||
$(this).addClass(font);
|
$(this).addClass(font);
|
||||||
|
@ -264,19 +261,6 @@ function pandoraFlotPieCustom(
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
var pielegends = $("#" + graph_id + " .pieLabelBackground");
|
|
||||||
pielegends.each(function() {
|
|
||||||
$(this)
|
|
||||||
.css("transform", "rotate(-35deg)")
|
|
||||||
.css("color", "black");
|
|
||||||
});
|
|
||||||
var labelpielegends = $("#" + graph_id + " .pieLabel");
|
|
||||||
labelpielegends.each(function() {
|
|
||||||
$(this)
|
|
||||||
.css("transform", "rotate(-35deg)")
|
|
||||||
.css("color", "black");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
$("#" + graph_id).bind("plothover", pieHover);
|
$("#" + graph_id).bind("plothover", pieHover);
|
||||||
$("#" + graph_id).bind("plotclick", Clickpie);
|
$("#" + graph_id).bind("plotclick", Clickpie);
|
||||||
|
@ -287,16 +271,17 @@ function pandoraFlotPieCustom(
|
||||||
function pieHover(event, pos, obj) {
|
function pieHover(event, pos, obj) {
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
|
|
||||||
index = obj.seriesIndex;
|
var index = obj.seriesIndex;
|
||||||
legends.css("color", "#3F3F3D");
|
legends.css("color", "#3F3F3D");
|
||||||
legends.eq(index).css("color", "");
|
legends.eq(index).css("color", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
function Clickpie(event, pos, obj) {
|
function Clickpie(event, pos, obj) {
|
||||||
if (!obj) return;
|
if (!obj) return;
|
||||||
percent = parseFloat(obj.series.percent).toFixed(2);
|
var percent = parseFloat(obj.series.percent).toFixed(2);
|
||||||
valor = parseFloat(obj.series.data[0][1]);
|
var valor = parseFloat(obj.series.data[0][1]);
|
||||||
|
|
||||||
|
var value = "";
|
||||||
if (valor > 1000000) {
|
if (valor > 1000000) {
|
||||||
value = Math.round((valor / 1000000) * 100) / 100;
|
value = Math.round((valor / 1000000) * 100) / 100;
|
||||||
value = value + "M";
|
value = value + "M";
|
||||||
|
@ -325,42 +310,6 @@ function pandoraFlotPieCustom(
|
||||||
$("#watermark_image_" + graph_id).attr("src")
|
$("#watermark_image_" + graph_id).attr("src")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
window.onresize = function(event) {
|
|
||||||
$.plot($('#' + graph_id), data, conf_pie);
|
|
||||||
if (no_data == data.length) {
|
|
||||||
$('#'+graph_id+' .overlay').remove();
|
|
||||||
$('#'+graph_id+' .base').remove();
|
|
||||||
$('#'+graph_id).prepend("<img style='width:50%;' src='images/no_data_toshow.png' />");
|
|
||||||
}
|
|
||||||
var legends = $('#'+graph_id+' .legendLabel');
|
|
||||||
var j = 0;
|
|
||||||
legends.each(function () {
|
|
||||||
//$(this).css('width', $(this).width());
|
|
||||||
$(this).css('font-size', font_size+'pt');
|
|
||||||
$(this).removeClass("legendLabel");
|
|
||||||
$(this).addClass(font);
|
|
||||||
$(this).text(legend[j]);
|
|
||||||
j++;
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($('input[name="custom_graph"]').val()) {
|
|
||||||
$('.legend>div').css('right',($('.legend>div').height()*-1));
|
|
||||||
$('.legend>table').css('right',($('.legend>div').height()*-1));
|
|
||||||
}
|
|
||||||
//$('.legend>table').css('border',"1px solid #E2E2E2");
|
|
||||||
$('.legend>table').css('background-color',"transparent");
|
|
||||||
|
|
||||||
var pielegends = $('#'+graph_id+' .pieLabelBackground');
|
|
||||||
pielegends.each(function () {
|
|
||||||
$(this).css('transform', "rotate(-35deg)").css('color', 'black');
|
|
||||||
});
|
|
||||||
var labelpielegends = $('#'+graph_id+' .pieLabel');
|
|
||||||
labelpielegends.each(function () {
|
|
||||||
$(this).css('transform', "rotate(-35deg)").css('color', 'black');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pandoraFlotHBars(
|
function pandoraFlotHBars(
|
||||||
|
|
|
@ -159,7 +159,26 @@ function pandora_session_gc($max_lifetime=300)
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if (isset($config['session_timeout'])) {
|
if (isset($config['session_timeout'])) {
|
||||||
$max_lifetime = $config['session_timeout'];
|
$session_timeout = $config['session_timeout'];
|
||||||
|
} else {
|
||||||
|
// if $config doesn`t work ...
|
||||||
|
$session_timeout = db_get_value(
|
||||||
|
'value',
|
||||||
|
'tconfig',
|
||||||
|
'token',
|
||||||
|
'session_timeout'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($session_timeout)) {
|
||||||
|
if ($session_timeout == -1) {
|
||||||
|
// The session expires in 10 years
|
||||||
|
$session_timeout = 315576000;
|
||||||
|
} else {
|
||||||
|
$session_timeout *= 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_lifetime = $session_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
$time_limit = (time() - $max_lifetime);
|
$time_limit = (time() - $max_lifetime);
|
||||||
|
@ -171,6 +190,11 @@ function pandora_session_gc($max_lifetime=300)
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Deleting cron and empty sessions.
|
||||||
|
$sql = "DELETE FROM tsessions_php WHERE
|
||||||
|
data IS NULL OR id_session REGEXP '^cron-'";
|
||||||
|
db_process_sql($sql);
|
||||||
|
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
<div style='height: 10px'>
|
<div style='height: 10px'>
|
||||||
<?php
|
<?php
|
||||||
$version = '7.0NG.738';
|
$version = '7.0NG.738';
|
||||||
$build = '190827';
|
$build = '190828';
|
||||||
$banner = "v$version Build $build";
|
$banner = "v$version Build $build";
|
||||||
|
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
|
|
@ -984,7 +984,7 @@ if (is_metaconsole()) {
|
||||||
'SELECT id, server_name FROM tmetaconsole_setup',
|
'SELECT id, server_name FROM tmetaconsole_setup',
|
||||||
'server_id',
|
'server_id',
|
||||||
$server_id,
|
$server_id,
|
||||||
'script',
|
'',
|
||||||
__('All'),
|
__('All'),
|
||||||
'0',
|
'0',
|
||||||
true
|
true
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_console
|
%define name pandorafms_console
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
%define httpd_name httpd
|
%define httpd_name httpd
|
||||||
# User and Group under which Apache is running
|
# User and Group under which Apache is running
|
||||||
%define httpd_name apache2
|
%define httpd_name apache2
|
||||||
|
|
|
@ -109,7 +109,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
||||||
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
|
||||||
('custom_report_front_header', ''),
|
('custom_report_front_header', ''),
|
||||||
('custom_report_front_footer', ''),
|
('custom_report_front_footer', ''),
|
||||||
('MR', 30),
|
('MR', 31),
|
||||||
('identification_reminder', 1),
|
('identification_reminder', 1),
|
||||||
('identification_reminder_timestamp', 0),
|
('identification_reminder_timestamp', 0),
|
||||||
('current_package_enterprise', '738'),
|
('current_package_enterprise', '738'),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package: pandorafms-server
|
package: pandorafms-server
|
||||||
Version: 7.0NG.738-190827
|
Version: 7.0NG.738-190828
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: admin
|
Section: admin
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
pandora_version="7.0NG.738-190827"
|
pandora_version="7.0NG.738-190828"
|
||||||
|
|
||||||
package_cpan=0
|
package_cpan=0
|
||||||
package_pandora=1
|
package_pandora=1
|
||||||
|
|
|
@ -45,7 +45,7 @@ our @EXPORT = qw(
|
||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.738";
|
my $pandora_version = "7.0NG.738";
|
||||||
my $pandora_build = "190827";
|
my $pandora_build = "190828";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
# Setup hash
|
# Setup hash
|
||||||
|
|
|
@ -58,7 +58,6 @@ my %Agents :shared;
|
||||||
my $Sem :shared;
|
my $Sem :shared;
|
||||||
my $TaskSem :shared;
|
my $TaskSem :shared;
|
||||||
my $AgentSem :shared;
|
my $AgentSem :shared;
|
||||||
my $XMLinSem :shared;
|
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# Data Server class constructor.
|
# Data Server class constructor.
|
||||||
|
@ -75,7 +74,6 @@ sub new ($$;$) {
|
||||||
$Sem = Thread::Semaphore->new;
|
$Sem = Thread::Semaphore->new;
|
||||||
$TaskSem = Thread::Semaphore->new (0);
|
$TaskSem = Thread::Semaphore->new (0);
|
||||||
$AgentSem = Thread::Semaphore->new (1);
|
$AgentSem = Thread::Semaphore->new (1);
|
||||||
$XMLinSem = Thread::Semaphore->new (1);
|
|
||||||
|
|
||||||
# Call the constructor of the parent class
|
# Call the constructor of the parent class
|
||||||
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
my $self = $class->SUPER::new($config, DATASERVER, \&PandoraFMS::DataServer::data_producer, \&PandoraFMS::DataServer::data_consumer, $dbh);
|
||||||
|
@ -177,7 +175,6 @@ sub data_consumer ($$) {
|
||||||
my $agent_name = $1;
|
my $agent_name = $1;
|
||||||
my $file_name = $pa_config->{'incomingdir'};
|
my $file_name = $pa_config->{'incomingdir'};
|
||||||
my $xml_err;
|
my $xml_err;
|
||||||
my $error;
|
|
||||||
|
|
||||||
# Fix path
|
# Fix path
|
||||||
$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');
|
$file_name .= "/" unless (substr ($file_name, -1, 1) eq '/');
|
||||||
|
@ -194,37 +191,18 @@ sub data_consumer ($$) {
|
||||||
|
|
||||||
for (0..1) {
|
for (0..1) {
|
||||||
eval {
|
eval {
|
||||||
local $SIG{__DIE__};
|
|
||||||
threads->yield;
|
threads->yield;
|
||||||
# XML::SAX::ExpatXS is not thread safe.
|
|
||||||
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
|
|
||||||
$XMLinSem->down();
|
|
||||||
}
|
|
||||||
|
|
||||||
$xml_data = XMLin ($file_name, forcearray => 'module');
|
$xml_data = XMLin ($file_name, forcearray => 'module');
|
||||||
|
|
||||||
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
|
|
||||||
$XMLinSem->up();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Invalid XML
|
# Invalid XML
|
||||||
if ($@) {
|
if ($@ || ref($xml_data) ne 'HASH') {
|
||||||
$error = 1;
|
|
||||||
if ($XML::Simple::PREFERRED_PARSER eq 'XML::SAX::ExpatXS') {
|
|
||||||
$XMLinSem->up();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($error || ref($xml_data) ne 'HASH') {
|
|
||||||
|
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$xml_err = $@;
|
$xml_err = $@;
|
||||||
} else {
|
} else {
|
||||||
$xml_err = "Invalid XML format.";
|
$xml_err = "Invalid XML format.";
|
||||||
}
|
}
|
||||||
|
|
||||||
logger($pa_config, "Failed to parse $file_name $xml_err", 3);
|
|
||||||
sleep (2);
|
sleep (2);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
|
||||||
|
|
||||||
# version: Defines actual version of Pandora Server for this module only
|
# version: Defines actual version of Pandora Server for this module only
|
||||||
my $pandora_version = "7.0NG.738";
|
my $pandora_version = "7.0NG.738";
|
||||||
my $pandora_build = "190827";
|
my $pandora_build = "190828";
|
||||||
our $VERSION = $pandora_version." ".$pandora_build;
|
our $VERSION = $pandora_version." ".$pandora_build;
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
%define name pandorafms_server
|
%define name pandorafms_server
|
||||||
%define version 7.0NG.738
|
%define version 7.0NG.738
|
||||||
%define release 190827
|
%define release 190828
|
||||||
|
|
||||||
Summary: Pandora FMS Server
|
Summary: Pandora FMS Server
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
PI_VERSION="7.0NG.738"
|
PI_VERSION="7.0NG.738"
|
||||||
PI_BUILD="190827"
|
PI_BUILD="190828"
|
||||||
|
|
||||||
MODE=$1
|
MODE=$1
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 1 ]; then
|
||||||
|
|
|
@ -34,7 +34,7 @@ use PandoraFMS::Config;
|
||||||
use PandoraFMS::DB;
|
use PandoraFMS::DB;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.738 PS190827";
|
my $version = "7.0NG.738 PS190828";
|
||||||
|
|
||||||
# Pandora server configuration
|
# Pandora server configuration
|
||||||
my %conf;
|
my %conf;
|
||||||
|
|
|
@ -36,7 +36,7 @@ use Encode::Locale;
|
||||||
Encode::Locale::decode_argv;
|
Encode::Locale::decode_argv;
|
||||||
|
|
||||||
# version: define current version
|
# version: define current version
|
||||||
my $version = "7.0NG.738 PS190827";
|
my $version = "7.0NG.738 PS190828";
|
||||||
|
|
||||||
# save program name for logging
|
# save program name for logging
|
||||||
my $progname = basename($0);
|
my $progname = basename($0);
|
||||||
|
|
Loading…
Reference in New Issue