mirror of
https://github.com/KevinMidboe/ISPDowntimeMonitor.git
synced 2025-10-29 17:50:12 +00:00
/site contains static start of frontend.
Started a frontend for displaying the information collected. - Need dynamic data. - Needs a webserver to serve page.
This commit is contained in:
28
src/site/fetchUptimeAndGenerateBarGraph.js
Normal file
28
src/site/fetchUptimeAndGenerateBarGraph.js
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
const createEvent = () => {
|
||||
const event = document.createElement('div')
|
||||
event.className = 'event';
|
||||
const tooltip = document.createElement('span');
|
||||
tooltip.className = 'tooltip';
|
||||
const tooltipContent = new Date().toLocaleString()
|
||||
tooltip.innerText = tooltipContent;
|
||||
|
||||
event.appendChild(tooltip);
|
||||
return event;
|
||||
}
|
||||
|
||||
function fetchUptimeAndGenerateBarGraph(instances=10) {
|
||||
const graph = document.getElementById('bar-graph');
|
||||
|
||||
const event = createEvent()
|
||||
|
||||
for (var i = instances; i >= 0; i--) {
|
||||
const clone = event.cloneNode(true)
|
||||
Math.random() > 0.95 ? clone.className += ' error' : null;
|
||||
graph.appendChild(clone)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fetchUptimeAndGenerateBarGraph(20)
|
||||
fetchUptimeAndGenerateBarGraph(60)
|
||||
Reference in New Issue
Block a user