T272 history loads last 24h upon click
This commit is contained in:
		| @@ -40,6 +40,8 @@ function getData(){ | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function checkUuid(){ | function checkUuid(){ | ||||||
|     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ |     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ | ||||||
|         clientUUID = json[0].clientUUID; |         clientUUID = json[0].clientUUID; | ||||||
|   | |||||||
| @@ -52,6 +52,13 @@ function loadHistory(dateFrom, dateTo){ | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function getLast24hHistoryData(){ | ||||||
|  |     $.getJSON(host + '/api/event/' + clientUUID + '/' + lastId, function(data){ | ||||||
|  |         historyJson = data; | ||||||
|  |         displayHistory(); | ||||||
|  |     }); | ||||||
|  | } | ||||||
|  |  | ||||||
| function historyToHtml(){ | function historyToHtml(){ | ||||||
|     var innerHTML = ''; |     var innerHTML = ''; | ||||||
|     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; |     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; | ||||||
|   | |||||||
| @@ -22,8 +22,9 @@ function changeAdvancedVisibility(){ | |||||||
|     setCookie(); |     setCookie(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | const historyFilter = $('#history-filter'); | ||||||
| const historyFilterSwitch = function(){ | const historyFilterSwitch = function(){ | ||||||
|     $('#history-filter').toggleClass('active'); |     historyFilter.toggleClass('active'); | ||||||
| } | } | ||||||
|  |  | ||||||
| $("#optional").click(changeAdvancedVisibility); | $("#optional").click(changeAdvancedVisibility); | ||||||
| @@ -40,8 +41,16 @@ function showHistory(){ | |||||||
|     $('#history').addClass('active'); |     $('#history').addClass('active'); | ||||||
|     $('#historyTab').addClass('active'); |     $('#historyTab').addClass('active'); | ||||||
|     $('#historyTab').off('click'); |     $('#historyTab').off('click'); | ||||||
|  |     initializeHistory(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function initializeHistory(){ | ||||||
|  |     historyFilter.removeClass('active'); | ||||||
|  |     getLast24hHistoryData(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function showHeaders(){ | function showHeaders(){ | ||||||
|     $('#historyTab').click(showHistory); |     $('#historyTab').click(showHistory); | ||||||
|     tabitem.removeClass('active'); |     tabitem.removeClass('active'); | ||||||
|   | |||||||
| @@ -40,6 +40,8 @@ function getData(){ | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function checkUuid(){ | function checkUuid(){ | ||||||
|     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ |     if(clientUUID == null || clientUUID == undefined || clientUUID == ''){ | ||||||
|         clientUUID = json[0].clientUUID; |         clientUUID = json[0].clientUUID; | ||||||
|   | |||||||
| @@ -52,6 +52,13 @@ function loadHistory(dateFrom, dateTo){ | |||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function getLast24hHistoryData(){ | ||||||
|  |     $.getJSON(host + '/api/event/' + clientUUID + '/' + lastId, function(data){ | ||||||
|  |         historyJson = data; | ||||||
|  |         displayHistory(); | ||||||
|  |     }); | ||||||
|  | } | ||||||
|  |  | ||||||
| function historyToHtml(){ | function historyToHtml(){ | ||||||
|     var innerHTML = ''; |     var innerHTML = ''; | ||||||
|     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; |     var iterations = historyJson.length <= maxIterations ? historyJson.length : maxIterations; | ||||||
|   | |||||||
| @@ -22,8 +22,9 @@ function changeAdvancedVisibility(){ | |||||||
|     setCookie(); |     setCookie(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | const historyFilter = $('#history-filter'); | ||||||
| const historyFilterSwitch = function(){ | const historyFilterSwitch = function(){ | ||||||
|     $('#history-filter').toggleClass('active'); |     historyFilter.toggleClass('active'); | ||||||
| } | } | ||||||
|  |  | ||||||
| $("#optional").click(changeAdvancedVisibility); | $("#optional").click(changeAdvancedVisibility); | ||||||
| @@ -40,8 +41,16 @@ function showHistory(){ | |||||||
|     $('#history').addClass('active'); |     $('#history').addClass('active'); | ||||||
|     $('#historyTab').addClass('active'); |     $('#historyTab').addClass('active'); | ||||||
|     $('#historyTab').off('click'); |     $('#historyTab').off('click'); | ||||||
|  |     initializeHistory(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function initializeHistory(){ | ||||||
|  |     historyFilter.removeClass('active'); | ||||||
|  |     getLast24hHistoryData(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| function showHeaders(){ | function showHeaders(){ | ||||||
|     $('#historyTab').click(showHistory); |     $('#historyTab').click(showHistory); | ||||||
|     tabitem.removeClass('active'); |     tabitem.removeClass('active'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user