Codacy var names part 2
This commit is contained in:
parent
6f62fdeddf
commit
3c40f31c05
|
@ -75,7 +75,7 @@ foreach ($remotes as $key => $value) {
|
||||||
$config[$key]["before"] = [];
|
$config[$key]["before"] = [];
|
||||||
} else {
|
} else {
|
||||||
$env = isset($config[$key]["sentry_env"]) ? $config[$key]["sentry_env"] : "prod";
|
$env = isset($config[$key]["sentry_env"]) ? $config[$key]["sentry_env"] : "prod";
|
||||||
$config[$key]["before"][] = "local: cd server/resources && npm i && npm run prod -- --env sentry_environment=".$env;
|
$config[$key]["before"][] = "local: cd server/resources && npm i && npm run prod -- --env sentryEnvironment=".$env;
|
||||||
}
|
}
|
||||||
if(isset($value["after"]) && $value["after"] === false){
|
if(isset($value["after"]) && $value["after"] === false){
|
||||||
$config[$key]["after"] = [];
|
$config[$key]["after"] = [];
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"sentry_enabled": false,
|
"sentryEnabled": false,
|
||||||
"sentry_dsn": "",
|
"sentryDsn": "",
|
||||||
"sentry_environment": "prod",
|
"sentryEnvironment": "prod",
|
||||||
"sentry_auth_token": "",
|
"sentryAuthToken": "",
|
||||||
"sentry_organization": "",
|
"sentryOrganization": "",
|
||||||
"sentry_project": ""
|
"sentryProject": ""
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ async function play (game) {
|
||||||
const game = new Game();
|
const game = new Game();
|
||||||
$("body").append("<div class=\"modal\" id=\"modal_game\" tabindex=\"-1\" role=\"dialog\" data-backdrop=\"static\" style=\"display: none; min-width: 100%; margin: 0px;\"><div class=\"modal-dialog\" role=\"document\" style=\"min-width: 100%; margin: 0;\"><div class=\"modal-content\" style=\"min-height: 100vh;\" id=\"modal_game_content\"></div></div></div>");
|
$("body").append("<div class=\"modal\" id=\"modal_game\" tabindex=\"-1\" role=\"dialog\" data-backdrop=\"static\" style=\"display: none; min-width: 100%; margin: 0px;\"><div class=\"modal-dialog\" role=\"document\" style=\"min-width: 100%; margin: 0;\"><div class=\"modal-content\" style=\"min-height: 100vh;\" id=\"modal_game_content\"></div></div></div>");
|
||||||
$("#modal_game_content").append(`<div class="modal-header"><h5 class="modal-title" style="color: black">${game.title}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body" id="modal_game_body"></div>`);
|
$("#modal_game_content").append(`<div class="modal-header"><h5 class="modal-title" style="color: black">${game.title}</h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body" id="modal_game_body"></div>`);
|
||||||
$("#modal_game_body").append(`<div id="game_content" style="text-align: center"></div><p style="text-align: right; color: black;">Game by <a style="color: blue" target="_blank" href="${game.author_url}">${game.author}</a></p>`);
|
$("#modal_game_body").append(`<div id="game_content" style="text-align: center"></div><p style="text-align: right; color: black;">Game by <a style="color: blue" target="_blank" href="${game.authorUrl}">${game.author}</a></p>`);
|
||||||
$("#modal_game").modal("show");
|
$("#modal_game").modal("show");
|
||||||
game.initialize($("#game_content"));
|
game.initialize($("#game_content"));
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ export default class {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.title = "Empty game";
|
this.title = "Empty game";
|
||||||
this.author = "Prova";
|
this.author = "Prova";
|
||||||
this.author_url = "https://example.com/";
|
this.authorUrl = "https://example.com/";
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize(container){
|
initialize(container){
|
||||||
|
|
|
@ -2,17 +2,17 @@ import {default as createUnityInstance} from './ld46.loader.js';
|
||||||
|
|
||||||
import build_size_data from './ld46.data.gz';
|
import build_size_data from './ld46.data.gz';
|
||||||
import buildSizeFramework from './ld46.framework.js.gz';
|
import buildSizeFramework from './ld46.framework.js.gz';
|
||||||
import build_size_wasm from './ld46.wasm.gz';
|
import buildSizeWasm from './ld46.wasm.gz';
|
||||||
|
|
||||||
console.log("data "+build_size_data);
|
console.log("data "+build_size_data);
|
||||||
console.log("framework "+buildSizeFramework);
|
console.log("framework "+buildSizeFramework);
|
||||||
console.log("wasm "+build_size_wasm);
|
console.log("wasm "+buildSizeWasm);
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.title = "What the firetruck";
|
this.title = "What the firetruck";
|
||||||
this.author = "dvdfu";
|
this.author = "dvdfu";
|
||||||
this.author_url = "https://github.com/dvdfu";
|
this.authorUrl = "https://github.com/dvdfu";
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize(container){
|
initialize(container){
|
||||||
|
|
|
@ -150,10 +150,10 @@ var oldData = "null";
|
||||||
var tableEngine = "datatables";
|
var tableEngine = "datatables";
|
||||||
var fillTable = undefined;
|
var fillTable = undefined;
|
||||||
|
|
||||||
async function loadTable ({ tablePage, set_interval = true, interval = 10000, onlineReload = false, use_custom_tableEngine = false, callback = false }) {
|
async function loadTable ({ tablePage, setInterval = true, interval = 10000, onlineReload = false, useCustomTableEngine = false, callback = false }) {
|
||||||
if (typeof fillTable === "undefined") {
|
if (typeof fillTable === "undefined") {
|
||||||
if (use_custom_tableEngine !== false) {
|
if (useCustomTableEngine !== false) {
|
||||||
tableEngine = use_custom_tableEngine;
|
tableEngine = useCustomTableEngine;
|
||||||
} else if ("connection" in navigator && navigator.connection.saveData) {
|
} else if ("connection" in navigator && navigator.connection.saveData) {
|
||||||
tableEngine = "default";
|
tableEngine = "default";
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ async function loadTable ({ tablePage, set_interval = true, interval = 10000, on
|
||||||
}).fail(function (data, status) {
|
}).fail(function (data, status) {
|
||||||
if (status === "parsererror") {
|
if (status === "parsererror") {
|
||||||
if ($("#table_body").children().length === 0) { // this is a server-side authentication error on some cheap hosting providers
|
if ($("#table_body").children().length === 0) { // this is a server-side authentication error on some cheap hosting providers
|
||||||
loadTable(tablePage, set_interval, interval); // retry
|
loadTable(tablePage, setInterval, interval); // retry
|
||||||
} // else nothing
|
} // else nothing
|
||||||
} else {
|
} else {
|
||||||
caches.open("tables-1").then(cache => {
|
caches.open("tables-1").then(cache => {
|
||||||
|
@ -218,13 +218,13 @@ async function loadTable ({ tablePage, set_interval = true, interval = 10000, on
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (set_interval) {
|
if (setInterval) {
|
||||||
if ("connection" in navigator && navigator.connection.saveData) {
|
if ("connection" in navigator && navigator.connection.saveData) {
|
||||||
interval += 5000;
|
interval += 5000;
|
||||||
}
|
}
|
||||||
console.log("table_load interval " + interval);
|
console.log("table_load interval " + interval);
|
||||||
window.loadTableInterval = setInterval(function () {
|
window.loadTableInterval = setInterval(function () {
|
||||||
window.loadTable({ tablePage, set_interval: false, interval, onlineReload, use_custom_tableEngine, callback: false });
|
window.loadTable({ tablePage, setInterval: false, interval, onlineReload, useCustomTableEngine, callback: false });
|
||||||
}, interval);
|
}, interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ let marker;
|
||||||
let feature;
|
let feature;
|
||||||
let map;
|
let map;
|
||||||
|
|
||||||
function set_marker (LatLng) {
|
function setMarker (LatLng) {
|
||||||
if (marker) {
|
if (marker) {
|
||||||
console.log("Marker exists");
|
console.log("Marker exists");
|
||||||
// console.log(marker);
|
// console.log(marker);
|
||||||
|
@ -35,17 +35,17 @@ function set_marker (LatLng) {
|
||||||
marker = L.marker(LatLng, { icon: iconDefault }).addTo(map);
|
marker = L.marker(LatLng, { icon: iconDefault }).addTo(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_map (lat = undefined, lng = undefined, selector_id = undefined, select = true) {
|
function loadMap (lat = undefined, lng = undefined, selectorId = undefined, select = true) {
|
||||||
if (lat === undefined && lng === undefined) {
|
if (lat === undefined && lng === undefined) {
|
||||||
lat = 45.5285; // TODO: replace hard-coded into cookie reading
|
lat = 45.5285; // TODO: replace hard-coded into cookie reading
|
||||||
lng = 10.2956;
|
lng = 10.2956;
|
||||||
}
|
}
|
||||||
if (selector_id === undefined) {
|
if (selectorId === undefined) {
|
||||||
selector_id = "map";
|
selectorId = "map";
|
||||||
}
|
}
|
||||||
const zoom = select ? 10 : 17;
|
const zoom = select ? 10 : 17;
|
||||||
const latLng = new L.LatLng(lat, lng);
|
const latLng = new L.LatLng(lat, lng);
|
||||||
map = new L.Map(selector_id, { zoomControl: true });
|
map = new L.Map(selectorId, { zoomControl: true });
|
||||||
|
|
||||||
const osmUrl = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
const osmUrl = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
||||||
const osmAttribution = "Map data © 2012 <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors";
|
const osmAttribution = "Map data © 2012 <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors";
|
||||||
|
@ -55,12 +55,12 @@ function load_map (lat = undefined, lng = undefined, selector_id = undefined, se
|
||||||
|
|
||||||
if (select) {
|
if (select) {
|
||||||
map.on("click", function (e) {
|
map.on("click", function (e) {
|
||||||
set_marker(e.latlng);
|
setMarker(e.latlng);
|
||||||
});
|
});
|
||||||
|
|
||||||
L.Control.CustomLocate = L.Control.Locate.extend({
|
L.Control.CustomLocate = L.Control.Locate.extend({
|
||||||
_drawMarker: function () {
|
_drawMarker: function () {
|
||||||
set_marker(this._event.latlng);
|
setMarker(this._event.latlng);
|
||||||
},
|
},
|
||||||
_onDrag: function () {},
|
_onDrag: function () {},
|
||||||
_onZoom: function () {},
|
_onZoom: function () {},
|
||||||
|
@ -87,7 +87,7 @@ function load_map (lat = undefined, lng = undefined, selector_id = undefined, se
|
||||||
console.log("Loading location from clipboard");
|
console.log("Loading location from clipboard");
|
||||||
navigator.clipboard.readText().then(text => {
|
navigator.clipboard.readText().then(text => {
|
||||||
$("#addr").val(text);
|
$("#addr").val(text);
|
||||||
if (!addr_search()) {
|
if (!addrSearch()) {
|
||||||
$("#addr").val("");
|
$("#addr").val("");
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
@ -97,25 +97,25 @@ function load_map (lat = undefined, lng = undefined, selector_id = undefined, se
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
set_marker(latLng);
|
setMarker(latLng);
|
||||||
}
|
}
|
||||||
map.invalidateSize();
|
map.invalidateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// from unknown source in the Internet
|
// from unknown source in the Internet
|
||||||
function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1 = undefined, lat2 = undefined, lng2 = undefined, osm_type = undefined) {
|
function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1 = undefined, lat2 = undefined, lng2 = undefined, osmType = undefined) {
|
||||||
addrLat = addrLat.replace(",", ".");
|
addrLat = addrLat.replace(",", ".");
|
||||||
addrLng = addrLng.replace(",", ".");
|
addrLng = addrLng.replace(",", ".");
|
||||||
if (lat1 !== undefined && lng1 !== undefined && lat2 !== undefined && lng2 !== undefined && osm_type !== undefined) {
|
if (lat1 !== undefined && lng1 !== undefined && lat2 !== undefined && lng2 !== undefined && osmType !== undefined) {
|
||||||
const loc1 = new L.LatLng(lat1, lng1);
|
const loc1 = new L.LatLng(lat1, lng1);
|
||||||
const loc2 = new L.LatLng(lat2, lng2);
|
const loc2 = new L.LatLng(lat2, lng2);
|
||||||
const bounds = new L.LatLngBounds(loc1, loc2);
|
const bounds = new L.LatLngBounds(loc1, loc2);
|
||||||
console.log(lat1, lng1, lat2, lng2, osm_type);
|
console.log(lat1, lng1, lat2, lng2, osmType);
|
||||||
set_marker(new L.LatLng(addrLat, addrLng));
|
setMarker(new L.LatLng(addrLat, addrLng));
|
||||||
if (feature) {
|
if (feature) {
|
||||||
map.removeLayer(feature);
|
map.removeLayer(feature);
|
||||||
}
|
}
|
||||||
if (osm_type === "node") {
|
if (osmType === "node") {
|
||||||
map.fitBounds(bounds);
|
map.fitBounds(bounds);
|
||||||
map.setZoom(18);
|
map.setZoom(18);
|
||||||
} else {
|
} else {
|
||||||
|
@ -127,7 +127,7 @@ function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1
|
||||||
} else if (addrLat !== undefined && addrLng !== undefined) {
|
} else if (addrLat !== undefined && addrLng !== undefined) {
|
||||||
const loc = new L.LatLng(addrLat, addrLng);
|
const loc = new L.LatLng(addrLat, addrLng);
|
||||||
console.log(loc);
|
console.log(loc);
|
||||||
set_marker(loc);
|
setMarker(loc);
|
||||||
if (zoom !== undefined) {
|
if (zoom !== undefined) {
|
||||||
map.setView(loc, zoom);
|
map.setView(loc, zoom);
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,17 +137,17 @@ function chooseAddr (addrLat, addrLng, zoom = undefined, lat1 = undefined, lng1
|
||||||
}
|
}
|
||||||
|
|
||||||
// started from https://derickrethans.nl/leaflet-and-nominatim.html
|
// started from https://derickrethans.nl/leaflet-and-nominatim.html
|
||||||
function addr_search (string_results_found = undefined, string_results_not_found = undefined) {
|
function addrSearch (string_results_found = undefined, stringResultsNotFound = undefined) {
|
||||||
function searchError (error, checkClipboard) {
|
function searchError (error, checkClipboard) {
|
||||||
if (!checkClipboard) {
|
if (!checkClipboard) {
|
||||||
$("<p>", { html: string_results_not_found }).appendTo("#results");
|
$("<p>", { html: stringResultsNotFound }).appendTo("#results");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let inp = document.getElementById("addr").value;
|
let inp = document.getElementById("addr").value;
|
||||||
// if translation strings are not defined, skip the nominatim step and don't log errors (no console.error)
|
// if translation strings are not defined, skip the nominatim step and don't log errors (no console.error)
|
||||||
const checkClipboard = string_results_found === undefined && string_results_not_found === undefined;
|
const checkClipboard = string_results_found === undefined && stringResultsNotFound === undefined;
|
||||||
$("#results").empty();
|
$("#results").empty();
|
||||||
|
|
||||||
if (inp.match("\@(-?[\d\.]*)")) { // Google Maps
|
if (inp.match("\@(-?[\d\.]*)")) { // Google Maps
|
||||||
|
@ -197,7 +197,7 @@ function addr_search (string_results_found = undefined, string_results_not_found
|
||||||
html: items.join("")
|
html: items.join("")
|
||||||
}).appendTo("#results");
|
}).appendTo("#results");
|
||||||
} else {
|
} else {
|
||||||
$("<p>", { html: string_results_not_found }).appendTo("#results");
|
$("<p>", { html: stringResultsNotFound }).appendTo("#results");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,6 +205,6 @@ function addr_search (string_results_found = undefined, string_results_not_found
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.load_map = load_map;
|
window.loadMap = loadMap;
|
||||||
window.addr_search = addr_search;
|
window.addrSearch = addrSearch;
|
||||||
window.chooseAddr = chooseAddr;
|
window.chooseAddr = chooseAddr;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import * as Sentry from "@sentry/browser";
|
import * as Sentry from "@sentry/browser";
|
||||||
import { Integrations } from "@sentry/tracing";
|
import { Integrations } from "@sentry/tracing";
|
||||||
|
|
||||||
if (process.env.config && process.env.config.sentry_enabled) {
|
if (process.env.config && process.env.config.sentryEnabled) {
|
||||||
if ("connection" in navigator && navigator.connection.saveData) {
|
if ("connection" in navigator && navigator.connection.saveData) {
|
||||||
console.log("Skipping Sentry init because data save is enabled");
|
console.log("Skipping Sentry init because data save is enabled");
|
||||||
} else {
|
} else {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: process.env.config.sentry_dsn,
|
dsn: process.env.config.sentryDsn,
|
||||||
integrations: [new Integrations.BrowserTracing()],
|
integrations: [new Integrations.BrowserTracing()],
|
||||||
tracesSampleRate: 0.6,
|
tracesSampleRate: 0.6,
|
||||||
release: "allerta-vvf-frontend@" + process.env.GIT_VERSION,
|
release: "allerta-vvf-frontend@" + process.env.GIT_VERSION,
|
||||||
environment: process.env.config.sentry_environment
|
environment: process.env.config.sentryEnvironment
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ const expectedCaches = [cacheName, "tables-1"];
|
||||||
|
|
||||||
const urls = ["offline.php", "manifest.webmanifest", "resources/images/favicon.ico", "resources/dist/marker-icon.png", "resources/dist/layers.png", "resources/dist/layers-2x.png", "resources/images/android-chrome-192x192.png", "resources/images/android-chrome-384x384.png", "resources/images/black_helmet.png", "resources/images/red_helmet.png", "resources/images/wheel.png", "resources/images/logo.png", "resources/images/owner.png", "resources/dist/fonts/fontawesome-webfont.woff2"];
|
const urls = ["offline.php", "manifest.webmanifest", "resources/images/favicon.ico", "resources/dist/marker-icon.png", "resources/dist/layers.png", "resources/dist/layers-2x.png", "resources/images/android-chrome-192x192.png", "resources/images/android-chrome-384x384.png", "resources/images/black_helmet.png", "resources/images/red_helmet.png", "resources/images/wheel.png", "resources/images/logo.png", "resources/images/owner.png", "resources/dist/fonts/fontawesome-webfont.woff2"];
|
||||||
|
|
||||||
function fetchHandler (event, content_type, not_found_message) {
|
function fetchHandler (event, contentType, notFoundMessage) {
|
||||||
// TODO: refactoring
|
// TODO: refactoring
|
||||||
console.log(event);
|
console.log(event);
|
||||||
|
|
||||||
|
@ -79,10 +79,10 @@ self.addEventListener("install", (event) => {
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((manifest) => {
|
.then((manifest) => {
|
||||||
const scripts_required = ["main.js", "maps.js"];
|
const scripts_required = ["main.js", "maps.js"];
|
||||||
scripts_required.map((script_name) => {
|
scripts_required.map((scriptName) => {
|
||||||
console.log(manifest);
|
console.log(manifest);
|
||||||
console.log(script_name);
|
console.log(scriptName);
|
||||||
cache.add("resources/dist/" + manifest[script_name]);
|
cache.add("resources/dist/" + manifest[scriptName]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,9 +15,9 @@ pdfMake.vfs = pdfFonts.pdfMake.vfs;
|
||||||
|
|
||||||
export default async function fillTable ({ data, replaceLatLngWithMap = false, callback = false }) {
|
export default async function fillTable ({ data, replaceLatLngWithMap = false, callback = false }) {
|
||||||
$("#table_body").empty();
|
$("#table_body").empty();
|
||||||
$.each(data, function (row_num, item) {
|
$.each(data, function (rowNum, item) {
|
||||||
const row = document.createElement("tr");
|
const row = document.createElement("tr");
|
||||||
row.id = "row-" + row_num;
|
row.id = "row-" + rowNum;
|
||||||
$.each(item, function (cell_num, i) {
|
$.each(item, function (cell_num, i) {
|
||||||
if (i !== null) {
|
if (i !== null) {
|
||||||
if (replaceLatLngWithMap && i.match(/[+-]?\d+([.]\d+)?[;][+-]?\d+([.]\d+)?/gm)) { /* credits to @visoom https://github.com/visoom */
|
if (replaceLatLngWithMap && i.match(/[+-]?\d+([.]\d+)?[;][+-]?\d+([.]\d+)?/gm)) { /* credits to @visoom https://github.com/visoom */
|
||||||
|
@ -25,9 +25,9 @@ export default async function fillTable ({ data, replaceLatLngWithMap = false, c
|
||||||
const lng = i.split(";")[1];
|
const lng = i.split(";")[1];
|
||||||
const mapDiv = document.createElement("div");
|
const mapDiv = document.createElement("div");
|
||||||
mapDiv.className = "map";
|
mapDiv.className = "map";
|
||||||
mapDiv.id = "map-" + row_num;
|
mapDiv.id = "map-" + rowNum;
|
||||||
const mapScript = document.createElement("script");
|
const mapScript = document.createElement("script");
|
||||||
mapScript.appendChild(document.createTextNode("load_map(" + lat + ", " + lng + ", \"map-" + row_num + "\", false)"));
|
mapScript.appendChild(document.createTextNode("loadMap(" + lat + ", " + lng + ", \"map-" + rowNum + "\", false)"));
|
||||||
mapDiv.appendChild(mapScript);
|
mapDiv.appendChild(mapScript);
|
||||||
const cell = document.createElement("td");
|
const cell = document.createElement("td");
|
||||||
cell.appendChild(mapDiv);
|
cell.appendChild(mapDiv);
|
||||||
|
@ -56,19 +56,19 @@ export default async function fillTable ({ data, replaceLatLngWithMap = false, c
|
||||||
loadedLanguage = {};
|
loadedLanguage = {};
|
||||||
}
|
}
|
||||||
if (!$.fn.DataTable.isDataTable("#table")) {
|
if (!$.fn.DataTable.isDataTable("#table")) {
|
||||||
var table_dt = $("#table").DataTable({
|
var setableDt = $("#table").DataTable({
|
||||||
responsive: true,
|
responsive: true,
|
||||||
language: loadedLanguage,
|
language: loadedLanguage,
|
||||||
buttons: ["excel", "pdf", "csv"]
|
buttons: ["excel", "pdf", "csv"]
|
||||||
});
|
});
|
||||||
table_dt.buttons().container()
|
setableDt.buttons().container()
|
||||||
.appendTo("#table_wrapper :nth-child(1):eq(0)");
|
.appendTo("#table_wrapper :nth-child(1):eq(0)");
|
||||||
|
|
||||||
if (callback !== false) {
|
if (callback !== false) {
|
||||||
callback(table_dt);
|
callback(setableDt);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
table_dt.rows().invalidate();
|
setableDt.rows().invalidate();
|
||||||
}
|
}
|
||||||
window.table_dt = table_dt;
|
window.setableDt = setableDt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
export default async function fillTable ({ data, replaceLatLngWithMap = false, callback = false }) {
|
export default async function fillTable ({ data, replaceLatLngWithMap = false, callback = false }) {
|
||||||
$("#table_body").empty();
|
$("#table_body").empty();
|
||||||
$.each(data, function (row_num, item) {
|
$.each(data, function (rowNum, item) {
|
||||||
const row = document.createElement("tr");
|
const row = document.createElement("tr");
|
||||||
row.id = "row-" + row_num;
|
row.id = "row-" + rowNum;
|
||||||
$.each(item, function (cell_num, i) {
|
$.each(item, function (cell_num, i) {
|
||||||
if (i !== null) {
|
if (i !== null) {
|
||||||
if (replaceLatLngWithMap && i.match(/[+-]?\d+([.]\d+)?[;][+-]?\d+([.]\d+)?/gm)) { /* credits to @visoom https://github.com/visoom */
|
if (replaceLatLngWithMap && i.match(/[+-]?\d+([.]\d+)?[;][+-]?\d+([.]\d+)?/gm)) { /* credits to @visoom https://github.com/visoom */
|
||||||
|
@ -10,9 +10,9 @@ export default async function fillTable ({ data, replaceLatLngWithMap = false, c
|
||||||
const lng = i.split(";")[1];
|
const lng = i.split(";")[1];
|
||||||
const mapDiv = document.createElement("div");
|
const mapDiv = document.createElement("div");
|
||||||
mapDiv.className = "map";
|
mapDiv.className = "map";
|
||||||
mapDiv.id = "map-" + row_num;
|
mapDiv.id = "map-" + rowNum;
|
||||||
const mapScript = document.createElement("script");
|
const mapScript = document.createElement("script");
|
||||||
mapScript.appendChild(document.createTextNode("load_map(" + lat + ", " + lng + ", \"map-" + row_num + "\", false)"));
|
mapScript.appendChild(document.createTextNode("loadMap(" + lat + ", " + lng + ", \"map-" + rowNum + "\", false)"));
|
||||||
mapDiv.appendChild(mapScript);
|
mapDiv.appendChild(mapScript);
|
||||||
const cell = document.createElement("td");
|
const cell = document.createElement("td");
|
||||||
cell.appendChild(mapDiv);
|
cell.appendChild(mapDiv);
|
||||||
|
|
|
@ -3,14 +3,14 @@ const common = require("./webpack.common.js");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
|
||||||
const AfterBuildPlugin = require("@fiverr/afterbuild-webpack-plugin");
|
const AfterBuildPlugin = require("@fiverr/afterbuild-webpack-plugin");
|
||||||
const child_process = require("child_process");
|
const childProcess = require("childProcess");
|
||||||
const InjectPlugin = require("webpack-inject-plugin").default;
|
const InjectPlugin = require("webpack-inject-plugin").default;
|
||||||
const colors = require("colors/safe");
|
const colors = require("colors/safe");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
|
|
||||||
function git(command) {
|
function git(command) {
|
||||||
return child_process.execSync(`git ${command}`, { encoding: "utf8" }).trim();
|
return childProcess.execSync(`git ${command}`, { encoding: "utf8" }).trim();
|
||||||
}
|
}
|
||||||
var webpack = require("webpack");
|
var webpack = require("webpack");
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ const removeSourceMapUrlAfterBuild = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
var configFile = require("./config.json");
|
var configFile = require("./config.json");
|
||||||
const sentry_enabled = configFile.sentry_enabled &&
|
const sentryEnabled = configFile.sentryEnabled &&
|
||||||
configFile.sentry_auth_token &&
|
configFile.sentryAuthToken &&
|
||||||
configFile.sentry_organization &&
|
configFile.sentryOrganization &&
|
||||||
configFile.sentry_project;
|
configFile.sentryProject;
|
||||||
|
|
||||||
var prod_config = {
|
var prodConfig = {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
devtool: false,
|
devtool: false,
|
||||||
module: {
|
module: {
|
||||||
|
@ -75,31 +75,31 @@ var prod_config = {
|
||||||
minimizer: [new TerserPlugin({
|
minimizer: [new TerserPlugin({
|
||||||
parallel: true,
|
parallel: true,
|
||||||
extractComments: true,
|
extractComments: true,
|
||||||
sourceMap: sentry_enabled ? true : false
|
sourceMap: sentryEnabled ? true : false
|
||||||
})]
|
})]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = (env) => {
|
module.exports = (env) => {
|
||||||
//run webpack build with "--env sentry_environment=custom-sentry-env" to replace Sentry environment
|
//run webpack build with "--env sentryEnvironment=custom-sentry-env" to replace Sentry environment
|
||||||
if(env.sentry_environment){
|
if(env.sentryEnvironment){
|
||||||
console.log(colors.green("INFO using custom sentry_environment "+env.sentry_environment));
|
console.log(colors.green("INFO using custom sentryEnvironment "+env.sentryEnvironment));
|
||||||
configFile.sentry_environment = env.sentry_environment;
|
configFile.sentryEnvironment = env.sentryEnvironment;
|
||||||
}
|
}
|
||||||
if(!configFile.sentry_environment){
|
if(!configFile.sentryEnvironment){
|
||||||
configFile.sentry_environment = "prod";
|
configFile.sentryEnvironment = "prod";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sentry_enabled){
|
if(sentryEnabled){
|
||||||
prod_config.plugins.push(
|
prodConfig.plugins.push(
|
||||||
new webpack.SourceMapDevToolPlugin({
|
new webpack.SourceMapDevToolPlugin({
|
||||||
filename: "[file].map"
|
filename: "[file].map"
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new SentryWebpackPlugin({
|
new SentryWebpackPlugin({
|
||||||
authToken: configFile.sentry_auth_token,
|
authToken: configFile.sentryAuthToken,
|
||||||
org: configFile.sentry_organization,
|
org: configFile.sentryOrganization,
|
||||||
project: configFile.sentry_project,
|
project: configFile.sentryProject,
|
||||||
urlPrefix: "~/dist",
|
urlPrefix: "~/dist",
|
||||||
include: "./dist",
|
include: "./dist",
|
||||||
setCommits: {
|
setCommits: {
|
||||||
|
@ -117,7 +117,7 @@ module.exports = (env) => {
|
||||||
console.log(colors.green("INFO Sentry Webpack plugins enabled"));
|
console.log(colors.green("INFO Sentry Webpack plugins enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
prod_config.plugins.push(
|
prodConfig.plugins.push(
|
||||||
new webpack.EnvironmentPlugin({
|
new webpack.EnvironmentPlugin({
|
||||||
GIT_VERSION: git("describe --always"),
|
GIT_VERSION: git("describe --always"),
|
||||||
GIT_AUTHOR_DATE: git("log -1 --format=%aI"),
|
GIT_AUTHOR_DATE: git("log -1 --format=%aI"),
|
||||||
|
@ -126,5 +126,5 @@ module.exports = (env) => {
|
||||||
config: configFile
|
config: configFile
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return merge(common, prod_config);
|
return merge(common, prodConfig);
|
||||||
}
|
}
|
|
@ -82,12 +82,12 @@
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="search">
|
<div id="search">
|
||||||
<input type="text" name="addr" value="" id="addr" size="10" />
|
<input type="text" name="addr" value="" id="addr" size="10" />
|
||||||
<button type="button" onclick="addr_search('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
|
<button type="button" onclick="addrSearch('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
|
||||||
class="btn btn-primary">{{ 'Search'|t }}</button>
|
class="btn btn-primary">{{ 'Search'|t }}</button>
|
||||||
<div id="results"></div>
|
<div id="results"></div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="place" value="" />
|
<input type="hidden" name="place" value="" />
|
||||||
<script src="{{ urlsoftware }}/resources/dist/{{ resource('maps.js') }}" onload="load_map();"></script>
|
<script src="{{ urlsoftware }}/resources/dist/{{ resource('maps.js') }}" onload="loadMap();"></script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<label><b>{{ 'Service place'|t }}</b></label>
|
<label><b>{{ 'Service place'|t }}</b></label>
|
||||||
<input type="text" name="place" required value="{{ values.place }}">
|
<input type="text" name="place" required value="{{ values.place }}">
|
||||||
|
|
|
@ -67,12 +67,12 @@
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
<div id="search">
|
<div id="search">
|
||||||
<input type="text" name="addr" value="" id="addr" size="10" />
|
<input type="text" name="addr" value="" id="addr" size="10" />
|
||||||
<button type="button" onclick="addr_search('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
|
<button type="button" onclick="addrSearch('{{ 'Search results'|t }}', '{{ 'No results found'|t }}');"
|
||||||
class="btn btn-primary">{{ 'Search'|t }}</button>
|
class="btn btn-primary">{{ 'Search'|t }}</button>
|
||||||
<div id="results"></div>
|
<div id="results"></div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="place" value="" />
|
<input type="hidden" name="place" value="" />
|
||||||
<script src="{{ urlsoftware }}/resources/dist/{{ resource('maps.js') }}" onload="load_map();"></script>
|
<script src="{{ urlsoftware }}/resources/dist/{{ resource('maps.js') }}" onload="loadMap();"></script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<label><b>{{ 'Training place'|t }}</b></label>
|
<label><b>{{ 'Training place'|t }}</b></label>
|
||||||
<input type="text" name="place" required value="{{ values.place }}">
|
<input type="text" name="place" required value="{{ values.place }}">
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
toastr.success(`{{ 'Thanks, %s, you have given %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
toastr.success(`{{ 'Thanks, %s, you have given %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
||||||
clearInterval(window.loadTableInterval); //stop reloading
|
clearInterval(window.loadTableInterval); //stop reloading
|
||||||
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
|
loadTable({tablePage: "list", useCustomTableEngine: "default"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
toastr.success(`{{ 'Thanks, %s, you have removed %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
toastr.success(`{{ 'Thanks, %s, you have removed %s in case of alert.'|t|format(user.name, '${generate_alert_string(id)}') }}`);
|
||||||
clearInterval(window.loadTableInterval); //stop reloading
|
clearInterval(window.loadTableInterval); //stop reloading
|
||||||
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
|
loadTable({tablePage: "list", useCustomTableEngine: "default"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<script>
|
<script>
|
||||||
loadTable({tablePage: "list", use_custom_tableEngine: "default"});
|
loadTable({tablePage: "list", useCustomTableEngine: "default"});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<script>
|
<script>
|
||||||
loadTable({tablePage: "log", set_interval: false, callback: function(table_dt) {
|
loadTable({tablePage: "log", setInterval: false, callback: function(setableDt) {
|
||||||
table_dt
|
setableDt
|
||||||
.column( '3:visible' )
|
.column( '3:visible' )
|
||||||
.order( 'desc' )
|
.order( 'desc' )
|
||||||
.draw();
|
.draw();
|
||||||
|
|
Loading…
Reference in New Issue