Fix Nav and lost position on refresh
This commit is contained in:
@@ -1174,6 +1174,12 @@ function getDeviceData (readAllData=false) {
|
|||||||
|
|
||||||
mac =deviceData['dev_MAC'];
|
mac =deviceData['dev_MAC'];
|
||||||
|
|
||||||
|
// update the mac parameter in the URL, this makes the selected device persistent when the page is reloaded
|
||||||
|
var searchParams = new URLSearchParams(window.location.search);
|
||||||
|
searchParams.set("mac", mac);
|
||||||
|
var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
|
||||||
|
history.pushState(null, '', newRelativePathQuery);
|
||||||
|
|
||||||
$('#txtMAC').val (deviceData['dev_MAC']);
|
$('#txtMAC').val (deviceData['dev_MAC']);
|
||||||
$('#txtName').val (deviceData['dev_Name']);
|
$('#txtName').val (deviceData['dev_Name']);
|
||||||
$('#txtOwner').val (deviceData['dev_Owner']);
|
$('#txtOwner').val (deviceData['dev_Owner']);
|
||||||
@@ -1233,7 +1239,7 @@ function getDeviceData (readAllData=false) {
|
|||||||
$('#btnNext').removeAttr ('disabled');
|
$('#btnNext').removeAttr ('disabled');
|
||||||
$('#btnNext').removeClass ('text-gray50');
|
$('#btnNext').removeClass ('text-gray50');
|
||||||
}
|
}
|
||||||
|
getSessionsPresenceEvents();
|
||||||
// Timer for refresh data
|
// Timer for refresh data
|
||||||
$("body").css("cursor", "default");
|
$("body").css("cursor", "default");
|
||||||
newTimerRefreshData (getDeviceData);
|
newTimerRefreshData (getDeviceData);
|
||||||
@@ -1372,13 +1378,16 @@ function deleteDevice () {
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
function getSessionsPresenceEvents () {
|
function getSessionsPresenceEvents () {
|
||||||
|
// Check MAC in url
|
||||||
|
var urlParams = new URLSearchParams(window.location.search);
|
||||||
|
mac = urlParams.get ('mac');
|
||||||
// Define Sessions datasource and query dada
|
// Define Sessions datasource and query dada
|
||||||
$('#tableSessions').DataTable().ajax.url('php/server/events.php?action=getDeviceSessions&mac=' + mac +'&period='+ period).load();
|
$('#tableSessions').DataTable().ajax.url('php/server/events.php?action=getDeviceSessions&mac=' + mac +'&period='+ period).load();
|
||||||
|
|
||||||
// Define Presence datasource and query data
|
// Define Presence datasource and query data
|
||||||
$('#calendar').fullCalendar('removeEventSources');
|
$('#calendar').fullCalendar('removeEventSources');
|
||||||
$('#calendar').fullCalendar('addEventSource',
|
$('#calendar').fullCalendar('addEventSource',
|
||||||
{ url: 'php/server/events.php?action=getDevicePresence&mac=' + mac +'&period='+ period });
|
{ url: 'php/server/events.php?action=getDevicePresence&mac=' + mac +'&period='+ period });
|
||||||
|
|
||||||
// Query events
|
// Query events
|
||||||
getDeviceEvents();
|
getDeviceEvents();
|
||||||
|
|||||||
Reference in New Issue
Block a user