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

View File

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