From 06afdcec3723971e6b046c720528d78542ae8e5a Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Fri, 10 Oct 2025 06:35:28 +0000 Subject: [PATCH] reimplement instance card using display;contents to have better alignment and fitting to grid for instance card container, migrate away from using w3-hide to custom hide for breakpoint fixes --- web/css/style.css | 30 ++++--- web/html/backups.html | 4 +- web/html/index.html | 69 ++++++++++++---- web/templates/backups.go.tmpl | 4 +- web/templates/instance-card.go.tmpl | 124 ++++++++++++++-------------- 5 files changed, 140 insertions(+), 91 deletions(-) diff --git a/web/css/style.css b/web/css/style.css index 4084f79..dbffbfa 100644 --- a/web/css/style.css +++ b/web/css/style.css @@ -100,7 +100,7 @@ img, svg { color: var(--main-text-color) } -hr, * { +hr { border-color: var(--main-text-color); } @@ -156,18 +156,26 @@ hr, * { } /* add hide large class similar to w3-hide-medium and w3-hide-small */ -@media (width >=993px) { - .w3-hide-large { - display: none !important; - } +@media screen and (width >=993px) { + .hide-large {display: none !important;} } -/* fix edge case in w3-hide-medium where width between 992 and 993 */ -@media (width <=993px) and (width >=601px){ - .w3-hide-medium{display:none!important} +/* fixes edge case in w3-hide-medium where width between 992 and 993 */ +@media screen and (width <=993px) and (width >=601px){ + .hide-large {display: none !important;} + .hide-medium {display:none !important} } -/* fix edge case in w3-hide-small when width between 600 and 601 */ -@media (width <=601px) { - .w3-hide-small{display:none!important} +/* fixes edge case in w3-hide-small when width between 600 and 601 */ +@media screen and (width <=601px) { + .hide-large {display: none !important;} + .hide-medium {display:none !important} + .hide-small {display:none !important} +} + +@media screen and (width <= 440px) { + .hide-large {display: none !important;} + .hide-medium {display:none !important} + .hide-small {display:none !important} + .hide-tiny { display: none !important;} } \ No newline at end of file diff --git a/web/html/backups.html b/web/html/backups.html index eb89376..260766d 100644 --- a/web/html/backups.html +++ b/web/html/backups.html @@ -17,8 +17,8 @@

Time

-

Notes

-

Size

+

Notes

+

Size

Actions

diff --git a/web/html/index.html b/web/html/index.html index 16ac9b8..7eb307e 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -8,12 +8,6 @@ @@ -90,16 +128,17 @@
-
-
-

ID

-

Name

-

Type

-

Status

-

Host Name

-

Host Status

-

Actions

+
+
+

ID

+

Name

+

Type

+

Status

+

Host Name

+

Host Status

+

Actions

+
{{range .instances}} {{template "instance-card" .}} diff --git a/web/templates/backups.go.tmpl b/web/templates/backups.go.tmpl index 52326c9..7a1ec96 100644 --- a/web/templates/backups.go.tmpl +++ b/web/templates/backups.go.tmpl @@ -20,8 +20,8 @@

{{.TimeFormatted}}

-

{{.Notes}}

-

{{.SizeFormatted}}

+

{{.Notes}}

+

{{.SizeFormatted}}

diff --git a/web/templates/instance-card.go.tmpl b/web/templates/instance-card.go.tmpl index 25372b1..2a04191 100644 --- a/web/templates/instance-card.go.tmpl +++ b/web/templates/instance-card.go.tmpl @@ -6,75 +6,77 @@ -
-
-

{{.VMID}}

-

{{.Name}}

-

{{.Type}}

-
- {{if eq .Status "running"}} - - {{else if eq .Status "stopped"}} - - {{else if eq .Status "loading"}} - - {{else}} - - {{end}} -

{{.Status}}

-
-

{{.Node}}

-
- {{if eq .NodeStatus "online"}} - - {{else if eq .NodeStatus "offline"}} - - {{else if eq .NodeStatus "unknown"}} - - {{else}} - {{end}} -

{{.NodeStatus}}

-
-
- {{if and (eq .NodeStatus "online") (eq .Status "running")}} - - - - - - - - {{else if and (eq .NodeStatus "online") (eq .Status "stopped")}} - - - - - - - - - - {{else if and (eq .NodeStatus "online") (eq .Status "loading")}} - - - - - - {{else}} - {{end}} -
+

{{.VMID}}

+

{{.Name}}

+

{{.Type}}

+
+ {{if eq .Status "running"}} + + {{else if eq .Status "stopped"}} + + {{else if eq .Status "loading"}} + + {{else}} + + {{end}} +

{{.Status}}

+
+

{{.Node}}

+
+ {{if eq .NodeStatus "online"}} + + {{else if eq .NodeStatus "offline"}} + + {{else if eq .NodeStatus "unknown"}} + + {{else}} + {{end}} +

{{.NodeStatus}}

+
+
+ {{if and (eq .NodeStatus "online") (eq .Status "running")}} + + + + + + + + {{else if and (eq .NodeStatus "online") (eq .Status "stopped")}} + + + + + + + + + + {{else if and (eq .NodeStatus "online") (eq .Status "loading")}} + + + + + + {{else}} + {{end}}