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

View File

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

View File

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

View File

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