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.
 
 
 

84 lines
2.1 KiB

/*
------------------------------------------------------------------------------------------------------------------------
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License #######
------------------------------------------------------------------------------------------------------------------------
*/
package gui
import (
"fmt"
g "github.com/maragudk/gomponents"
c "github.com/maragudk/gomponents/components"
. "github.com/maragudk/gomponents/html"
"forge.chapril.org/armen/armen/internal/components"
)
func container(node g.Node) g.Node {
return Div(
Class("container"),
node,
)
}
func navbarLink(name, href, description, page string) g.Node {
active := name == page
return A(
c.Classes{
"item": true,
"active": active,
},
g.Text(name),
Href(href),
TitleAttr(description),
)
}
func buildPage(app components.Application, name string, content g.Node) g.Node {
return Doctype(
HTML(
Lang("en"),
Head(
Meta(Charset("utf-8")),
Meta(Name("viewport"), Content("width=device-width, initial-scale=1")),
TitleEl(g.Textf("%s - %s", app.Name(), name)),
Link(Rel("icon"), Href("/static/favicon.ico")),
Link(Rel("stylesheet"), Href(fmt.Sprintf("/static/css/%s.css", name)), Type("text/css")),
),
Body(
P(
ID("error"),
Class("error"),
),
Header(
container(
Div(
Class("navbar"),
navbarLink(app.Name(), "/", "home", name),
navbarLink("dashboard", "/gui/dashboard", "number of jobs and workflows per status", name),
navbarLink("jobs", "/gui/search/jobs", "search for jobs", name),
navbarLink("workflows", "/gui/search/workflows", "search for workflows", name),
),
),
),
container(Main(content)),
Footer(
container(
P(
g.Textf("%s v%s copyright © 2021 mls-361", app.Name(), app.Version()),
),
),
),
Script(Src("/static/js/common.js")),
Script(Src(fmt.Sprintf("/static/js/%s.js", name))),
),
),
)
}
/*
######################################################################################################## @(°_°)@ #######
*/