Remove app-version
This commit is contained in:
parent
259c3ccf5c
commit
bc58c081c3
2 changed files with 29 additions and 30 deletions
|
@ -316,61 +316,61 @@
|
||||||
<script>
|
<script>
|
||||||
let systemSSESource = null;
|
let systemSSESource = null;
|
||||||
let weatherSSESource = null;
|
let weatherSSESource = null;
|
||||||
addEventListener("beforeunload", () => {
|
addEventListener('beforeunload', () => {
|
||||||
systemSSESource && systemSSESource.close();
|
systemSSESource && systemSSESource.close();
|
||||||
weatherSSESource && weatherSSESource.close();
|
weatherSSESource && weatherSSESource.close();
|
||||||
});
|
});
|
||||||
systemSSESource = new EventSource("/sse?stream=system");
|
systemSSESource = new EventSource('/sse?stream=system');
|
||||||
systemSSESource.onmessage = (e) => {
|
systemSSESource.onmessage = (e) => {
|
||||||
const parsed = JSON.parse(e.data);
|
const parsed = JSON.parse(e.data);
|
||||||
replaceSystem(parsed);
|
replaceSystem(parsed);
|
||||||
};
|
};
|
||||||
weatherSSESource = new EventSource("/sse?stream=weather");
|
weatherSSESource = new EventSource('/sse?stream=weather');
|
||||||
weatherSSESource.onmessage = (e) => {
|
weatherSSESource.onmessage = (e) => {
|
||||||
const parsed = JSON.parse(e.data);
|
const parsed = JSON.parse(e.data);
|
||||||
replaceWeather(parsed);
|
replaceWeather(parsed);
|
||||||
};
|
};
|
||||||
|
|
||||||
// weather elements
|
// weather elements
|
||||||
const weatherIcon = document.getElementById("weatherIcon");
|
const weatherIcon = document.getElementById('weatherIcon');
|
||||||
const weatherTemp = document.getElementById("weatherTemp");
|
const weatherTemp = document.getElementById('weatherTemp');
|
||||||
const weatherDescription = document.getElementById("weatherDescription");
|
const weatherDescription = document.getElementById('weatherDescription');
|
||||||
const weatherHumidity = document.getElementById("weatherHumidity");
|
const weatherHumidity = document.getElementById('weatherHumidity');
|
||||||
const weatherSunrise = document.getElementById("weatherSunrise");
|
const weatherSunrise = document.getElementById('weatherSunrise');
|
||||||
const weatherSunset = document.getElementById("weatherSunset");
|
const weatherSunset = document.getElementById('weatherSunset');
|
||||||
|
|
||||||
// system elements
|
// system elements
|
||||||
const systemCpuPercentage = document.getElementById("systemCpuPercentage");
|
const systemCpuPercentage = document.getElementById('systemCpuPercentage');
|
||||||
const systemRamPercentage = document.getElementById("systemRamPercentage");
|
const systemRamPercentage = document.getElementById('systemRamPercentage');
|
||||||
const systemRamValue = document.getElementById("systemRamValue");
|
const systemRamValue = document.getElementById('systemRamValue');
|
||||||
const systemDiskPercentage = document.getElementById("systemDiskPercentage");
|
const systemDiskPercentage = document.getElementById('systemDiskPercentage');
|
||||||
const systemDiskValue = document.getElementById("systemDiskValue");
|
const systemDiskValue = document.getElementById('systemDiskValue');
|
||||||
const systemUptimePercentage = document.getElementById("systemUptimePercentage");
|
const systemUptimePercentage = document.getElementById('systemUptimePercentage');
|
||||||
const uptimeDays = document.getElementById("uptimeDays");
|
const uptimeDays = document.getElementById('uptimeDays');
|
||||||
const uptimeHours = document.getElementById("uptimeHours");
|
const uptimeHours = document.getElementById('uptimeHours');
|
||||||
const uptimeMinutes = document.getElementById("uptimeMinutes");
|
const uptimeMinutes = document.getElementById('uptimeMinutes');
|
||||||
const uptimeSeconds = document.getElementById("uptimeSeconds");
|
const uptimeSeconds = document.getElementById('uptimeSeconds');
|
||||||
|
|
||||||
function replaceWeather(parsed) {
|
function replaceWeather(parsed) {
|
||||||
weatherIcon.setAttribute("xlink:href", "#" + parsed.icon);
|
weatherIcon.setAttribute('xlink:href', '#' + parsed.icon);
|
||||||
weatherTemp.innerText = parsed.temp;
|
weatherTemp.innerText = parsed.temp;
|
||||||
weatherDescription.innerText = parsed.description;
|
weatherDescription.innerText = parsed.description;
|
||||||
weatherHumidity.innerText = parsed.humidity + "%";
|
weatherHumidity.innerText = parsed.humidity + '%';
|
||||||
weatherSunrise.innerText = parsed.sunrise;
|
weatherSunrise.innerText = parsed.sunrise;
|
||||||
weatherSunset.innerText = parsed.sunset;
|
weatherSunset.innerText = parsed.sunset;
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceSystem(parsed) {
|
function replaceSystem(parsed) {
|
||||||
systemCpuPercentage.style = "width:" + parsed.cpu + "%";
|
systemCpuPercentage.style = 'width:' + parsed.cpu + '%';
|
||||||
systemRamPercentage.style = "width:" + parsed.ram.percentage + "%";
|
systemRamPercentage.style = 'width:' + parsed.ram.percentage + '%';
|
||||||
systemRamValue.innerText = parsed.ram.value;
|
systemRamValue.innerText = parsed.ram.value;
|
||||||
systemDiskPercentage.style = "width:" + parsed.disk.percentage + "%";
|
systemDiskPercentage.style = 'width:' + parsed.disk.percentage + '%';
|
||||||
systemDiskValue.innerText = parsed.disk.value;
|
systemDiskValue.innerText = parsed.disk.value;
|
||||||
systemUptimePercentage.style = "width:" + parsed.uptime.percentage + "%";
|
systemUptimePercentage.style = 'width:' + parsed.uptime.percentage + '%';
|
||||||
uptimeDays.style = "--value:" + parsed.uptime.days;
|
uptimeDays.style = '--value:' + parsed.uptime.days;
|
||||||
uptimeHours.style = "--value:" + parsed.uptime.hours;
|
uptimeHours.style = '--value:' + parsed.uptime.hours;
|
||||||
uptimeMinutes.style = "--value:" + parsed.uptime.minutes;
|
uptimeMinutes.style = '--value:' + parsed.uptime.minutes;
|
||||||
uptimeSeconds.style = "--value:" + parsed.uptime.seconds;
|
uptimeSeconds.style = '--value:' + parsed.uptime.seconds;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="absolute top-2 right-3 text-xs text-gray-500">{{ env "APP_VERSION" }}</div>
|
|
||||||
<div class="p-4 sm:p-6 lg:p-8 xl:container xl:py-12">{{ block "content" . }}{{ end }}</div>
|
<div class="p-4 sm:p-6 lg:p-8 xl:container xl:py-12">{{ block "content" . }}{{ end }}</div>
|
||||||
{{ block "js". }}{{ end }}
|
{{ block "js". }}{{ end }}
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue