Fix possible race-collision (#2846)

This commit is contained in:
DL6ER
2023-11-17 21:34:17 +01:00
committed by GitHub
4 changed files with 768 additions and 772 deletions

View File

@@ -6,6 +6,7 @@
* Please see LICENSE file for your rights under this license. */
/* global utils:false, groups:false,, apiFailure:false, updateFtlInfo:false, getGroups:false, processGroupResult:false */
/* exported initTable */
var table;
@@ -82,7 +83,7 @@ $(function () {
reloadClientSuggestions();
utils.setBsSelectDefaults();
initTable();
getGroups();
$("#select").on("change", function () {
$("#ip-custom").val("");
@@ -90,12 +91,9 @@ $(function () {
});
});
// eslint-disable-next-line no-unused-vars
function initTable() {
table = $("#clientsTable")
.on("preXhr.dt", function () {
getGroups();
})
.DataTable({
table = $("#clientsTable").DataTable({
processing: true,
ajax: {
url: "/api/clients",

View File

@@ -5,7 +5,7 @@
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
/* global apiFailure:false, utils:false */
/* global apiFailure:false, utils:false, initTable:false */
// eslint-disable-next-line no-unused-vars
var groups = [];
@@ -18,6 +18,8 @@ function getGroups() {
dataType: "json",
success: function (data) {
groups = data.groups;
// Actually load table contents
initTable();
},
error: function (data) {
apiFailure(data);

View File

@@ -6,6 +6,7 @@
* Please see LICENSE file for your rights under this license. */
/* global utils:false, groups:false,, getGroups:false, updateFtlInfo:false, apiFailure:false, processGroupResult:false */
/* exported initTable */
var table;
var GETDict = {};
@@ -44,7 +45,7 @@ $(function () {
});
utils.setBsSelectDefaults();
initTable();
getGroups();
});
// Show a list of suggested domains based on the user's input
@@ -91,12 +92,9 @@ function hideSuggestDomains() {
$("#suggest_domains").slideUp("fast");
}
// eslint-disable-next-line no-unused-vars
function initTable() {
table = $("#domainsTable")
.on("preXhr.dt", function () {
getGroups();
})
.DataTable({
table = $("#domainsTable").DataTable({
processing: true,
ajax: {
url: "/api/domains",

View File

@@ -6,6 +6,7 @@
* Please see LICENSE file for your rights under this license. */
/* global utils:false, groups:false, apiFailure:false, updateFtlInfo:false, getGroups:false, processGroupResult:false */
/* exported initTable */
var table;
var GETDict = {};
@@ -17,7 +18,7 @@ $(function () {
$("#btnAddBlock").on("click", { type: "block" }, addList);
utils.setBsSelectDefaults();
initTable();
getGroups();
});
function format(data) {
@@ -98,12 +99,9 @@ function format(data) {
);
}
// eslint-disable-next-line no-unused-vars
function initTable() {
table = $("#listsTable")
.on("preXhr.dt", function () {
getGroups();
})
.DataTable({
table = $("#listsTable").DataTable({
processing: true,
ajax: {
url: "/api/lists",