Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![](https://img.shields.io/badge/tutorials-cesnet--tszoo-blue.svg)](https://github.com/CESNET/cesnet-ts-zoo-tutorials)
[![](https://img.shields.io/badge/python->=3.10-blue.svg)](https://pypi.org/project/cesnet-tszoo/)
[![](https://img.shields.io/pypi/v/cesnet-tszoo)](https://pypi.org/project/cesnet-tszoo/)
[![Storage Status](https://img.shields.io/uptimerobot/status/m801936469-e8219ca3245b73b08cf33ef4?label=storage%20status)](https://stats.uptimerobot.com/6a75HRSoRU)

The goal of `cesnet-tszoo` project is to provide time series datasets with useful tools for preprocessing and reproducibility. Such as:

Expand Down
77 changes: 77 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{% extends "base.html" %}

{% block header %}

<!-- Custom Banner -->
<div id="librouter-status" class="banner" style="display:none;">
<p id="librouter-status-text" class="banner-text"></p>
</div>

<!-- Original Header -->
{{ super() }}
{% endblock %}

{% block scripts %}
{{ super() }}

<script>
function isLocalStorageAvailable() {
try {
const testKey = "permTest";
localStorage.setItem(testKey, testKey);
localStorage.removeItem(testKey);
return true;
} catch (e) {
return false;
}
}

async function checkRouterUptime() {
try {
const result = await fetch("https://api.uptimerobot.com/v2/getMonitors?api_key=m801936469-e8219ca3245b73b08cf33ef4&monitors=801936469", {
method: "POST",
headers: {
"Content-Type": "application/json"
}
})
.then(res => res.json())

const storageStatusCode = result.monitors?.[0].status;
localStorage.setItem("lastStorageStatusCode", storageStatusCode);

} catch (e) {
localStorage.setItem("lastStorageStatusCode", -1);
console.warn("Unexpected error happened: ${e}")
}
}

if (isLocalStorageAvailable()) {
const lastCheck = parseInt(localStorage.getItem("lastStorageStatusCheck") || "0", 10);
const now = Date.now();
const FIVE_MINUTES = 5 * 60 * 1000;

if (now - lastCheck > FIVE_MINUTES) {
checkRouterUptime();
localStorage.setItem("lastStorageStatusCheck", now);
}

const banner = document.getElementById("librouter-status");
const bannerText = document.getElementById("librouter-status-text");

const storageStatusCode = parseInt(localStorage.getItem("lastStorageStatusCode") || "-1", 10);

if (storageStatusCode == 2 || storageStatusCode == -1) {
bannerText.textContent = ""
banner.style.display = "none"
}
else {
bannerText.textContent = "Storage server is DOWN.";
banner.style.display = "block"
}
}
else {
console.warn("Local storage is not available. Up status check skipped.");
}

</script>
{% endblock %}
17 changes: 17 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.banner {
height: 30;
position: sticky;
top: 0;
left: 0;
padding: 10px 0;
width: 100%;
z-index: 1;
text-align: center;
background-color: rgb(240, 73, 83);
}

.banner-text {
color: white;
display: inline;
font-size: 24px;
}
7 changes: 6 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ repo_url: https://github.com/CESNET/cesnet-tszoo

theme:
name: "material"
custom_dir: docs/overrides
palette:
primary: white
primary: white
features:
- navigation.sections
- announce.autohide
logo: images/tszoo_logo.svg
favicon: images/tszoo_logo.svg

extra_css:
- stylesheets/extra.css

plugins:
- search
Expand Down