Skip to content

Commit ef1fe81

Browse files
committed
redrew some templates
1 parent ab3c44a commit ef1fe81

4 files changed

Lines changed: 424 additions & 413 deletions

File tree

handler/app/context.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545
"github.com/Defacto2/server/model/fix"
4646
"github.com/aarondl/null/v8"
4747
"github.com/aarondl/sqlboiler/v4/boil"
48+
"github.com/dustin/go-humanize"
4849
"github.com/google/uuid"
4950
"github.com/gorilla/sessions"
5051
"github.com/labstack/echo-contrib/session"
@@ -682,9 +683,10 @@ func downloader(data map[string]any, conf config.Config) map[string]any {
682683
data["usageDownloads"] = 0
683684
data["extsDownloads"] = []helper.Extension{}
684685
if check == nil {
685-
data["countDownloads"], _ = helper.Count(string(conf.AbsDownload))
686+
c, _ := helper.Count(string(conf.AbsDownload))
687+
data["countDownloads"] = humanize.Comma(int64(c))
686688
b, _ := helper.DiskUsage(string(conf.AbsDownload))
687-
data["usageDownloads"] = helper.ByteCount(b)
689+
data["usageDownloads"] = helper.ByteCountFloat(b)
688690
exts, _ := helper.CountExts(string(conf.AbsDownload))
689691
data["extsDownloads"] = exts
690692
}
@@ -699,9 +701,10 @@ func previewer(data map[string]any, conf config.Config) map[string]any {
699701
data["usagePreviews"] = 0
700702
data["extsPreviews"] = []helper.Extension{}
701703
if check == nil {
702-
data["countPreviews"], _ = helper.Count(conf.AbsPreview.String())
704+
c, _ := helper.Count(conf.AbsPreview.String())
705+
data["countPreviews"] = humanize.Comma(int64(c))
703706
b, _ := helper.DiskUsage(string(conf.AbsPreview))
704-
data["usagePreviews"] = helper.ByteCount(b)
707+
data["usagePreviews"] = helper.ByteCountFloat(b)
705708
exts, _ := helper.CountExts(conf.AbsPreview.String())
706709
data["extsPreviews"] = exts
707710
}
@@ -716,9 +719,10 @@ func thumbnailer(data map[string]any, conf config.Config) map[string]any {
716719
data["usageThumbnails"] = 0
717720
data["extsThumbnails"] = []helper.Extension{}
718721
if check == nil {
719-
data["countThumbnails"], _ = helper.Count(conf.AbsThumbnail.String())
722+
c, _ := helper.Count(conf.AbsThumbnail.String())
723+
data["countThumbnails"] = humanize.Comma(int64(c))
720724
b, _ := helper.DiskUsage(string(conf.AbsThumbnail))
721-
data["usageThumbnails"] = helper.ByteCount(b)
725+
data["usageThumbnails"] = helper.ByteCountFloat(b)
722726
exts, _ := helper.CountExts(conf.AbsThumbnail.String())
723727
data["extsThumbnails"] = exts
724728
}
@@ -733,9 +737,10 @@ func extraer(data map[string]any, conf config.Config) map[string]any {
733737
data["usageExtras"] = 0
734738
data["extsExtras"] = []helper.Extension{}
735739
if check == nil {
736-
data["countExtras"], _ = helper.Count(conf.AbsExtra.String())
740+
c, _ := helper.Count(conf.AbsExtra.String())
741+
data["countExtras"] = humanize.Comma(int64(c))
737742
b, _ := helper.DiskUsage(string(conf.AbsExtra))
738-
data["usageExtras"] = helper.ByteCount(b)
743+
data["usageExtras"] = helper.ByteCountFloat(b)
739744
exts, _ := helper.CountExts(conf.AbsExtra.String())
740745
data["extsExtras"] = exts
741746
}
@@ -750,9 +755,10 @@ func orphaneder(data map[string]any, conf config.Config) map[string]any {
750755
data["usageOrphaned"] = 0
751756
data["extsOrphaned"] = []helper.Extension{}
752757
if check == nil {
753-
data["countOrphaned"], _ = helper.Count(conf.AbsOrphaned.String())
758+
c, _ := helper.Count(conf.AbsOrphaned.String())
759+
data["countOrphaned"] = humanize.Comma(int64(c))
754760
b, _ := helper.DiskUsage(string(conf.AbsOrphaned))
755-
data["usageOrphaned"] = helper.ByteCount(b)
761+
data["usageOrphaned"] = helper.ByteCountFloat(b)
756762
exts, _ := helper.CountExts(conf.AbsOrphaned.String())
757763
data["extsOrphaned"] = exts
758764
}

handler/htmx/htmx.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,16 @@ func Pings(c echo.Context, proto string, port int) error {
364364
switch {
365365
case code == http.StatusOK:
366366
elm = "<span class=\"text-success\">"
367+
case code == http.StatusNotFound:
368+
elm = "<span class=\"text-danger-emphasis\">"
367369
case code >= http.StatusInternalServerError:
368370
elm = "<span class=\"text-danger\">"
369371
default:
370-
elm = "<span class=\"text-warning\">"
372+
elm = "<span class=\"text-warning-emphasis\">"
371373
}
372374
results = append(results,
373375
"<div>", elm,
374-
fmt.Sprintf("%d</span> %s %s", code, ping, helper.ByteCount(size)),
376+
fmt.Sprintf(`%d</span> %s <span class="text-secondary">%s</span>`, code, ping, helper.ByteCount(size)),
375377
"</div>")
376378
}
377379
output := strings.Join(results, "")

0 commit comments

Comments
 (0)