chg: [eventView] moved attribute filtering tool in its own file

pull/4076/head
mokaddem 2019-01-25 16:54:44 +01:00
parent 49014b420b
commit 19d67697a6
3 changed files with 194 additions and 190 deletions

View File

@ -0,0 +1,193 @@
<div id="eventFilteringQBWrapper" style="padding: 5px; display: none; border: 1px solid #dddddd; border-bottom: 0px;">
<div id="eventFilteringQB"></div>
<button id="eventFilteringQBSubmit" type="button" class="btn btn-inverse" style="display:block; margin-left:auto; margin-right: 0"> <i class="fa fa-filter"></i> Filter </button>
</div>
<script>
function triggerEventFilteringTool(clicked) {
var qbOptions = {
plugins: {
'filter-description' : {
mode: 'inline'
},
'unique-filter': null,
'bt-tooltip-errors': null,
'not-group': null,
},
allow_empty: true,
display_empty_filter: false,
conditions: ['OR'],
lang: {
operators: {
equal: 'show'
}
},
filters: [
{
"input": "select",
"type": "string",
"operators": [
"equal",
],
"unique": false,
"id": "category",
"label": "Category",
"values": {
"File": "file",
"Network": "network",
"Financial": "financial"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "proposal",
"label": "Proposal",
"values": {
0: "Both",
1: "Proposal only",
2: "Exclude proposal"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "correlation",
"label": "Correlation",
"values": {
0: "Both",
1: "Correlation only",
2: "Exclude correlation"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "warning",
"label": "Warning",
"values": {
0: "Both",
1: "Warning only",
2: "Exclude warning"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "deleted",
"label": "Deleted",
"values": {
0: "Both",
1: "Deleted only",
2: "Exclude deleted"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "includeRelatedTags",
"label": "Related Tags",
"values": {
0: "None",
1: "Yes"
}
},
],
rules: rules = {
condition: 'OR',
not: false,
valid: true,
rules: [
{
condition: 'OR',
rules: [{
field: 'category',
id: 'category',
input: 'select',
operator: 'equal',
type: 'string',
value: 'Financial',
}]
},
{
field: 'proposal',
id: 'proposal',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'correlation',
id: 'correlation',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'warning',
id: 'warning',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'deleted',
id: 'deleted',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'includeRelatedTags',
id: 'includeRelatedTags',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
],
flags: {
no_add_group: true,
}
},
icons: {
add_group: 'fa fa-plus-square',
add_rule: 'fa fa-plus-circle',
remove_group: 'fa fa-minus-square',
remove_rule: 'fa fa-minus-circle',
error: 'fa fa-exclamation-triangle'
},
};
var $wrapper = $('#eventFilteringQBWrapper');
var $ev = $('#eventFilteringQB');
var querybuilderTool = $ev.queryBuilder(qbOptions);
querybuilderTool = querybuilderTool[0].queryBuilder;
$wrapper.toggle('blind', 100, { direction: 'up' });
}
</script>

View File

@ -178,9 +178,7 @@
</div>
</div>
<div id="eventFilteringQBWrapper" style="padding: 5px; display: none; border: 1px solid #dddddd; border-bottom: 0px;">
<div id="eventFilteringQB"></div>
</div>
<?php echo $this->element('/Events/View/eventFilteringQBWrapper'); ?>
<table class="table table-striped table-condensed">
<tr>

View File

@ -2949,193 +2949,6 @@ function filterAttributes(filter, id) {
});
}
function triggerEventFilteringTool(clicked) {
var qbOptions = {
plugins: {
'filter-description' : {
mode: 'inline'
},
'unique-filter': null,
'bt-tooltip-errors': null,
'not-group': null,
},
allow_empty: true,
display_empty_filter: false,
conditions: ['OR'],
lang: {
operators: {
equal: 'show'
}
},
filters: [
{
"input": "select",
"type": "string",
"operators": [
"equal",
],
"unique": false,
"id": "category",
"label": "Category",
"values": {
"File": "file",
"Network": "network",
"Financial": "financial"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "proposal",
"label": "Proposal",
"values": {
0: "Both",
1: "Proposal only",
2: "Exclude proposal"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "correlation",
"label": "Correlation",
"values": {
0: "Both",
1: "Correlation only",
2: "Exclude correlation"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "warning",
"label": "Warning",
"values": {
0: "Both",
1: "Warning only",
2: "Exclude warning"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "deleted",
"label": "Deleted",
"values": {
0: "Both",
1: "Deleted only",
2: "Exclude deleted"
}
},
{
"input": "radio",
"type": "integer",
"operators": [
"equal",
],
"unique": true,
"id": "includeRelatedTags",
"label": "Related Tags",
"values": {
0: "None",
1: "Yes"
}
},
],
rules: rules = {
condition: 'OR',
not: false,
valid: true,
rules: [
{
condition: 'OR',
rules: [{
field: 'category',
id: 'category',
input: 'select',
operator: 'equal',
type: 'string',
value: 'Financial',
}]
},
{
field: 'proposal',
id: 'proposal',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'correlation',
id: 'correlation',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'warning',
id: 'warning',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'deleted',
id: 'deleted',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
{
field: 'includeRelatedTags',
id: 'includeRelatedTags',
input: 'radio',
operator: 'equal',
type: 'radio',
value: 0,
},
],
flags: {
no_add_group: true,
}
},
icons: {
add_group: 'fa fa-plus-square',
add_rule: 'fa fa-plus-circle',
remove_group: 'fa fa-minus-square',
remove_rule: 'fa fa-minus-circle',
error: 'fa fa-exclamation-triangle'
},
};
var $wrapper = $('#eventFilteringQB');
var querybuilderTool = $wrapper.queryBuilder(qbOptions);
querybuilderTool = querybuilderTool[0].queryBuilder;
// querybuilderTool.setRules(rules, false);
$('#eventFilteringQBWrapper').toggle('blind', 100, { direction: 'up' });
}
function pivotObjectReferences(url, uuid) {
url += '/focus:' + uuid;
console.log(url);