Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading screen #31

Merged
merged 2 commits into from
May 23, 2023
Merged
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*.snap
/src/etc/5xx.html
__pycache__
*.bkp
87 changes: 58 additions & 29 deletions src/etc/5xx.http
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Content-Type: text/html
<style>
body {
background-color: #070707;
color: #ebe9e9;
color: #e4e2e2;
font-family: Verdana, Geneva, Tahoma, sans-serif
}

Expand All @@ -25,16 +25,51 @@ Content-Type: text/html
color: rgb(158, 158, 196);
}

.backend-status {
background-color: #2c2c2c;
h1 {
color: #cecece;
border-bottom: 1px solid #9e9e9e;
}

.backend-status > div {
padding: 0.4em;
margin-bottom: 0.4em;
padding: 1em;
border-radius: 0.8em;
background-color: #2c2c2c;
}

.backend-status > div.fail {
background: repeating-linear-gradient(
45deg,
rgba(255, 0, 0, 0.4),
rgba(255, 0, 0, 0.4) 10px,
rgba(255, 0, 0, 0.35) 10px,
rgba(255, 0, 0, 0.35) 20px
);
}

.backend-status > div > span {
float: right;
.backend-status > div.okay {
background: repeating-linear-gradient(
45deg,
rgba(0, 255, 0, 0.4),
rgba(0, 255, 0, 0.4) 10px,
rgba(0, 255, 0, 0.35) 10px,
rgba(0, 255, 0, 0.35) 20px
);
}

.backend-status > div.unset::before {
content: '⏳';
margin-right: 0.4em;
}

.backend-status > div.okay::before {
content: '✅';
margin-right: 0.4em;
}

.backend-status > div.fail::before {
content: '⛔';
margin-right: 0.4em;
}

footer {
Expand All @@ -48,41 +83,32 @@ Content-Type: text/html
<h1>Immich loading ...</h1>

<div class="backend-status">
<div id="backend-be_server">
<div id="backend-be_server" class="unset">
Immich Server
<span></span>
</div>
<div id="backend-be_web">
<div id="backend-be_web" class="unset">
Immich Web
<span></span>
</div>
<div id="backend-be_microservices">
<div id="backend-be_microservices" class="unset">
Microservices
<span></span>
</div>
<div id="backend-be_ml">
<div id="backend-be_ml" class="unset">
Machine Learning
<span></span>
</div>
<div id="backend-be_typesense">
<div id="backend-be_typesense" class="unset">
Typesense (Search Database)
<span></span>
</div>
<div id="backend-be_postgres">
<div id="backend-be_postgres" class="unset">
Postgres (Relational Database)
<span></span>
</div>
<div id="backend-be_redis">
<div id="backend-be_redis" class="unset">
Redis (In-memory key-value database)
<span></span>
</div>
<div id="backend-acme">
<div id="backend-acme" class="unset">
ACME Challenge (Used by Let's Encrypt to issue a TLS certificate)
<span></span>
</div>
<div id="backend-stats">
<div id="backend-stats" class="unset">
HAProxy Stats
<span></span>
</div>
</div>

Expand All @@ -95,7 +121,7 @@ Content-Type: text/html

<script>
function do_request() {
const request = new Request("/haproxy/;csv")
const request = new Request("http://127.0.0.1/haproxy/;csv")
fetch(request).then((response) => {
if (response.status === 200) {
return response.text()
Expand All @@ -107,9 +133,9 @@ Content-Type: text/html
ld = line.split(",")
if (ld[1] == "BACKEND") {
if (ld[17] == "UP") {
document.querySelector("#backend-"+ld[0]+" span").innerHTML = '✅';
document.querySelector("#backend-"+ld[0]).className = "okay"
} else {
document.querySelector("#backend-"+ld[0]+" span").innerHTML = '⛔';
document.querySelector("#backend-"+ld[0]).className = "fail"
down_backends = down_backends + 1
}
}
Expand All @@ -120,9 +146,12 @@ Content-Type: text/html
if (down_backends < 1) {
location.reload();
}

setTimeout(do_request, 1000)
}).catch(error => {
setTimeout(do_request, 10000)
})

setTimeout(do_request, 2000)
}

setTimeout(do_request, 500)
Expand Down