Skip to content

Commit

Permalink
New "server updates" page
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Oct 16, 2023
1 parent bd2ea5e commit 196bda0
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def rearrange_history(history):
new_history = []
for server, moves in history.items():
# Ignore the first move
for move in moves[1:]:
for move in moves:
if "1970-01-01" in move["date"]:
continue
new_history.append(
{
"date": datetime.datetime.fromisoformat(move["date"]),
Expand Down
134 changes: 134 additions & 0 deletions docs/updates.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta name="description" content="">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Google Fonts Dashboard</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<style>
.material-symbols-outlined {
font-variation-settings:
'FILL'0,
'wght'400,
'GRAD'0,
'opsz'24
}

[data-bs-toggle="collapse"] .material-symbols-outlined:before {
content: "\e5d6";
}

[data-bs-toggle="collapse"].collapsed .material-symbols-outlined:before {
content: "\e5d7";
}

.material-symbols-outlined {
display: inline-block;
vertical-align: middle;
text-decoration: none !important;
}

h6 .material-symbols-outlined {
display: inline-flex;
vertical-align: top;
font-size: 1.1rem;
}

.badge .material-symbols-outlined {
display: inline-flex;
vertical-align: top;
font-size: 0.9rem;
}

.tooltip .tooltip-inner {
text-align: left;
padding: 10px;
}

.grid-wrapper {
display: grid;
grid-template-columns: repeat(12, 1fr);
gap: 4px;
}

.dropdown-menu {
max-height: 80vh;
overflow-y: auto;
}

.up-to-date-false {
background: #fff0f0;
}

.up-to-date-true {
background: #f0fff0;
}
.dev { color: #884EA0 }
.sandbox { color: #B9770E }
.production { color: #148F77 }

html {
scroll-padding-top: 60px;
}

.title {
display: inline-block;
position: relative;
left: -20px;
}

.title a {
font-size: 0.8em;
}
</style>
</head>

<body>
<nav class="navbar navbar-expand-lg bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="/">Google Fonts (Backend) Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
<div class="container pt-3" id="main">
</div>
<script>
$(function() {
$.getJSON("versionhistory.json", function(data) {
updates = data;
var movesbydate = {}
for (var [name, entries] of Object.entries(updates)) {
for (var [server, moves] of Object.entries(entries)) {
for (var move of moves) {
var date = move["date"].replace(/T.*/, "");
if (date == "1970-01-01") {
continue
}
if (!(date in movesbydate)) {
movesbydate[date] = []
}
movesbydate[date].push([name, server])
}
}
}
for (var date of Object.keys(movesbydate).sort().reverse()) {
$("#main").append("<h5>" + date + "</h5>")
ul = $("<ul/>")
for (var [name, server] of movesbydate[date].sort()) {
ul.append($(`<li class="${server}"> ${name}${server} </li>`))
}
$("#main").append(ul)
}
})
})
</script>
</body>

</html>
5 changes: 5 additions & 0 deletions templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/updates.html">Server updates</a>
</li>
</ul>
<form class="d-flex" role="search">
<input id="searchbar" class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
</form>
Expand Down

0 comments on commit 196bda0

Please sign in to comment.