fix: [UI] Cleanup querybuilderTool variable

pull/8317/head
Jakub Onderka 2022-04-29 18:04:41 +02:00
parent be5ee0f736
commit 206b1409e0
2 changed files with 17 additions and 36 deletions

View File

@ -25,7 +25,7 @@ $relatedEventsValues = json_encode($relatedEventsValues, JSON_UNESCAPED_UNICODE)
?>
<script>
var defaultFilteringRules = <?= json_encode($defaultFilteringRules); ?>;
var querybuilderTool;
var querybuilderTool = undefined;
function triggerEventFilteringTool(hide) {
var qbOptions = {
plugins: {
@ -549,18 +549,8 @@ function cleanRules(rules) {
function performQuery(rules) {
var res = cleanRules(rules);
var url = "/events/viewEventAttributes/<?php echo h($event['Event']['id']); ?>";
xhr({
type: "post",
url: url,
data: res,
success: function (data) {
$("#attributes_div").html(data);
},
error: function() {
showMessage('fail', 'Something went wrong - could not fetch attributes.');
}
});
var url = "/events/viewEventAttributes/<?= intval($event['Event']['id']); ?>";
fetchAttributes(url, res);
}
function clickMessage(clicked) {

View File

@ -3653,16 +3653,7 @@ function filterAttributes(filter, event_id) {
url += filter.length > 0 ? "/searchFor:" + filter : "";
}
if (deleted) url += '/deleted:true';
xhr({
type: "get",
url: url,
success: function(data) {
$("#attributes_div").html(data);
},
error: function() {
showMessage('fail', 'Something went wrong - could not fetch attributes.');
}
});
fetchAttributes(url);
}
function eventIndexColumnsToggle(columnName) {
@ -3714,16 +3705,7 @@ function pivotObjectReferences(url, uuid) {
}
url += '/focus:' + uuid;
xhr({
type: "get",
url: url,
success: function (data) {
$("#attributes_div").html(data);
},
error: function() {
showMessage('fail', 'Something went wrong - could not fetch attributes.');
},
});
fetchAttributes(url);
}
function toggleBoolFilter(url, param) {
@ -3755,17 +3737,26 @@ function toggleBoolFilter(url, param) {
url += buildFilterURL(res);
url = url.replace(/view\//i, 'viewEventAttributes/');
xhr({
fetchAttributes(url);
querybuilderTool = undefined;
}
function fetchAttributes(url, data) {
var options = {
type: "get",
url: url,
success: function (data) {
$("#attributes_div").html(data);
querybuilderTool = undefined;
},
error: function() {
showMessage('fail', 'Something went wrong - could not fetch attributes.');
}
});
};
if (data !== undefined) {
options["type"] = "post";
options["data"] = data;
}
xhr(options);
}
function mergeOrganisationUpdate() {