Jobs & Workflows
https://armen.surge.sh
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
1.8 KiB
94 lines
1.8 KiB
1 year ago
|
/*
|
||
|
------------------------------------------------------------------------------------------------------------------------
|
||
|
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
|
||
|
------------------------------------------------------------------------------------------------------------------------
|
||
|
*/
|
||
|
|
||
|
package gui
|
||
|
|
||
|
import (
|
||
|
g "github.com/maragudk/gomponents"
|
||
|
. "github.com/maragudk/gomponents/html"
|
||
|
|
||
|
"forge.chapril.org/armen/armen/internal/components"
|
||
|
)
|
||
|
|
||
|
type dashboard struct {
|
||
|
app components.Application
|
||
|
storage components.Storage
|
||
|
}
|
||
|
|
||
|
func newDashboard(ccs *components.Components) *dashboard {
|
||
|
return &dashboard{
|
||
|
app: ccs.Application,
|
||
|
storage: ccs.Storage,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (d *dashboard) title(title string) g.Node {
|
||
|
return Div(
|
||
|
Class("title"),
|
||
|
g.Text(title),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func (d *dashboard) empty() g.Node {
|
||
|
return Div(
|
||
|
Class("value"),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func (d *dashboard) value(name string) g.Node {
|
||
|
return Div(
|
||
|
Class("value"),
|
||
|
Span(
|
||
|
Class("label"),
|
||
|
g.Text(name),
|
||
|
),
|
||
|
Span(
|
||
|
Class(name),
|
||
|
g.Text("0"),
|
||
|
),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func (d *dashboard) content() g.Node {
|
||
|
return Div(
|
||
|
Class("dashboard"),
|
||
|
Div(
|
||
|
Class("panel"),
|
||
|
Div(
|
||
|
d.title("jobs"),
|
||
|
Hr(),
|
||
|
d.value("todo"),
|
||
|
d.value("pending"),
|
||
|
d.value("succeeded"),
|
||
|
d.value("failed"),
|
||
|
Hr(),
|
||
|
d.value("total"),
|
||
|
),
|
||
|
),
|
||
|
Div(
|
||
|
Class("panel"),
|
||
|
Div(
|
||
|
d.title("workflows"),
|
||
|
Hr(),
|
||
|
d.empty(),
|
||
|
d.value("running"),
|
||
|
d.value("succeeded"),
|
||
|
d.value("failed"),
|
||
|
Hr(),
|
||
|
d.value("total"),
|
||
|
),
|
||
|
),
|
||
|
)
|
||
|
}
|
||
|
|
||
|
func (d *dashboard) build() g.Node {
|
||
|
return buildPage(d.app, "dashboard", d.content())
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
######################################################################################################## @(°_°)@ #######
|
||
|
*/
|