|
@@ -1,4 +1,6 @@
|
|
|
-var SignalAbortFetch = null;
|
|
|
|
|
|
|
+//import {ModalEslDetails} from 'ModalEslDetails';
|
|
|
|
|
+
|
|
|
|
|
+let modalEslDetails = new ModalEslDetails();
|
|
|
|
|
|
|
|
const fetchHeaders = {
|
|
const fetchHeaders = {
|
|
|
'Accept': 'text/html',
|
|
'Accept': 'text/html',
|
|
@@ -9,12 +11,14 @@ const fetchHeaders = {
|
|
|
'Expires': '0'
|
|
'Expires': '0'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-$(function () {
|
|
|
|
|
|
|
+// MAIN JS
|
|
|
|
|
+document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
|
+
|
|
|
$.fn.dataTable.ext.order['dom-checkbox'] = function (settings, col) {
|
|
$.fn.dataTable.ext.order['dom-checkbox'] = function (settings, col) {
|
|
|
return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
|
|
return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
|
|
|
- return $('input', td).prop('checked') ? '1' : '0';
|
|
|
|
|
|
|
+ return $(td).closest('tr').hasClass('selected') ? '1' : '0';
|
|
|
});
|
|
});
|
|
|
- };
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// DataTable fix
|
|
// DataTable fix
|
|
|
$("#datatable").DataTable({
|
|
$("#datatable").DataTable({
|
|
@@ -30,19 +34,21 @@ $(function () {
|
|
|
height: "50vh"
|
|
height: "50vh"
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- "columnDefs": [
|
|
|
|
|
- {"orderDataType": "dom-checkbox", "targets": 0},
|
|
|
|
|
- {'orderable': false, "targets": -1}
|
|
|
|
|
- ]
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $('.statusmodal').on('shown.bs.modal', function () {
|
|
|
|
|
- labelID = $('.statusmodal #labelID').html();
|
|
|
|
|
- refreshESLStatus(labelID);
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $('.statusmodal').on('hide.bs.modal', function () {
|
|
|
|
|
- SignalAbortFetch.abort();
|
|
|
|
|
|
|
+ columnDefs: [
|
|
|
|
|
+ {
|
|
|
|
|
+ targets: 0,
|
|
|
|
|
+ className: 'select-checkbox',
|
|
|
|
|
+ orderDataType: "dom-checkbox"
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ targets: -1,
|
|
|
|
|
+ orderable: false
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ select: {
|
|
|
|
|
+ style: 'multi',
|
|
|
|
|
+ selector: 'td:first-child',
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -94,60 +100,5 @@ function LoadConfig() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function OpenESLDetails(labelID) {
|
|
function OpenESLDetails(labelID) {
|
|
|
- SignalAbortFetch = new AbortController();
|
|
|
|
|
-
|
|
|
|
|
- $('#esl_rssi_list').html('');
|
|
|
|
|
- $('#svgpath').removeAttr('src');
|
|
|
|
|
-
|
|
|
|
|
- $('.statusmodal #labelID').html(labelID);
|
|
|
|
|
- $('.statusmodal').modal('show');
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function fillESLDetails(ESLstatus) {
|
|
|
|
|
- $('#esl_rssi_list').html('');
|
|
|
|
|
- $('#svgpath').removeAttr('src');
|
|
|
|
|
-
|
|
|
|
|
- $('#esl_rssi').html(ESLstatus.value.status.rssi);
|
|
|
|
|
- $('#hello').html(ESLstatus.value.status.hello_period);
|
|
|
|
|
- $('#blink_count').html(ESLstatus.value.status.blink_count);
|
|
|
|
|
- let hardver = `${ESLstatus.value.status.hard_major}.${ESLstatus.value.status.hard_minor}.${ESLstatus.value.status.hard_patch}`;
|
|
|
|
|
- let softver = `${ESLstatus.value.status.soft_major}.${ESLstatus.value.status.soft_minor}.${ESLstatus.value.status.soft_patch}`;
|
|
|
|
|
- $('#hardware_ver').html(hardver);
|
|
|
|
|
- $('#software_ver').html(softver);
|
|
|
|
|
-
|
|
|
|
|
- for (let [ap, rssi] of Object.entries(ESLstatus.value.rssi)) {
|
|
|
|
|
- let ap_rssi = `<div><span class="badge badge-primary">${ap}</span><span class="badge text-inverse badge-warning">${rssi}</span></div>`;
|
|
|
|
|
- $('#esl_rssi_list').append(ap_rssi);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (ESLstatus.svgPath != null)
|
|
|
|
|
- $('#svgpath').prop('src', BASEURL + '/' + ESLstatus.svgPath);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function refreshESLStatus(labelID) {
|
|
|
|
|
- $('#spinnerloader').removeClass('d-none');
|
|
|
|
|
-
|
|
|
|
|
- AjaxReq(`${BASEURL}/admin/config`, {
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
- body: JSON.stringify({"method": "geteslstatus", "label_id": labelID}),
|
|
|
|
|
- signal: SignalAbortFetch.signal
|
|
|
|
|
- })
|
|
|
|
|
- .then(json => {
|
|
|
|
|
- fillESLDetails(json);
|
|
|
|
|
- toastr.success(json.err);
|
|
|
|
|
- if ($('.statusmodal').is(':visible'))
|
|
|
|
|
- setTimeout(function () {
|
|
|
|
|
- refreshESLStatus(labelID);
|
|
|
|
|
- }, 3000);
|
|
|
|
|
- })
|
|
|
|
|
- .catch(err => {
|
|
|
|
|
- if (err.name == 'AbortError')
|
|
|
|
|
- return;
|
|
|
|
|
- if (err.url !== undefined)
|
|
|
|
|
- toastr.error(err.url, `${err.status} (${err.statusText})`);
|
|
|
|
|
- else
|
|
|
|
|
- toastr.error(err);
|
|
|
|
|
- }).finally(function () {
|
|
|
|
|
- $('#spinnerloader').addClass('d-none');
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ modalEslDetails.OpenESLDetails(labelID);
|
|
|
}
|
|
}
|