Browse Source

En cours de développement

master
mls-361 2 months ago
parent
commit
08d2ae53b2
  1. 10
      go.mod
  2. 24
      go.sum
  3. 35
      internal/gui/dashboard.go

10
go.mod

@ -3,11 +3,11 @@ module forge.chapril.org/armen/armen
go 1.16
require (
forge.chapril.org/armen/jw v0.0.0-20210512194404-698677418a88
forge.chapril.org/armen/memory v0.0.0-20210514160420-212e04198667
forge.chapril.org/armen/model v0.0.0-20210514172330-c471068c2f25
forge.chapril.org/armen/runner v0.0.0-20210512195127-66c3cddda963
forge.chapril.org/armen/workers v0.0.0-20210512195151-3f1c6c241d09
forge.chapril.org/armen/jw v0.0.0-20210522201753-e1ba7b5b220d
forge.chapril.org/armen/memory v0.0.0-20210522203737-276e297a8222
forge.chapril.org/armen/model v0.0.0-20210522203838-0c41d1e3923e
forge.chapril.org/armen/runner v0.0.0-20210522203922-9c2d1c07ff13
forge.chapril.org/armen/workers v0.0.0-20210522204033-0382c877546d
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd
forge.chapril.org/mls-361/crypto v0.0.0-20210507222429-aa9bfa212956
forge.chapril.org/mls-361/errors v0.0.0-20210507222244-6017b9315140

24
go.sum

@ -1,15 +1,15 @@
forge.chapril.org/armen/factory v0.0.0-20210512194954-72f7ecfc6be5 h1:gNXudAOGtbuHE06FXbmqZzqMGwzdzro7NbFzTg3q1E4=
forge.chapril.org/armen/factory v0.0.0-20210512194954-72f7ecfc6be5/go.mod h1:SCcyvlFm6dxB/LaaHG+4Wme4FlapazG+GmJ1PZqQpEc=
forge.chapril.org/armen/jw v0.0.0-20210512194404-698677418a88 h1:dnpTz3TGgINfg3AbYBbzLZMi/eTCI/msU9Ke283eFVQ=
forge.chapril.org/armen/jw v0.0.0-20210512194404-698677418a88/go.mod h1:4EK5JtZMMYYWO1vjQkA9AHBwS1WD55WtROqCYc14DBo=
forge.chapril.org/armen/memory v0.0.0-20210514160420-212e04198667 h1:fyX8rUFsiFbCysPzPHh9MsO1U0HCzaqcw4dF1x9tm7o=
forge.chapril.org/armen/memory v0.0.0-20210514160420-212e04198667/go.mod h1:zH9WK4GML28sH2BzvjyTYxqjgvAOEjg+6VVNddCXNFM=
forge.chapril.org/armen/model v0.0.0-20210514172330-c471068c2f25 h1:MKxIM4YbgFGZJESXzLghxmkLsy5nFGDoovJjWRm1BB4=
forge.chapril.org/armen/model v0.0.0-20210514172330-c471068c2f25/go.mod h1:npoE1m6VXkjTXDNhWIPOLyCsKQk0gdMj8QR9i6SKiVY=
forge.chapril.org/armen/runner v0.0.0-20210512195127-66c3cddda963 h1:YeCF1xVoV4aE67cuCaHpv6kmU9N1Hh+Lce6/EcEMVQE=
forge.chapril.org/armen/runner v0.0.0-20210512195127-66c3cddda963/go.mod h1:7o/r/TTeCMD4KKMs5pgfmYpwrfktSrtIE1otVN8NLEM=
forge.chapril.org/armen/workers v0.0.0-20210512195151-3f1c6c241d09 h1:HdePBfdUg+0k+T906IWCa6Hdd/n8sSrFzTan0DY2rxk=
forge.chapril.org/armen/workers v0.0.0-20210512195151-3f1c6c241d09/go.mod h1:CGA2h+1jCtkMMhDLCbbbd04+DPuQfJCXGlEJSTuhEaA=
forge.chapril.org/armen/factory v0.0.0-20210522203756-6de7afffaddf h1:1JKaZKcHTxpYDgSBDfsQJyTuyt5Y86Mdv9fLEj4c8eI=
forge.chapril.org/armen/factory v0.0.0-20210522203756-6de7afffaddf/go.mod h1:mrb4t9EgvkjrbI8MtRMp5JIWl2d8q5+xP1jVToOp3Ik=
forge.chapril.org/armen/jw v0.0.0-20210522201753-e1ba7b5b220d h1:iuiiUmZHqEi9QvPDVWLzWisKsfLx7TH+3aPa6jxn3ZM=
forge.chapril.org/armen/jw v0.0.0-20210522201753-e1ba7b5b220d/go.mod h1:4EK5JtZMMYYWO1vjQkA9AHBwS1WD55WtROqCYc14DBo=
forge.chapril.org/armen/memory v0.0.0-20210522203737-276e297a8222 h1:z2UR0avH1a9xwoFCmL3uH95psWe5WVdgsy6N/oNrSJs=
forge.chapril.org/armen/memory v0.0.0-20210522203737-276e297a8222/go.mod h1:auVwXeRsu0+ExEVWU1FpMfMDUWM00dBThecAFtxj988=
forge.chapril.org/armen/model v0.0.0-20210522203838-0c41d1e3923e h1:GEXB/S+B+hInCdZeElf9T0Eo6YbSjFzbwrNHDYt1rAw=
forge.chapril.org/armen/model v0.0.0-20210522203838-0c41d1e3923e/go.mod h1:Cd8OZSLlu4Gy/V/HsLUyMsIlYuph4GHIbTW66/5grtI=
forge.chapril.org/armen/runner v0.0.0-20210522203922-9c2d1c07ff13 h1:jWSzqd8o+WpVdRbTw734iDPriSKfO0J83z8FEZJRUuk=
forge.chapril.org/armen/runner v0.0.0-20210522203922-9c2d1c07ff13/go.mod h1:0witYwd5hEb+jwAe7YKRDyrnzHeQE3zVllWjwmkIm2U=
forge.chapril.org/armen/workers v0.0.0-20210522204033-0382c877546d h1:4gRvtp/QC5nQ9JT67sz/L5dZM9lyWpL5hIGXDvmR7mY=
forge.chapril.org/armen/workers v0.0.0-20210522204033-0382c877546d/go.mod h1:PO8Fj9MgP+M3Mng5mf1UQcMBH+nEdDX1JM5v6XU9w0Y=
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd h1:TxjOhFddFJEaGl20mLJzbdr8kbETys+XHT4v5jitdys=
forge.chapril.org/mls-361/application v0.0.0-20210511091326-7ec1158728fd/go.mod h1:qO6QOXIo8KMDDD+dFv6uJ4AgbaTbjICi9LD0iNnUxJg=
forge.chapril.org/mls-361/buffer v0.0.0-20210410182428-5dc7a7b2ae79 h1:Lh+y98uVFC7btl5FdxKNtokzHD2j14R4ZIgJECao6r4=

35
internal/gui/dashboard.go

@ -7,6 +7,9 @@
package gui
import (
"strconv"
"forge.chapril.org/armen/jw"
g "github.com/maragudk/gomponents"
. "github.com/maragudk/gomponents/html"
@ -16,6 +19,7 @@ import (
type dashboard struct {
app components.Application
storage components.Storage
stats *jw.Stats
}
func newDashboard(ccs *components.Components) *dashboard {
@ -38,7 +42,7 @@ func (d *dashboard) empty() g.Node {
)
}
func (d *dashboard) value(name string) g.Node {
func (d *dashboard) value(name string, value int) g.Node {
return Div(
Class("value"),
A(
@ -48,7 +52,7 @@ func (d *dashboard) value(name string) g.Node {
),
Span(
Class(name),
g.Text("0"),
g.Raw(strconv.Itoa(value)),
),
)
}
@ -60,13 +64,13 @@ func (d *dashboard) content() g.Node {
Class("panel"),
Div(
d.title("Jobs"),
d.value("todo"),
d.value("pending"),
d.value("running"),
d.value("succeeded"),
d.value("failed"),
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),
Hr(),
d.value("total"),
d.value("total", d.stats.Jobs.Total),
),
),
Div(
@ -75,17 +79,24 @@ func (d *dashboard) content() g.Node {
d.title("Workflows"),
d.empty(),
d.empty(),
d.value("running"),
d.value("succeeded"),
d.value("failed"),
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),
Hr(),
d.value("total"),
d.value("total", d.stats.Workflows.Total),
),
),
)
}
func (d *dashboard) build() g.Node {
var err error
d.stats, err = d.storage.Stats()
if err != nil {
return buildPage(d.app, "dashboard", g.Text("ERROR")) //AFINIR
}
return buildPage(d.app, "dashboard", d.content())
}

Loading…
Cancel
Save