Browse Source

En cours de développement

master
mls-361 9 months ago
parent
commit
b0ab202822
  1. 12
      go.mod
  2. 28
      go.sum
  3. 39
      internal/gui/dashboard.go

12
go.mod

@ -3,12 +3,12 @@ module forge.chapril.org/armen/armen
go 1.16
require (
forge.chapril.org/armen/jw v0.0.0-20210805210545-da8788595df5
forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8
forge.chapril.org/armen/requestor v0.0.0-20210815231734-2d0322a1fce1
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9
forge.chapril.org/armen/workers v0.0.0-20210805210824-756d247bb747
forge.chapril.org/armen/jw v0.0.0-20210817225717-ed17460bdf3f
forge.chapril.org/armen/memory v0.0.0-20210817225809-26fa29ceae53
forge.chapril.org/armen/model v0.0.0-20210817225834-39d62bbc5d30
forge.chapril.org/armen/requestor v0.0.0-20210817225912-5d527248c6f5
forge.chapril.org/armen/runner v0.0.0-20210817225954-bd50a81a22e1
forge.chapril.org/armen/workers v0.0.0-20210817230017-b46532de963e
forge.chapril.org/mls-361/application v0.0.0-20210805205753-c663b93b7e1a
forge.chapril.org/mls-361/crypto v0.0.0-20210507222429-aa9bfa212956
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140

28
go.sum

@ -1,17 +1,17 @@
forge.chapril.org/armen/factory v0.0.0-20210805210612-cba4abff307b h1:d89qOJWrqkk58f3/xIYW7GpmrrdXD4o+OGnQVLxEoWs=
forge.chapril.org/armen/factory v0.0.0-20210805210612-cba4abff307b/go.mod h1:wbpnwfEge6i2y8jLn7n9fdCcsEQadAhM4kJLtyV6GcU=
forge.chapril.org/armen/jw v0.0.0-20210805210545-da8788595df5 h1:eJNp7bnzB64+zsQ8HE88MuUUaQsYRLt6Fbun02HUwes=
forge.chapril.org/armen/jw v0.0.0-20210805210545-da8788595df5/go.mod h1:34+7TEWZzcE0DxhsuUwzoqiBk3FCvHjM7hRB8Iz1Hz0=
forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758 h1:cEHlMCL2N2heK3tjFdrY8r81JfQOoq/Mch0NXrpFSYs=
forge.chapril.org/armen/memory v0.0.0-20210805210634-d02aca0da758/go.mod h1:Y8JRYs23Dt4kT00PHGUmObmc1+UoB0bGyzhbk9R+hJw=
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8 h1:y7SxEdO7CYPPgEjNJMhOpEFDg6GLhVpJTClTY/bkKWc=
forge.chapril.org/armen/model v0.0.0-20210805210659-1e2499fdebb8/go.mod h1:LuUKO1d3ueQC9XD2lCIyvUGcbeHdu1erSoOF7c8MKHo=
forge.chapril.org/armen/requestor v0.0.0-20210815231734-2d0322a1fce1 h1:4NfbWAbquo3Y6dte4vMXrlmDVevKwfwjr8kFzIWF9BY=
forge.chapril.org/armen/requestor v0.0.0-20210815231734-2d0322a1fce1/go.mod h1:Rp4cCxxYRdhFD4+j4WaZRyE4jLK9vKSXfvC8hsNyBmY=
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9 h1:r5GosY9G4iNRVcjfMGVLG0Upep8CvFIk47RbWdDjATY=
forge.chapril.org/armen/runner v0.0.0-20210805210803-07ab6d0373d9/go.mod h1:JOoUDfdPqo2TiEFpLhYKCgYtcLSbbLij/LuQArpBjLE=
forge.chapril.org/armen/workers v0.0.0-20210805210824-756d247bb747 h1:rjbteEWr7PSkYt7kRYITpzpndekH7R7f2Lk2AVudZyw=
forge.chapril.org/armen/workers v0.0.0-20210805210824-756d247bb747/go.mod h1:vUVYIb9MaElQqLYDrti+0zhpbu3k4Kpq82LYV1b1mB8=
forge.chapril.org/armen/factory v0.0.0-20210817225750-450103732132 h1:5x/KRR3Ka7xMhrxOYK41eLdV9fCtVg2EH8yPTnqD6to=
forge.chapril.org/armen/factory v0.0.0-20210817225750-450103732132/go.mod h1:DdZKgV6b/O6WyLgT8+TEZHzdB8vH7jBtT9J3ax5wRjw=
forge.chapril.org/armen/jw v0.0.0-20210817225717-ed17460bdf3f h1:cyf0j4dO9AWTM1HnVesuga0M+Mv+37erhxWv8/s2ObA=
forge.chapril.org/armen/jw v0.0.0-20210817225717-ed17460bdf3f/go.mod h1:34+7TEWZzcE0DxhsuUwzoqiBk3FCvHjM7hRB8Iz1Hz0=
forge.chapril.org/armen/memory v0.0.0-20210817225809-26fa29ceae53 h1:5/3QMFTtqLl9gy0md32KUVokb8zw55NKvFM5IvWJpVQ=
forge.chapril.org/armen/memory v0.0.0-20210817225809-26fa29ceae53/go.mod h1:+u1P1CqUcKp22w3699jVhnlSyJCjMw8aMVadil79R1Q=
forge.chapril.org/armen/model v0.0.0-20210817225834-39d62bbc5d30 h1:ecuQJP+sTV2OJ3kJ1eg7F7byXx0s3uygXwbYJ9HNggU=
forge.chapril.org/armen/model v0.0.0-20210817225834-39d62bbc5d30/go.mod h1:oBUreqqlbh0TYenpUGVQRovUya1/Bk+CdLaJ5524qSA=
forge.chapril.org/armen/requestor v0.0.0-20210817225912-5d527248c6f5 h1:1dNeKwx85h9v2NMehzpyCJwsZhn1QpFj3rnxZQXVdTU=
forge.chapril.org/armen/requestor v0.0.0-20210817225912-5d527248c6f5/go.mod h1:KS0vUEe5c+54PVQEh1u7JKx3uVz/lqVM0aCZI/30Pmo=
forge.chapril.org/armen/runner v0.0.0-20210817225954-bd50a81a22e1 h1:bC7JQpqutj4VszeJLx/k4ZrWnHDRUruVizSYK+P47v0=
forge.chapril.org/armen/runner v0.0.0-20210817225954-bd50a81a22e1/go.mod h1:G47IuxBBrbe4FiQ+woyguEmZ5En8plkUqkKRln6o6Jw=
forge.chapril.org/armen/workers v0.0.0-20210817230017-b46532de963e h1:PHeilfoHKuAsjI1wfRj1FlXlSRjXS0LFra5aNz2hJxw=
forge.chapril.org/armen/workers v0.0.0-20210817230017-b46532de963e/go.mod h1:hS+JkpwzqlszpNzilNMriOGoZrhj0Q+zbRT3x7XTLWs=
forge.chapril.org/mls-361/application v0.0.0-20210805205753-c663b93b7e1a h1:a/wz9VG0kz3/7irVFefvVpCzsHftOrVibIScG80G8x0=
forge.chapril.org/mls-361/application v0.0.0-20210805205753-c663b93b7e1a/go.mod h1:UO8SSkarQiA194I3h2T1EU0tASvsfemEcVn8RhA5EAE=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79 h1:Lh+y98uVFC7btl5FdxKNtokzHD2j14R4ZIgJECao6r4=

39
internal/gui/dashboard.go

@ -19,7 +19,6 @@ import (
type dashboard struct {
app components.Application
storage components.Storage
stats *jw.Stats
}
func newDashboard(ccs *components.Components) *dashboard {
@ -57,20 +56,20 @@ func (d *dashboard) value(name string, value int) g.Node {
)
}
func (d *dashboard) metrics() g.Node {
func (d *dashboard) metrics(ms *jw.Metrics) g.Node {
return Div(
Class("metrics"),
Div(
Class("panel"),
Div(
d.title("Jobs"),
d.value(string(jw.StatusTodo), d.stats.Jobs.Todo),
d.value(string(jw.StatusPending), d.stats.Jobs.Pending),
d.value(string(jw.StatusRunning), d.stats.Jobs.Running),
d.value(string(jw.StatusSucceeded), d.stats.Jobs.Succeeded),
d.value(string(jw.StatusFailed), d.stats.Jobs.Failed),
d.value(string(jw.StatusTodo), ms.Jobs.Todo),
d.value(string(jw.StatusPending), ms.Jobs.Pending),
d.value(string(jw.StatusRunning), ms.Jobs.Running),
d.value(string(jw.StatusSucceeded), ms.Jobs.Succeeded),
d.value(string(jw.StatusFailed), ms.Jobs.Failed),
Hr(),
d.value("total", d.stats.Jobs.Total),
d.value("total", ms.Jobs.Total),
),
),
Div(
@ -79,44 +78,40 @@ func (d *dashboard) metrics() g.Node {
d.title("Workflows"),
d.empty(),
d.empty(),
d.value(string(jw.StatusRunning), d.stats.Workflows.Running),
d.value(string(jw.StatusSucceeded), d.stats.Workflows.Succeeded),
d.value(string(jw.StatusFailed), d.stats.Workflows.Failed),
d.value(string(jw.StatusRunning), ms.Workflows.Running),
d.value(string(jw.StatusSucceeded), ms.Workflows.Succeeded),
d.value(string(jw.StatusFailed), ms.Workflows.Failed),
Hr(),
d.value("total", d.stats.Workflows.Total),
d.value("total", ms.Workflows.Total),
),
),
)
}
func (d *dashboard) content() g.Node {
func (d *dashboard) content(ms *jw.Metrics) g.Node {
return Div(
ID("dashboard"),
Class("dashboard"),
d.metrics(),
d.metrics(ms),
)
}
func (d *dashboard) build() g.Node {
var err error
d.stats, err = d.storage.Stats()
ms, err := d.storage.Metrics()
if err != nil {
return buildPage(d.app, "dashboard", g.Text("ERROR")) //AFINIR
}
return buildPage(d.app, "dashboard", d.content())
return buildPage(d.app, "dashboard", d.content(ms))
}
func (d *dashboard) update() g.Node {
var err error
d.stats, err = d.storage.Stats()
ms, err := d.storage.Metrics()
if err != nil {
return g.Text("ERROR") //AFINIR
}
return d.metrics()
return d.metrics(ms)
}
/*

Loading…
Cancel
Save