fix: support of filtering for distribution=0 (empty(0) is true ini

php). Also, only consider attr and obj_attr (ignoring object as they
only carry meta-data)
pull/3214/head
Sami Mokaddem 2018-04-23 14:33:32 +00:00
parent 02b4f32c4f
commit 828426b0c9
2 changed files with 22 additions and 15 deletions

View File

@ -872,7 +872,8 @@ class EventsController extends AppController {
if (empty($results)) throw new NotFoundException('Invalid event');
$event = $results[0];
if (!empty($this->params['named']['searchFor'])) {
// Be sure that '0' is not interpreted as false
if (isset($this->params['named']['searchFor'])) {
// filtering on specific columns is specified
if (!empty($this->params['named']['filterColumnsOverwrite'])) {
$filterColumns = $this->params['named']['filterColumnsOverwrite'];

View File

@ -11,11 +11,17 @@ function clickHandler(evt) {
var firstPoint = distribution_chart.getElementAtEvent(evt)[0];
var distribution_id;
if (firstPoint) {
distribution_id = distribution_chart.data.labels[firstPoint._index][1];
var value_to_set = distribution_id;
value_to_set += distribution_id == event_distribution ? '|' + '5' : '';
document.getElementById('attributesFilterField').value = value_to_set;
filterAttributes('distribution', '17');
var value = distribution_chart.data.datasets[firstPoint._datasetIndex].data[firstPoint._index];
if (value == 0) {
document.getElementById('attributesFilterField').value = "";
filterAttributes('all', '17');
} else {
distribution_id = distribution_chart.data.labels[firstPoint._index][1];
var value_to_set = String(distribution_id);
value_to_set += distribution_id == event_distribution ? '|' + '5' : '';
document.getElementById('attributesFilterField').value = value_to_set;
filterAttributes('distribution', '17');
}
}
}
$.ajax({
@ -41,6 +47,13 @@ $.ajax({
// borderColor: "rgba(255, 0, 0, 0.6)",
// pointBackgroundColor: "rgba(255, 0, 0, 0.8)",
//},
//{
// label: "Objects",
// data: data.object,
// backgroundColor: "rgba(0, 0, 255, 0.1)",
// borderColor: "rgba(0, 0, 255, 0.6)",
// pointBackgroundColor: "rgba(0, 0, 255, 1)",
//},
{
label: "Attributes",
data: data.attribute,
@ -49,19 +62,12 @@ $.ajax({
pointBackgroundColor: "rgba(255, 0, 0, 1)",
},
{
label: "Objects",
data: data.object,
label: "Object attributes",
data: data.obj_attr,
backgroundColor: "rgba(0, 0, 255, 0.1)",
borderColor: "rgba(0, 0, 255, 0.6)",
pointBackgroundColor: "rgba(0, 0, 255, 1)",
},
{
label: "Object attributes",
data: data.obj_attr,
backgroundColor: "rgba(0, 255, 0, 0.1)",
borderColor: "rgba(0, 255, 0, 0.6)",
pointBackgroundColor: "rgba(0, 255, 0, 1)",
},
],
},