From 04108688fb9b39174b4ef06a39560f46b3658cf5 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 19:41:27 +0200
Subject: [PATCH 01/16] Replace html/template with a-h/templ
---
.reuse/dep5 | 8 +
.vscode/settings.json | 22 +
cmd/root.go | 4 +-
cmd/serve.go | 6 +-
go.mod | 3 +-
go.sum | 27 +-
main.go | 6 +-
pkg/server/prcreate.go | 35 +-
pkg/server/renderer.go | 54 ++
pkg/server/server.go | 59 +-
templates/404.html | 28 -
templates/405.html | 29 -
templates/components/alerts.templ | 33 +
templates/components/alerts_templ.go | 119 ++++
templates/components/breadcrumbs.templ | 26 +
templates/components/breadcrumbs_templ.go | 42 ++
templates/components/codeblock.templ | 31 +
templates/components/codeblock_templ.go | 54 ++
templates/components/link.templ | 83 +++
templates/components/link_templ.go | 408 +++++++++++
templates/config.html | 26 -
templates/index.html | 24 -
templates/layout.html | 111 ---
templates/packages/create-pr.html | 210 ------
templates/packages/index.html | 63 --
templates/packages/package.html | 53 --
templates/pages/config.templ | 29 +
templates/pages/config_templ.go | 67 ++
templates/pages/errors.templ | 43 ++
templates/pages/errors_templ.go | 190 +++++
templates/pages/index.templ | 26 +
templates/pages/index_templ.go | 49 ++
templates/pages/layout.templ | 110 +++
templates/pages/layout_templ.go | 167 +++++
templates/pages/packages_createpr.templ | 224 ++++++
templates/pages/packages_createpr_templ.go | 776 +++++++++++++++++++++
templates/pages/packages_item.templ | 56 ++
templates/pages/packages_item_templ.go | 155 ++++
templates/pages/packages_list.templ | 63 ++
templates/pages/packages_list_templ.go | 156 +++++
40 files changed, 3027 insertions(+), 648 deletions(-)
create mode 100644 .reuse/dep5
create mode 100644 .vscode/settings.json
create mode 100644 pkg/server/renderer.go
delete mode 100644 templates/404.html
delete mode 100644 templates/405.html
create mode 100644 templates/components/alerts.templ
create mode 100644 templates/components/alerts_templ.go
create mode 100644 templates/components/breadcrumbs.templ
create mode 100644 templates/components/breadcrumbs_templ.go
create mode 100644 templates/components/codeblock.templ
create mode 100644 templates/components/codeblock_templ.go
create mode 100644 templates/components/link.templ
create mode 100644 templates/components/link_templ.go
delete mode 100644 templates/config.html
delete mode 100644 templates/index.html
delete mode 100644 templates/layout.html
delete mode 100644 templates/packages/create-pr.html
delete mode 100644 templates/packages/index.html
delete mode 100644 templates/packages/package.html
create mode 100644 templates/pages/config.templ
create mode 100644 templates/pages/config_templ.go
create mode 100644 templates/pages/errors.templ
create mode 100644 templates/pages/errors_templ.go
create mode 100644 templates/pages/index.templ
create mode 100644 templates/pages/index_templ.go
create mode 100644 templates/pages/layout.templ
create mode 100644 templates/pages/layout_templ.go
create mode 100644 templates/pages/packages_createpr.templ
create mode 100644 templates/pages/packages_createpr_templ.go
create mode 100644 templates/pages/packages_item.templ
create mode 100644 templates/pages/packages_item_templ.go
create mode 100644 templates/pages/packages_list.templ
create mode 100644 templates/pages/packages_list_templ.go
diff --git a/.reuse/dep5 b/.reuse/dep5
new file mode 100644
index 0000000..91e05bb
--- /dev/null
+++ b/.reuse/dep5
@@ -0,0 +1,8 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Jelease
+Upstream-Contact: Risk.Ident GmbH
+Source: https://github.com/RiskIdent/jelease
+
+Files: templates/*_templ.go
+Copyright: 2022 Risk.Ident GmbH
+License: GPL-3.0-or-later
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..523ae13
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,22 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: CC0-1.0
+{
+ "cSpell.words": [
+ "gonic",
+ "jelease",
+ "newreleases",
+ "Templ",
+ "templating",
+ "tmpl",
+ "zerolog"
+ ],
+ "explorer.fileNesting.enabled": true,
+ "explorer.fileNesting.patterns": {
+ "*": "${capture}.license",
+ "*.templ": "${capture}_templ.go",
+ "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml",
+ "Chart.yaml": "Chart.lock, .helmignore",
+ },
+ "explorer.fileNesting.expand": false
+}
\ No newline at end of file
diff --git a/cmd/root.go b/cmd/root.go
index 2c62ce0..0050b65 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -35,7 +35,6 @@ import (
var (
cfg config.Config
- htmlTemplates fs.FS
htmlStaticFiles fs.FS
appVersion string // may be set via `go build` flags
@@ -58,8 +57,7 @@ var rootCmd = &cobra.Command{
},
}
-func Execute(defaultConfig config.Config, templatesFS fs.FS, staticFilesFS fs.FS) {
- htmlTemplates = templatesFS
+func Execute(defaultConfig config.Config, staticFilesFS fs.FS) {
htmlStaticFiles = staticFilesFS
cfg = defaultConfig
diff --git a/cmd/serve.go b/cmd/serve.go
index 94e5042..54109d3 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -49,8 +49,8 @@ func init() {
}
func run() error {
- if htmlTemplates == nil {
- return fmt.Errorf("no HTML templates loaded")
+ if htmlStaticFiles == nil {
+ return fmt.Errorf("no static files loaded")
}
jiraClient, err := jira.New(&cfg.Jira)
@@ -73,7 +73,7 @@ func run() error {
return err
}
- s := server.New(&cfg, jiraClient, patcher, htmlTemplates, htmlStaticFiles)
+ s := server.New(&cfg, jiraClient, patcher, htmlStaticFiles)
return s.Serve()
}
diff --git a/go.mod b/go.mod
index 1066f8d..ec935ab 100644
--- a/go.mod
+++ b/go.mod
@@ -7,10 +7,10 @@ module github.com/RiskIdent/jelease
go 1.21.3
require (
+ github.com/a-h/templ v0.2.408
github.com/andygrunwald/go-jira v1.16.0
github.com/bradleyfalzon/ghinstallation/v2 v2.7.0
github.com/fatih/color v1.15.0
- github.com/gin-contrib/multitemplate v0.0.0-20230212012517-45920c92c271
github.com/gin-gonic/gin v1.9.1
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/google/go-github/v48 v48.2.0
@@ -76,5 +76,6 @@ require (
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
+ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
diff --git a/go.sum b/go.sum
index f4bcbae..7a935fe 100644
--- a/go.sum
+++ b/go.sum
@@ -41,6 +41,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
+github.com/a-h/templ v0.2.408 h1:WmXdjVjxjMJyjRg+34cgg+hRC0duDg9OJy6euZbS4ek=
+github.com/a-h/templ v0.2.408/go.mod h1:6Lfhsl3Z4/vXl7jjEjkJRCqoWDGjDnuKgzjYMDSddas=
github.com/andygrunwald/go-jira v1.16.0 h1:PU7C7Fkk5L96JvPc6vDVIrd99vdPnYudHu4ju2c2ikQ=
github.com/andygrunwald/go-jira v1.16.0/go.mod h1:UQH4IBVxIYWbgagc0LF/k9FRs9xjIiQ8hIcC6HfLwFU=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
@@ -74,7 +76,6 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -95,29 +96,21 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
-github.com/gin-contrib/multitemplate v0.0.0-20230212012517-45920c92c271 h1:s+boMV47gwTyff2PL+k6V33edJpp+K5y3QPzZlRhno8=
-github.com/gin-contrib/multitemplate v0.0.0-20230212012517-45920c92c271/go.mod h1:XLLtIXoP9+9zGcEDc7gAGV3AksGPO+vzv4kXHMJSdU0=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
-github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
-github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
-github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
-github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
-github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24=
github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
-github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -216,14 +209,12 @@ github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgSh
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
-github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
@@ -232,7 +223,6 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
-github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
@@ -243,10 +233,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
-github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
@@ -255,8 +243,6 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
-github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
-github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
@@ -285,7 +271,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
-github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -299,8 +284,6 @@ github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM=
github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
-github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
-github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
@@ -327,7 +310,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
-golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
@@ -469,8 +451,6 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -658,7 +638,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -669,9 +648,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/main.go b/main.go
index 7c0ea09..d12cdd0 100644
--- a/main.go
+++ b/main.go
@@ -30,9 +30,6 @@ import (
//go:embed jelease.yaml
var defaultConfigYAML []byte
-//go:embed templates
-var templatesFS embed.FS
-
//go:embed static
var staticFilesFS embed.FS
@@ -41,9 +38,8 @@ func main() {
if err := yaml.Unmarshal(defaultConfigYAML, &defaultConfig); err != nil {
panic(fmt.Errorf("Parse embedded config: %w", err))
}
- templatesFSSub := mustSub(templatesFS, "templates")
staticFilesFSSub := mustSub(staticFilesFS, "static")
- cmd.Execute(defaultConfig, templatesFSSub, staticFilesFSSub)
+ cmd.Execute(defaultConfig, staticFilesFSSub)
}
func mustSub(fsys fs.FS, dir string) fs.FS {
diff --git a/pkg/server/prcreate.go b/pkg/server/prcreate.go
index 2c9930f..0ec88fc 100644
--- a/pkg/server/prcreate.go
+++ b/pkg/server/prcreate.go
@@ -24,27 +24,13 @@ import (
"strings"
"github.com/RiskIdent/jelease/pkg/config"
- "github.com/RiskIdent/jelease/pkg/github"
"github.com/RiskIdent/jelease/pkg/jira"
"github.com/RiskIdent/jelease/pkg/patch"
+ "github.com/RiskIdent/jelease/templates/pages"
"github.com/gin-gonic/gin"
"github.com/rs/zerolog/log"
)
-// CreatePRContext is the [html/template] context used when templating the
-// "create PR" page.
-type CreatePRContext struct {
- Config *config.Config
- Package config.Package
-
- Version string
- JiraIssue string
- DryRun bool
- IsPost bool
- PullRequests []github.PullRequest
- Error error
-}
-
// CreatePRRequest is the query or form data pushed by the web.
type CreatePRRequest struct {
Version string `form:"version"`
@@ -52,19 +38,16 @@ type CreatePRRequest struct {
PRCreate bool `form:"prCreate"`
}
-func (s HTTPServer) bindCreatePRContext(c *gin.Context) (CreatePRContext, bool) {
+func (s HTTPServer) bindCreatePRContext(c *gin.Context) (pages.PackagesCreatePRModel, bool) {
pkgName := c.Param("package")
pkg, ok := s.cfg.TryFindPackage(pkgName)
if !ok {
- c.HTML(http.StatusNotFound, "404", map[string]any{
- "Config": s.cfg,
- "Alert": fmt.Sprintf("Package %q not found.", pkgName),
- })
- return CreatePRContext{}, false
+ c.HTML(http.StatusNotFound, "", pages.Error404(fmt.Sprintf("Package %q not found.", pkgName)))
+ return pages.PackagesCreatePRModel{}, false
}
var input CreatePRRequest
err := c.ShouldBind(&input)
- model := CreatePRContext{
+ model := pages.PackagesCreatePRModel{
Config: s.cfg,
Package: pkg,
Version: input.Version,
@@ -74,7 +57,7 @@ func (s HTTPServer) bindCreatePRContext(c *gin.Context) (CreatePRContext, bool)
}
if err != nil {
model.Error = err
- c.HTML(http.StatusBadRequest, "package-create-pr", model)
+ c.HTML(http.StatusBadRequest, "", pages.PackagesCreatePR(model))
return model, false
}
@@ -89,7 +72,7 @@ func (s HTTPServer) handleGetPRCreate(c *gin.Context) {
if !ok {
return
}
- c.HTML(http.StatusOK, "package-create-pr", model)
+ c.HTML(http.StatusOK, "", pages.PackagesCreatePR(model))
}
// handlePostPRCreate is the handler for:
@@ -106,7 +89,7 @@ func (s HTTPServer) handlePostPRCreate(c *gin.Context) {
issue, err := s.jira.FindIssueForKey(model.JiraIssue)
if err != nil {
model.Error = err
- c.HTML(http.StatusOK, "package-create-pr", model)
+ c.HTML(http.StatusOK, "", pages.PackagesCreatePR(model))
return
}
issueRef = issue.IssueRef()
@@ -132,7 +115,7 @@ func (s HTTPServer) handlePostPRCreate(c *gin.Context) {
model.PullRequests = prs
model.Error = err
- c.HTML(http.StatusOK, "package-create-pr", model)
+ c.HTML(http.StatusOK, "", pages.PackagesCreatePR(model))
}
func createDeferredCreationURL(publicURL *url.URL, pkgName string, req CreatePRRequest) *url.URL {
diff --git a/pkg/server/renderer.go b/pkg/server/renderer.go
new file mode 100644
index 0000000..5cf303e
--- /dev/null
+++ b/pkg/server/renderer.go
@@ -0,0 +1,54 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package server
+
+import (
+ "context"
+ "net/http"
+
+ "github.com/a-h/templ"
+ "github.com/gin-gonic/gin/render"
+)
+
+type TemplRender struct {
+ Code int
+ Data templ.Component
+}
+
+func (t TemplRender) Render(w http.ResponseWriter) error {
+ w.WriteHeader(t.Code)
+ if t.Data != nil {
+ return t.Data.Render(context.Background(), w)
+ }
+
+ return nil
+}
+
+func (t TemplRender) WriteContentType(w http.ResponseWriter) {
+ w.Header().Set("Content-Type", "text/html; charset=utf-8")
+}
+
+func (t *TemplRender) Instance(name string, data interface{}) render.Render {
+ if templData, ok := data.(templ.Component); ok {
+ return &TemplRender{
+ Code: http.StatusOK,
+ Data: templData,
+ }
+ }
+ return nil
+}
diff --git a/pkg/server/server.go b/pkg/server/server.go
index b8e3790..63a06af 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -19,7 +19,6 @@ package server
import (
"fmt"
- "html/template"
"io/fs"
"net/http"
"net/url"
@@ -29,8 +28,7 @@ import (
"github.com/RiskIdent/jelease/pkg/github"
"github.com/RiskIdent/jelease/pkg/jira"
"github.com/RiskIdent/jelease/pkg/patch"
- "github.com/RiskIdent/jelease/pkg/templatefuncs"
- "github.com/gin-contrib/multitemplate"
+ "github.com/RiskIdent/jelease/templates/pages"
"github.com/gin-gonic/gin"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@@ -43,7 +41,7 @@ type HTTPServer struct {
patcher patch.Patcher
}
-func New(cfg *config.Config, j jira.Client, patcher patch.Patcher, htmlTemplates fs.FS, staticFiles fs.FS) *HTTPServer {
+func New(cfg *config.Config, j jira.Client, patcher patch.Patcher, staticFiles fs.FS) *HTTPServer {
gin.DefaultErrorWriter = ginLogger{defaultLevel: zerolog.ErrorLevel}
gin.DefaultWriter = ginLogger{defaultLevel: zerolog.InfoLevel}
@@ -64,71 +62,57 @@ func New(cfg *config.Config, j jira.Client, patcher patch.Patcher, htmlTemplates
patcher: patcher,
}
- ren := multitemplate.New()
- r.HTMLRender = ren
- defaultTemplateObj := map[string]any{"Config": s.cfg.Censored()}
+ r.HTMLRender = &TemplRender{}
- addHTMLFromFS(ren, htmlTemplates, "index", "layout.html", "index.html")
r.GET("/", func(c *gin.Context) {
- c.HTML(http.StatusOK, "index", defaultTemplateObj)
+ c.HTML(http.StatusOK, "", pages.Index())
})
- addHTMLFromFS(ren, htmlTemplates, "config", "layout.html", "config.html")
r.GET("/config", func(c *gin.Context) {
- c.HTML(http.StatusOK, "config", defaultTemplateObj)
+ c.HTML(http.StatusOK, "", pages.Config(cfg))
})
- addHTMLFromFS(ren, htmlTemplates, "package-list", "layout.html", "packages/index.html")
r.GET("/packages", func(c *gin.Context) {
- c.HTML(http.StatusOK, "package-list", defaultTemplateObj)
+ c.HTML(http.StatusOK, "", pages.PackagesList(cfg))
})
- addHTMLFromFS(ren, htmlTemplates, "package-item", "layout.html", "packages/package.html")
r.GET("/packages/:package", func(c *gin.Context) {
pkgName := c.Param("package")
pkg, ok := s.cfg.TryFindPackage(pkgName)
if !ok {
- c.HTML(http.StatusOK, "404", map[string]any{
- "Config": s.cfg,
- "Alert": fmt.Sprintf("Package %q not found.", pkgName),
- })
+ c.HTML(http.StatusNotFound, "", pages.Error404(fmt.Sprintf("Package %q not found.", pkgName)))
return
}
- c.HTML(http.StatusOK, "package-item", map[string]any{
- "Config": s.cfg,
- "Package": pkg,
- })
+ c.HTML(http.StatusOK, "", pages.PackagesItem(pages.PackageItemModel{
+ Package: pkg,
+ }))
})
- addHTMLFromFS(ren, htmlTemplates, "package-create-pr", "layout.html", "packages/create-pr.html")
r.GET("/packages/:package/create-pr", s.handleGetPRCreate)
r.POST("/packages/:package/create-pr", s.handlePostPRCreate)
- addHTMLFromFS(ren, htmlTemplates, "404", "layout.html", "404.html")
r.NoRoute(func(c *gin.Context) {
if strings.HasPrefix(c.Request.URL.Path, "/webhook") {
c.JSON(http.StatusNotFound, gin.H{"error": "Endpoint not found"})
return
}
- c.HTML(http.StatusNotFound, "404", defaultTemplateObj)
+ c.HTML(http.StatusNotFound, "", pages.Error404(""))
})
-
- addHTMLFromFS(ren, htmlTemplates, "405", "layout.html", "405.html")
r.NoMethod(func(c *gin.Context) {
- var methodsAllowed []string
- for _, route := range r.Routes() {
- if route.Path == c.Request.URL.Path {
- methodsAllowed = append(methodsAllowed, route.Method)
- }
- }
if strings.HasPrefix(c.Request.URL.Path, "/webhook") {
+ var methodsAllowed []string
+ for _, route := range r.Routes() {
+ if route.Path == c.Request.URL.Path {
+ methodsAllowed = append(methodsAllowed, route.Method)
+ }
+ }
c.JSON(http.StatusMethodNotAllowed, gin.H{
"error": "Method not allowed",
"methods": methodsAllowed,
})
return
}
- c.HTML(http.StatusNotFound, "405", defaultTemplateObj)
+ c.HTML(http.StatusNotFound, "", pages.Error405())
})
r.POST("/webhook", s.handlePostWebhook)
@@ -151,13 +135,6 @@ func New(cfg *config.Config, j jira.Client, patcher patch.Patcher, htmlTemplates
return s
}
-func addHTMLFromFS(ren multitemplate.Render, fs fs.FS, name string, files ...string) {
- tmpl := template.Must(template.New(files[0]).
- Funcs(templatefuncs.FuncsMap).
- ParseFS(fs, files...))
- ren.Add(name, tmpl)
-}
-
func (s HTTPServer) Serve() error {
log.Info().Uint16("port", s.cfg.HTTP.Port).Msg("Starting server.")
return s.engine.Run(fmt.Sprintf(":%v", s.cfg.HTTP.Port))
diff --git a/templates/404.html b/templates/404.html
deleted file mode 100644
index 324b73b..0000000
--- a/templates/404.html
+++ /dev/null
@@ -1,28 +0,0 @@
-{{/**/}}
-
-{{ define "content" }}
-Page not found
-{{ if .Alert }}
-
-{{ end }}
-Click here to return to the start page.
-{{ end }}
diff --git a/templates/405.html b/templates/405.html
deleted file mode 100644
index 1edc00e..0000000
--- a/templates/405.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{{/**/}}
-
-{{ define "content" }}
-Method not allowed
-
- Quite the interesting error you got there.
- If you were navigated here by this website, then this is a bug,
- and please report it here:
- https://github.com/RiskIdent/jelease/issues/new
-
-Click here to return to the start page.
-{{ end }}
diff --git a/templates/components/alerts.templ b/templates/components/alerts.templ
new file mode 100644
index 0000000..914dd06
--- /dev/null
+++ b/templates/components/alerts.templ
@@ -0,0 +1,33 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package components
+
+templ AlertDanger(title string) {
+
+
Error: {title}
+ { children... }
+
+}
+
+templ AlertDangerErr(title string, err error) {
+
+
Error: {title}
+ { children... }
+
{ err.Error() }
+
+}
\ No newline at end of file
diff --git a/templates/components/alerts_templ.go b/templates/components/alerts_templ.go
new file mode 100644
index 0000000..83a6bf5
--- /dev/null
+++ b/templates/components/alerts_templ.go
@@ -0,0 +1,119 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package components
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func AlertDanger(title string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var2 := `Error:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var3 string = title
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func AlertDangerErr(title string, err error) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var4 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var4 == nil {
+ templ_7745c5c3_Var4 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var5 := `Error:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var6 string = title
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var4.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var7 string = err.Error()
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/components/breadcrumbs.templ b/templates/components/breadcrumbs.templ
new file mode 100644
index 0000000..d42c279
--- /dev/null
+++ b/templates/components/breadcrumbs.templ
@@ -0,0 +1,26 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package components
+
+templ Breadcrumbs() {
+
+}
\ No newline at end of file
diff --git a/templates/components/breadcrumbs_templ.go b/templates/components/breadcrumbs_templ.go
new file mode 100644
index 0000000..7f612db
--- /dev/null
+++ b/templates/components/breadcrumbs_templ.go
@@ -0,0 +1,42 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package components
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func Breadcrumbs() templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/components/codeblock.templ b/templates/components/codeblock.templ
new file mode 100644
index 0000000..b1a9761
--- /dev/null
+++ b/templates/components/codeblock.templ
@@ -0,0 +1,31 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package components
+import (
+ "gopkg.in/yaml.v3"
+)
+
+templ CodeBlock(value any) {
+ if b, err := yaml.Marshal(value); err != nil {
+ @AlertDangerErr("Failed to serialize YAML:", err)
+ } else {
+
+ { string(b) }
+
+ }
+}
\ No newline at end of file
diff --git a/templates/components/codeblock_templ.go b/templates/components/codeblock_templ.go
new file mode 100644
index 0000000..77707cf
--- /dev/null
+++ b/templates/components/codeblock_templ.go
@@ -0,0 +1,54 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package components
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "gopkg.in/yaml.v3"
+)
+
+func CodeBlock(value any) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ if b, err := yaml.Marshal(value); err != nil {
+ templ_7745c5c3_Err = AlertDangerErr("Failed to serialize YAML:", err).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var2 string = string(b)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/components/link.templ b/templates/components/link.templ
new file mode 100644
index 0000000..bc30df9
--- /dev/null
+++ b/templates/components/link.templ
@@ -0,0 +1,83 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package components
+
+import (
+ "net/url"
+ "fmt"
+)
+
+func formatLinkURL(format string, args ...string) string {
+ var encoded []any
+ for _, arg := range args {
+ encoded = append(encoded, url.PathEscape(arg))
+ }
+ return fmt.Sprintf(format, encoded...)
+}
+
+templ Buttonf(label, format string, args ...string) {
+ @Button(label, formatLinkURL(format, args...))
+}
+
+templ Button(label, url string) {
+ @ButtonCustom(url) {
+ { label }
+ }
+}
+
+templ ButtonCustomf(format string, args ...string) {
+ @ButtonCustom(formatLinkURL(format, args...)) {
+ { children... }
+ }
+}
+
+templ ButtonCustom(url string) {
+ { children... }
+}
+
+templ ExternalLink(label, url string) {
+ @ExternalLinkCustom(url) {
+ { label }
+ }
+}
+
+templ ExternalLinkCustom(url string) {
+ { children... }
+}
+
+templ Linkf(label, format string, args ...string) {
+ @LinkCustomf(formatLinkURL(format, args...)) {
+ { label }
+ }
+}
+
+templ Link(label, url string) {
+ @LinkCustom(url) {
+ { label }
+ }
+}
+
+templ LinkCustomf(format string, args ...string) {
+ @LinkCustom(formatLinkURL(format, args...)) {
+ { children... }
+ }
+}
+
+templ LinkCustom(url string) {
+ { children... }
+}
\ No newline at end of file
diff --git a/templates/components/link_templ.go b/templates/components/link_templ.go
new file mode 100644
index 0000000..7a662b8
--- /dev/null
+++ b/templates/components/link_templ.go
@@ -0,0 +1,408 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package components
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "fmt"
+ "net/url"
+)
+
+func formatLinkURL(format string, args ...string) string {
+ var encoded []any
+ for _, arg := range args {
+ encoded = append(encoded, url.PathEscape(arg))
+ }
+ return fmt.Sprintf(format, encoded...)
+}
+
+func Buttonf(label, format string, args ...string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Err = Button(label, formatLinkURL(format, args...)).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func Button(label, url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var2 == nil {
+ templ_7745c5c3_Var2 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var3 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ var templ_7745c5c3_Var4 string = label
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = ButtonCustom(url).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func ButtonCustomf(format string, args ...string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var5 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var5 == nil {
+ templ_7745c5c3_Var5 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var6 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var5.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = ButtonCustom(formatLinkURL(format, args...)).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func ButtonCustom(url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var7 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var7 == nil {
+ templ_7745c5c3_Var7 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func ExternalLink(label, url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var9 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var9 == nil {
+ templ_7745c5c3_Var9 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var10 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ var templ_7745c5c3_Var11 string = label
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = ExternalLinkCustom(url).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var10), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func ExternalLinkCustom(url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var12 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var12 == nil {
+ templ_7745c5c3_Var12 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var12.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func Linkf(label, format string, args ...string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var14 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var14 == nil {
+ templ_7745c5c3_Var14 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var15 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ var templ_7745c5c3_Var16 string = label
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = LinkCustomf(formatLinkURL(format, args...)).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var15), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func Link(label, url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var17 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var17 == nil {
+ templ_7745c5c3_Var17 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var18 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ var templ_7745c5c3_Var19 string = label
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = LinkCustom(url).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var18), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func LinkCustomf(format string, args ...string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var20 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var20 == nil {
+ templ_7745c5c3_Var20 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var21 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var20.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = LinkCustom(formatLinkURL(format, args...)).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var21), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func LinkCustom(url string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var22 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var22 == nil {
+ templ_7745c5c3_Var22 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var22.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/config.html b/templates/config.html
deleted file mode 100644
index 9999b05..0000000
--- a/templates/config.html
+++ /dev/null
@@ -1,26 +0,0 @@
-{{/**/}}
-
-{{ define "title" }}Config - Jelease{{ end }}
-{{ define "content" }}
-Config
-
-{{- .Config | toYaml -}}
-
-{{ end }}
diff --git a/templates/index.html b/templates/index.html
deleted file mode 100644
index 964f1de..0000000
--- a/templates/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{{/**/}}
-
-{{ define "content" }}
-
-
-
-{{ end }}
diff --git a/templates/layout.html b/templates/layout.html
deleted file mode 100644
index 44e132b..0000000
--- a/templates/layout.html
+++ /dev/null
@@ -1,111 +0,0 @@
-{{/**/}}
-
-
-
-
- {{ block "title" . }}Jelease{{ end }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ block "body" . }}
-
-
-
-
-
- {{- block "breadcrumbs" . }}
- {{- end }}
-
- {{ block "content" . }}
-
- This page has not been implemented yet.
-
- {{ end }}
-
-
-
- Risk.Ident GmbH
- | Created by the Platform team
-
-
- {{ end }}
-
-
-
-
-
- {{ block "scripts" . }}{{ end }}
-
diff --git a/templates/packages/create-pr.html b/templates/packages/create-pr.html
deleted file mode 100644
index 57528e6..0000000
--- a/templates/packages/create-pr.html
+++ /dev/null
@@ -1,210 +0,0 @@
-{{/**/}}
-
-{{ define "title" }}Create PR - {{ .Package.Name }} - Jelease{{ end }}
-
-{{ define "breadcrumbs" }}
-
-{{ end }}
-
-{{ define "content" }}
-Create PR for {{ .Package.Name }}
-
-{{ if not .IsPost }}
- {{ if .Error }}
-
-
Error: Unexpected issue while loading page:
-
{{ .Error }}
-
- {{ end }}
-{{ end }}
-
-
-
-
- Created PRs
-
- {{ if .IsPost }}
- {{ if .Error }}
-
-
Error: There was an error when creating the Pull Request:
-
{{ .Error }}
-
- {{ else }}
- {{ if .DryRun }}
-
-
Success: Request completed.
- However, note that dryrun
was enabled, so no Pull Requests has actually been created.
-
- {{ else }}
-
-
Success: Request completed. See the created Pull Requests below.
-
- {{ end }}
- {{ if gt (len .PullRequests) 0 }}
- {{ range $i, $pr := .PullRequests }}
-
- PR #{{ add $i 1 }}
-
- Title
-
- {{- if $pr.Title -}}
- {{ $pr.Title }}
- {{- else -}}
- (missing Title)
- {{- end -}}
-
- Branches
-
- {{- if and $pr.Head $pr.Base -}}
- into {{ $pr.Base }}
from {{ $pr.Head }}
- {{- else -}}
- (missing branch info)
- {{- end -}}
-
- URL
-
- {{- if $pr.URL -}}
- {{ $pr.URL }}
- {{- else if $pr.RepoRef.URL -}}
- (would've been created on repo: {{ $pr.RepoRef.URL }} )
- {{- else -}}
- (missing URL)
- {{- end -}}
-
- Description
-
- {{- if $pr.Description -}}
-
- {{- $pr.Description -}}
-
- {{- else -}}
- (missing description)
- {{- end -}}
-
- Git diff
-
- {{- if $pr.Commit.Diff -}}
-
- {{- $pr.Commit.Diff -}}
-
- {{- else -}}
- (missing Git diff)
- {{- end -}}
-
-
-
- {{ end }}
- {{ else }}
-
- {{ end }}
- {{ end }}
- {{ else }}
-
The results will be shown here, after you press "Submit".
- {{ end }}
-
-
-{{ end }}
-
-{{ define "scripts" }}
-
-{{ end }}
diff --git a/templates/packages/index.html b/templates/packages/index.html
deleted file mode 100644
index 8beb2b4..0000000
--- a/templates/packages/index.html
+++ /dev/null
@@ -1,63 +0,0 @@
-{{/**/}}
-
-{{ define "title" }}Packages - Jelease{{ end }}
-
-{{ define "breadcrumbs" }}
-
-{{ end }}
-
-{{ define "content" }}
-
-Packages
-
-
- List of all packages found in Jelease's configuration file.
-
-
-
-
-
- Name
- Associated repositories
-
-
-
- {{ range $pkg := .Config.Packages }}
-
-
- {{ $pkg.Name }}
-
-
- {{ range $i, $repo := $pkg.Repos }}
- {{ if gt $i 0 }}
-
- {{ end }}
- {{ $repo.URL }}
- {{ end }}
-
-
- {{ end }}
-
-
-{{ end }}
diff --git a/templates/packages/package.html b/templates/packages/package.html
deleted file mode 100644
index da359d4..0000000
--- a/templates/packages/package.html
+++ /dev/null
@@ -1,53 +0,0 @@
-{{/**/}}
-
-{{ define "title" }}{{ .Package.Name }} - Jelease{{ end }}
-
-{{ define "breadcrumbs" }}
-
-{{ end }}
-
-{{ define "content" }}
-{{ .Package.Name }}
-
-Create PR
-
-
- Affected repositories
-
-
-
-
- Config
-
- {{- toYaml .Package -}}
-
-
-{{ end }}
diff --git a/templates/pages/config.templ b/templates/pages/config.templ
new file mode 100644
index 0000000..832d95c
--- /dev/null
+++ b/templates/pages/config.templ
@@ -0,0 +1,29 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+package pages
+
+import (
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/templates/components"
+)
+
+templ Config(config *config.Config) {
+ @Layout("Config") {
+ Config
+ @components.CodeBlock(config.Censored())
+ }
+}
diff --git a/templates/pages/config_templ.go b/templates/pages/config_templ.go
new file mode 100644
index 0000000..d623ed0
--- /dev/null
+++ b/templates/pages/config_templ.go
@@ -0,0 +1,67 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/templates/components"
+)
+
+func Config(config *config.Config) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var3 := `Config`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.CodeBlock(config.Censored()).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Config").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/errors.templ b/templates/pages/errors.templ
new file mode 100644
index 0000000..e33d83e
--- /dev/null
+++ b/templates/pages/errors.templ
@@ -0,0 +1,43 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+import "github.com/RiskIdent/jelease/templates/components"
+
+templ Error404(message string) {
+ @Layout("Page not found") {
+ Page not found
+ if message != "" {
+ @components.AlertDanger(message)
+ }
+ Click here to return to the start page.
+ }
+}
+
+templ Error405() {
+ @Layout("Method not allowed") {
+ Method not allowed
+
+ Quite the interesting error you got there.
+ If you were navigated here by this website, then this is a bug,
+ and please report it here:
+ https://github.com/RiskIdent/jelease/issues/new
+
+ Click here to return to the start page.
+ }
+}
\ No newline at end of file
diff --git a/templates/pages/errors_templ.go b/templates/pages/errors_templ.go
new file mode 100644
index 0000000..22fb13d
--- /dev/null
+++ b/templates/pages/errors_templ.go
@@ -0,0 +1,190 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import "github.com/RiskIdent/jelease/templates/components"
+
+func Error404(message string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var3 := `Page not found`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if message != "" {
+ templ_7745c5c3_Err = components.AlertDanger(message).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var4 := `Click here`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var5 := `to return to the start page.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Page not found").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func Error405() templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var6 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var6 == nil {
+ templ_7745c5c3_Var6 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var7 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var8 := `Method not allowed`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var9 := `Quite the interesting error you got there.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var10 := `If you were navigated here by this website, then this is a bug,`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var11 := `and please report it here:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var12 := `https://github.com/RiskIdent/jelease/issues/new`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var12)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var13 := `Click here`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var14 := `to return to the start page.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var14)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Method not allowed").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/index.templ b/templates/pages/index.templ
new file mode 100644
index 0000000..b547aa9
--- /dev/null
+++ b/templates/pages/index.templ
@@ -0,0 +1,26 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+templ Index() {
+ @Layout("Jelease") {
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/templates/pages/index_templ.go b/templates/pages/index_templ.go
new file mode 100644
index 0000000..3364f7b
--- /dev/null
+++ b/templates/pages/index_templ.go
@@ -0,0 +1,49 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func Index() templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Jelease").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/layout.templ b/templates/pages/layout.templ
new file mode 100644
index 0000000..7ed0377
--- /dev/null
+++ b/templates/pages/layout.templ
@@ -0,0 +1,110 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+templ Layout(title string) {
+
+
+
+
+ if title == "Jelease" || title == "" {
+ Jelease
+ } else {
+ { title } - Jelease
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { children... }
+
+
+
+ Risk.Ident GmbH
+ | Created by the Platform team
+
+
+
+
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/templates/pages/layout_templ.go b/templates/pages/layout_templ.go
new file mode 100644
index 0000000..b607ee2
--- /dev/null
+++ b/templates/pages/layout_templ.go
@@ -0,0 +1,167 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func Layout(title string) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if title == "Jelease" || title == "" {
+ templ_7745c5c3_Var2 := `Jelease`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ var templ_7745c5c3_Var3 string = title
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var4 := `- Jelease`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var9 := `Risk.Ident GmbH`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var10 := `| Created by the Platform team`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/packages_createpr.templ b/templates/pages/packages_createpr.templ
new file mode 100644
index 0000000..0678b84
--- /dev/null
+++ b/templates/pages/packages_createpr.templ
@@ -0,0 +1,224 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+import (
+ "fmt"
+
+ "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/pkg/github"
+)
+
+type PackagesCreatePRModel struct {
+ Config *config.Config
+ Package config.Package
+ PullRequests []github.PullRequest
+ DryRun bool
+ Version string
+ JiraIssue string
+ IsPost bool
+ Error error
+}
+
+templ PackagesCreatePR(model PackagesCreatePRModel) {
+ @Layout("Create PR") {
+ @components.Breadcrumbs() {
+ @components.Linkf("Packages", "/packages")
+ @components.Linkf(model.Package.Name, "/packages/%s", model.Package.NormalizedName())
+ Create PR
+ }
+
+ Create PR for { model.Package.Name }
+
+ if model.IsPost && model.Error != nil {
+ @components.AlertDangerErr("Unexpected issue while loading page:", model.Error)
+ }
+
+
+
+
+ Created PRs
+ @createPRResults(model)
+
+
+
+ }
+}
+
+templ createPRResults(model PackagesCreatePRModel) {
+
+ if !model.IsPost {
+
The results will be shown here, after you press "Submit".
+ } else {
+ if model.Error != nil {
+ @components.AlertDangerErr("There was an error when creating the Pull Request:", model.Error)
+ } else {
+ @createPRResultsNoError(model)
+ }
+ }
+
+}
+
+templ createPRResultsNoError(model PackagesCreatePRModel) {
+ if model.DryRun {
+
+
Success: Request completed.
+ However, note that dryrun
was enabled, so no Pull Requests has actually been created.
+
+ } else {
+
+
Success: Request completed. See the created Pull Requests below.
+
+ }
+ if len(model.PullRequests) == 0 {
+
+
+ Warning: No Pull Requests were created.
+ Maybe @components.Linkf("look over the configuration", "/packages/%s", model.Package.NormalizedName()),
+ to ensure it's correct?
+
+
+ } else {
+ for i, pr := range model.PullRequests {
+
+ PR #{ fmt.Sprint(i + 1) }
+
+ Title
+
+ if pr.Title != "" {
+ { pr.Title }
+ } else {
+ (missing title)
+ }
+
+ Branches
+
+ if pr.Base != "" && pr.Head != "" {
+ into { pr.Base }
from { pr.Head }
+ } else {
+ (missing branch info)
+ }
+
+ URL
+
+ if pr.URL != "" {
+ @components.ExternalLink(pr.URL, pr.URL)
+ } else if pr.RepoRef.URL != "" {
+ (would've been created on repo:{" "}
+ @components.ExternalLink(pr.RepoRef.URL, pr.RepoRef.URL)
+ )
+ } else {
+ (missing URL)
+ }
+
+ Description
+
+ if pr.Description != "" {
+
+ { pr.Description }
+
+ } else {
+ (missing description)
+ }
+
+ Git diff
+
+ if pr.Commit.Diff != "" {
+
+ { pr.Commit.Diff }
+
+ } else {
+ (missing Git diff)
+ }
+
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/templates/pages/packages_createpr_templ.go b/templates/pages/packages_createpr_templ.go
new file mode 100644
index 0000000..0491c9f
--- /dev/null
+++ b/templates/pages/packages_createpr_templ.go
@@ -0,0 +1,776 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "fmt"
+
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/pkg/github"
+ "github.com/RiskIdent/jelease/templates/components"
+)
+
+type PackagesCreatePRModel struct {
+ Config *config.Config
+ Package config.Package
+ PullRequests []github.PullRequest
+ DryRun bool
+ Version string
+ JiraIssue string
+ IsPost bool
+ Error error
+}
+
+func PackagesCreatePR(model PackagesCreatePRModel) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Var3 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.Linkf("Packages", "/packages").Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.Linkf(model.Package.Name, "/packages/%s", model.Package.NormalizedName()).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var4 := `Create PR`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = components.Breadcrumbs().Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var5 := `Create PR for `
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var6 string = model.Package.Name
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if model.IsPost && model.Error != nil {
+ templ_7745c5c3_Err = components.AlertDangerErr("Unexpected issue while loading page:", model.Error).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var7 := `Create GitHub PR`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var17 := `Created PRs`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = createPRResults(model).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Create PR").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func createPRResults(model PackagesCreatePRModel) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var19 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var19 == nil {
+ templ_7745c5c3_Var19 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !model.IsPost {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var20 := `The results will be shown here, after you press "Submit".`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var20)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ if model.Error != nil {
+ templ_7745c5c3_Err = components.AlertDangerErr("There was an error when creating the Pull Request:", model.Error).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ templ_7745c5c3_Err = createPRResultsNoError(model).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+func createPRResultsNoError(model PackagesCreatePRModel) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var21 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var21 == nil {
+ templ_7745c5c3_Var21 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ if model.DryRun {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var22 := `Success:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var23 := `Request completed.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var23)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var24 := `However, note that `
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var24)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var25 := `dryrun`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var25)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var26 := `was enabled, so no Pull Requests has actually been created.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var26)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var27 := `Success:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var28 := `Request completed. See the created Pull Requests below.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var28)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ if len(model.PullRequests) == 0 {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var29 := `Warning:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var30 := `No Pull Requests were created.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var30)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var31 := `Maybe @components.Linkf("look over the configuration", "/packages/%s", model.Package.NormalizedName()),`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var32 := `to ensure it's correct?`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ for i, pr := range model.PullRequests {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var33 := `PR #`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var33)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var34 string = fmt.Sprint(i + 1)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var35 := `Title`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var35)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if pr.Title != "" {
+ var templ_7745c5c3_Var36 string = pr.Title
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var37 := `(missing title)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var37)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var38 := `Branches`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var38)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if pr.Base != "" && pr.Head != "" {
+ templ_7745c5c3_Var39 := `into `
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var39)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var40 string = pr.Base
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var41 := `from `
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var41)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var42 string = pr.Head
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var43 := `(missing branch info)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var43)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var44 := `URL`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var44)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if pr.URL != "" {
+ templ_7745c5c3_Err = components.ExternalLink(pr.URL, pr.URL).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else if pr.RepoRef.URL != "" {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var45 := `(would've been created on repo:`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var45)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var46 string = " "
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var46))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.ExternalLink(pr.RepoRef.URL, pr.RepoRef.URL).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var47 := `)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var47)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var48 := `(missing URL)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var48)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var49 := `Description`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var49)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if pr.Description != "" {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var50 string = pr.Description
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var51 := `(missing description)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var51)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var52 := `Git diff`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var52)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if pr.Commit.Diff != "" {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var53 string = pr.Commit.Diff
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var54 := `(missing Git diff)`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var54)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/packages_item.templ b/templates/pages/packages_item.templ
new file mode 100644
index 0000000..c7288ab
--- /dev/null
+++ b/templates/pages/packages_item.templ
@@ -0,0 +1,56 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+import (
+ "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/pkg/config"
+)
+
+type PackageItemModel struct {
+ Package config.Package
+}
+
+templ PackagesItem(model PackageItemModel) {
+ @Layout(model.Package.Name) {
+ @components.Breadcrumbs() {
+ @components.Linkf("Packages", "/packages")
+ { model.Package.Name }
+ }
+
+ { model.Package.Name }
+
+ @components.Buttonf("Create PR", "/packages/%s/create-pr", model.Package.NormalizedName())
+
+
+ Affected repositories
+
+ for _, repo := range model.Package.Repos {
+
+ @components.ExternalLink(repo.URL, repo.URL)
+
+ }
+
+
+
+
+ Config
+ @components.CodeBlock(model.Package)
+
+ }
+}
\ No newline at end of file
diff --git a/templates/pages/packages_item_templ.go b/templates/pages/packages_item_templ.go
new file mode 100644
index 0000000..d6b341b
--- /dev/null
+++ b/templates/pages/packages_item_templ.go
@@ -0,0 +1,155 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/templates/components"
+)
+
+type PackageItemModel struct {
+ Package config.Package
+}
+
+func PackagesItem(model PackageItemModel) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Var3 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.Linkf("Packages", "/packages").Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var4 string = model.Package.Name
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = components.Breadcrumbs().Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var5 string = model.Package.Name
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.Buttonf("Create PR", "/packages/%s/create-pr", model.Package.NormalizedName()).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var6 := `Affected repositories`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, repo := range model.Package.Repos {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.ExternalLink(repo.URL, repo.URL).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var7 := `Config`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.CodeBlock(model.Package).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout(model.Package.Name).Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/templates/pages/packages_list.templ b/templates/pages/packages_list.templ
new file mode 100644
index 0000000..7b4f047
--- /dev/null
+++ b/templates/pages/packages_list.templ
@@ -0,0 +1,63 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+// more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program. If not, see .
+
+package pages
+
+import (
+ "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/pkg/config"
+)
+
+templ PackagesList(cfg *config.Config) {
+ @Layout("Packages") {
+ @components.Breadcrumbs() {
+ Packages
+ }
+
+ Packages
+
+
+ List of all packages found in Jelease's configuration file.
+
+
+
+
+
+ Name
+ Associated repositories
+
+
+
+ for _, pkg := range cfg.Packages {
+
+
+ @components.Linkf(pkg.Name, "/packages/%s", pkg.NormalizedName())
+
+
+ for i, repo := range pkg.Repos {
+ if i > 0 {
+
+ }
+ @components.ExternalLink(repo.URL, repo.URL)
+ }
+
+
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/templates/pages/packages_list_templ.go b/templates/pages/packages_list_templ.go
new file mode 100644
index 0000000..5f5f0ee
--- /dev/null
+++ b/templates/pages/packages_list_templ.go
@@ -0,0 +1,156 @@
+// Code generated by templ@v0.2.408 DO NOT EDIT.
+
+package pages
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+import (
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/templates/components"
+)
+
+func PackagesList(cfg *config.Config) templ.Component {
+ return templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Ctx = templ.InitializeContext(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(templ_7745c5c3_Ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ templ_7745c5c3_Ctx = templ.ClearChildren(templ_7745c5c3_Ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ templ_7745c5c3_Var3 := templ.ComponentFunc(func(templ_7745c5c3_Ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var4 := `Packages`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = components.Breadcrumbs().Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var5 := `Packages`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var5)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var6 := `List of all packages found in Jelease's configuration file.`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var7 := `Name`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var8 := `Associated repositories`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, pkg := range cfg.Packages {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.Linkf(pkg.Name, "/packages/%s", pkg.NormalizedName()).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for i, repo := range pkg.Repos {
+ if i > 0 {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Err = components.ExternalLink(repo.URL, repo.URL).Render(templ_7745c5c3_Ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = Layout("Packages").Render(templ.WithChildren(templ_7745c5c3_Ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
From 14557663a4fa4c2f4afd31d918aecc0d08dbe9a3 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 19:45:10 +0200
Subject: [PATCH 02/16] Added extensions recommendations
---
.vscode/extensions.json | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 .vscode/extensions.json
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..9184a77
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,12 @@
+// SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+//
+// SPDX-License-Identifier: CC0-1.0
+{
+ "recommendations": [
+ "editorconfig.editorconfig",
+ "streetsidesoftware.code-spell-checker",
+ "golang.go",
+ "a-h.templ",
+ "redhat.vscode-yaml"
+ ]
+}
\ No newline at end of file
From d42d574f73447566001b0856c580c16ba42e9f7b Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 20:03:32 +0200
Subject: [PATCH 03/16] Added generate tag
---
main.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/main.go b/main.go
index d12cdd0..8ab7677 100644
--- a/main.go
+++ b/main.go
@@ -27,6 +27,8 @@ import (
"gopkg.in/yaml.v3"
)
+//go:generate templ generate
+
//go:embed jelease.yaml
var defaultConfigYAML []byte
From aa57b2f41471a823ee57ea0c085532051945c045 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 20:07:04 +0200
Subject: [PATCH 04/16] Added README.md note on Templ
---
README.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/README.md b/README.md
index 233af05..f8db1a4 100644
--- a/README.md
+++ b/README.md
@@ -130,6 +130,20 @@ config file:
curl localhost:8080/webhook -d @examples/newreleasesio-webhook.json
```
+## Development
+
+Prerequisites:
+
+- Go 1.21 (or later):
+- Templ 0.2.408 (or later):
+
+The HTML pages are templated using Templ. This is a manual step that
+needs to be done after each code change to any `.templ` files.
+
+```bash
+go generate
+```
+
## Building the application and docker image
The application uses [earthly](https://earthly.dev/get-earthly) for building
From cabe09bc3e680a9150d1e6cf7b20446a95a46b77 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 20:15:52 +0200
Subject: [PATCH 05/16] Added .editorconfig
---
.editorconfig | 13 +
.github/workflows/govulncheck.yml | 2 +-
.github/workflows/reuse.yml | 2 +-
templates/components/alerts.templ | 18 +-
templates/components/breadcrumbs.templ | 10 +-
templates/components/codeblock.templ | 16 +-
templates/components/link.templ | 58 ++--
templates/pages/config.templ | 10 +-
templates/pages/errors.templ | 34 +-
templates/pages/index.templ | 10 +-
templates/pages/layout.templ | 174 +++++-----
templates/pages/packages_createpr.templ | 368 ++++++++++-----------
templates/pages/packages_createpr_templ.go | 48 +--
templates/pages/packages_item.templ | 58 ++--
templates/pages/packages_list.templ | 70 ++--
15 files changed, 452 insertions(+), 439 deletions(-)
create mode 100644 .editorconfig
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..d442d3c
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,13 @@
+root = true
+
+[*]
+indent_size = 2
+indent_style = space
+charset = utf-8
+insert_final_newline = true
+trim_trailing_whitespace = true
+end_of_line = lf
+
+[{*.{go,templ},go.mod,go.sum,Makefile}]
+indent_style = tab
+indent_size = 4
diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml
index ef6b469..7eba3f7 100644
--- a/.github/workflows/govulncheck.yml
+++ b/.github/workflows/govulncheck.yml
@@ -4,7 +4,7 @@
name: govulncheck
-on:
+on:
push:
branches:
- main
diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml
index bf05b32..6456113 100644
--- a/.github/workflows/reuse.yml
+++ b/.github/workflows/reuse.yml
@@ -5,7 +5,7 @@
name: REUSE Compliance Check
-on:
+on:
push:
branches:
- main
diff --git a/templates/components/alerts.templ b/templates/components/alerts.templ
index 914dd06..1f4c30a 100644
--- a/templates/components/alerts.templ
+++ b/templates/components/alerts.templ
@@ -18,16 +18,16 @@
package components
templ AlertDanger(title string) {
-
-
Error: {title}
- { children... }
-
+
+
Error: {title}
+ { children... }
+
}
templ AlertDangerErr(title string, err error) {
-
-
Error: {title}
- { children... }
-
{ err.Error() }
-
+
+
Error: {title}
+ { children... }
+
{ err.Error() }
+
}
\ No newline at end of file
diff --git a/templates/components/breadcrumbs.templ b/templates/components/breadcrumbs.templ
index d42c279..735a6c0 100644
--- a/templates/components/breadcrumbs.templ
+++ b/templates/components/breadcrumbs.templ
@@ -18,9 +18,9 @@
package components
templ Breadcrumbs() {
-
+
}
\ No newline at end of file
diff --git a/templates/components/codeblock.templ b/templates/components/codeblock.templ
index b1a9761..33bf13b 100644
--- a/templates/components/codeblock.templ
+++ b/templates/components/codeblock.templ
@@ -17,15 +17,15 @@
package components
import (
- "gopkg.in/yaml.v3"
+ "gopkg.in/yaml.v3"
)
templ CodeBlock(value any) {
- if b, err := yaml.Marshal(value); err != nil {
- @AlertDangerErr("Failed to serialize YAML:", err)
- } else {
-
- { string(b) }
-
- }
+ if b, err := yaml.Marshal(value); err != nil {
+ @AlertDangerErr("Failed to serialize YAML:", err)
+ } else {
+
+ { string(b) }
+
+ }
}
\ No newline at end of file
diff --git a/templates/components/link.templ b/templates/components/link.templ
index bc30df9..6a051bd 100644
--- a/templates/components/link.templ
+++ b/templates/components/link.templ
@@ -18,66 +18,66 @@
package components
import (
- "net/url"
- "fmt"
+ "net/url"
+ "fmt"
)
func formatLinkURL(format string, args ...string) string {
- var encoded []any
- for _, arg := range args {
- encoded = append(encoded, url.PathEscape(arg))
- }
- return fmt.Sprintf(format, encoded...)
+ var encoded []any
+ for _, arg := range args {
+ encoded = append(encoded, url.PathEscape(arg))
+ }
+ return fmt.Sprintf(format, encoded...)
}
templ Buttonf(label, format string, args ...string) {
- @Button(label, formatLinkURL(format, args...))
+ @Button(label, formatLinkURL(format, args...))
}
templ Button(label, url string) {
- @ButtonCustom(url) {
- { label }
- }
+ @ButtonCustom(url) {
+ { label }
+ }
}
templ ButtonCustomf(format string, args ...string) {
- @ButtonCustom(formatLinkURL(format, args...)) {
- { children... }
- }
+ @ButtonCustom(formatLinkURL(format, args...)) {
+ { children... }
+ }
}
templ ButtonCustom(url string) {
- { children... }
+ { children... }
}
templ ExternalLink(label, url string) {
- @ExternalLinkCustom(url) {
- { label }
- }
+ @ExternalLinkCustom(url) {
+ { label }
+ }
}
templ ExternalLinkCustom(url string) {
- { children... }
+ { children... }
}
templ Linkf(label, format string, args ...string) {
- @LinkCustomf(formatLinkURL(format, args...)) {
- { label }
- }
+ @LinkCustomf(formatLinkURL(format, args...)) {
+ { label }
+ }
}
templ Link(label, url string) {
- @LinkCustom(url) {
- { label }
- }
+ @LinkCustom(url) {
+ { label }
+ }
}
templ LinkCustomf(format string, args ...string) {
- @LinkCustom(formatLinkURL(format, args...)) {
- { children... }
- }
+ @LinkCustom(formatLinkURL(format, args...)) {
+ { children... }
+ }
}
templ LinkCustom(url string) {
- { children... }
+ { children... }
}
\ No newline at end of file
diff --git a/templates/pages/config.templ b/templates/pages/config.templ
index 832d95c..fb25873 100644
--- a/templates/pages/config.templ
+++ b/templates/pages/config.templ
@@ -17,13 +17,13 @@
package pages
import (
- "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/pkg/config"
"github.com/RiskIdent/jelease/templates/components"
)
templ Config(config *config.Config) {
- @Layout("Config") {
- Config
- @components.CodeBlock(config.Censored())
- }
+ @Layout("Config") {
+ Config
+ @components.CodeBlock(config.Censored())
+ }
}
diff --git a/templates/pages/errors.templ b/templates/pages/errors.templ
index e33d83e..5cd9125 100644
--- a/templates/pages/errors.templ
+++ b/templates/pages/errors.templ
@@ -20,24 +20,24 @@ package pages
import "github.com/RiskIdent/jelease/templates/components"
templ Error404(message string) {
- @Layout("Page not found") {
- Page not found
- if message != "" {
- @components.AlertDanger(message)
- }
- Click here to return to the start page.
- }
+ @Layout("Page not found") {
+ Page not found
+ if message != "" {
+ @components.AlertDanger(message)
+ }
+ Click here to return to the start page.
+ }
}
templ Error405() {
- @Layout("Method not allowed") {
- Method not allowed
-
- Quite the interesting error you got there.
- If you were navigated here by this website, then this is a bug,
- and please report it here:
- https://github.com/RiskIdent/jelease/issues/new
-
- Click here to return to the start page.
- }
+ @Layout("Method not allowed") {
+ Method not allowed
+
+ Quite the interesting error you got there.
+ If you were navigated here by this website, then this is a bug,
+ and please report it here:
+ https://github.com/RiskIdent/jelease/issues/new
+
+ Click here to return to the start page.
+ }
}
\ No newline at end of file
diff --git a/templates/pages/index.templ b/templates/pages/index.templ
index b547aa9..232281d 100644
--- a/templates/pages/index.templ
+++ b/templates/pages/index.templ
@@ -18,9 +18,9 @@
package pages
templ Index() {
- @Layout("Jelease") {
-
-
-
- }
+ @Layout("Jelease") {
+
+
+
+ }
}
\ No newline at end of file
diff --git a/templates/pages/layout.templ b/templates/pages/layout.templ
index 7ed0377..955298c 100644
--- a/templates/pages/layout.templ
+++ b/templates/pages/layout.templ
@@ -18,93 +18,93 @@
package pages
templ Layout(title string) {
-
-
-
-
- if title == "Jelease" || title == "" {
- Jelease
- } else {
- { title } - Jelease
- }
-
-
-
-
+
+
+
+
+ if title == "Jelease" || title == "" {
+ Jelease
+ } else {
+ { title } - Jelease
+ }
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- { children... }
-
-
-
- Risk.Ident GmbH
- | Created by the Platform team
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ { children... }
+
+
+
+ Risk.Ident GmbH
+ | Created by the Platform team
+
+
+
+
+
+
+
+
+
}
\ No newline at end of file
diff --git a/templates/pages/packages_createpr.templ b/templates/pages/packages_createpr.templ
index 0678b84..fe5fdb9 100644
--- a/templates/pages/packages_createpr.templ
+++ b/templates/pages/packages_createpr.templ
@@ -18,207 +18,207 @@
package pages
import (
- "fmt"
+ "fmt"
- "github.com/RiskIdent/jelease/templates/components"
- "github.com/RiskIdent/jelease/pkg/config"
- "github.com/RiskIdent/jelease/pkg/github"
+ "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/pkg/config"
+ "github.com/RiskIdent/jelease/pkg/github"
)
type PackagesCreatePRModel struct {
- Config *config.Config
- Package config.Package
- PullRequests []github.PullRequest
- DryRun bool
- Version string
- JiraIssue string
- IsPost bool
- Error error
+ Config *config.Config
+ Package config.Package
+ PullRequests []github.PullRequest
+ DryRun bool
+ Version string
+ JiraIssue string
+ IsPost bool
+ Error error
}
templ PackagesCreatePR(model PackagesCreatePRModel) {
- @Layout("Create PR") {
- @components.Breadcrumbs() {
- @components.Linkf("Packages", "/packages")
- @components.Linkf(model.Package.Name, "/packages/%s", model.Package.NormalizedName())
- Create PR
- }
+ @Layout("Create PR") {
+ @components.Breadcrumbs() {
+ @components.Linkf("Packages", "/packages")
+ @components.Linkf(model.Package.Name, "/packages/%s", model.Package.NormalizedName())
+ Create PR
+ }
- Create PR for { model.Package.Name }
+ Create PR for { model.Package.Name }
- if model.IsPost && model.Error != nil {
- @components.AlertDangerErr("Unexpected issue while loading page:", model.Error)
- }
+ if model.IsPost && model.Error != nil {
+ @components.AlertDangerErr("Unexpected issue while loading page:", model.Error)
+ }
-
+
-
- Created PRs
- @createPRResults(model)
-
+
+ Created PRs
+ @createPRResults(model)
+
-
- }
+ // Some magic to make URL query params match the POSTed form data
+ const url = new URL(location);
+
+ // Need to Array.from(), as without that this becomes glitchy,
+ // because we're removing items at the same time we're iterating it.
+ const searchParamKeys = Array.from(url.searchParams.keys());
+ for (const key of searchParamKeys) {
+ url.searchParams.delete(key);
+ }
+ for (const [key, value] of new FormData(form).entries()) {
+ if (typeof value === "string" && value !== "") {
+ url.searchParams.set(key, value);
+ }
+ }
+ console.log("Pushing state:", url);
+ history.pushState({}, "", url);
+ });
+ })();
+
+ }
}
templ createPRResults(model PackagesCreatePRModel) {
-
- if !model.IsPost {
-
The results will be shown here, after you press "Submit".
- } else {
- if model.Error != nil {
- @components.AlertDangerErr("There was an error when creating the Pull Request:", model.Error)
- } else {
- @createPRResultsNoError(model)
- }
- }
-
+
+ if !model.IsPost {
+
The results will be shown here, after you press "Submit".
+ } else {
+ if model.Error != nil {
+ @components.AlertDangerErr("There was an error when creating the Pull Request:", model.Error)
+ } else {
+ @createPRResultsNoError(model)
+ }
+ }
+
}
templ createPRResultsNoError(model PackagesCreatePRModel) {
- if model.DryRun {
-
-
Success: Request completed.
- However, note that dryrun
was enabled, so no Pull Requests has actually been created.
-
- } else {
-
-
Success: Request completed. See the created Pull Requests below.
-
- }
- if len(model.PullRequests) == 0 {
-
-
- Warning: No Pull Requests were created.
- Maybe @components.Linkf("look over the configuration", "/packages/%s", model.Package.NormalizedName()),
- to ensure it's correct?
-
-
- } else {
- for i, pr := range model.PullRequests {
-
- PR #{ fmt.Sprint(i + 1) }
-
- Title
-
- if pr.Title != "" {
- { pr.Title }
- } else {
- (missing title)
- }
-
- Branches
-
- if pr.Base != "" && pr.Head != "" {
- into { pr.Base }
from { pr.Head }
- } else {
- (missing branch info)
- }
-
- URL
-
- if pr.URL != "" {
- @components.ExternalLink(pr.URL, pr.URL)
- } else if pr.RepoRef.URL != "" {
- (would've been created on repo:{" "}
- @components.ExternalLink(pr.RepoRef.URL, pr.RepoRef.URL)
- )
- } else {
- (missing URL)
- }
-
- Description
-
- if pr.Description != "" {
-
- { pr.Description }
-
- } else {
- (missing description)
- }
-
- Git diff
-
- if pr.Commit.Diff != "" {
-
- { pr.Commit.Diff }
-
- } else {
- (missing Git diff)
- }
-
-
-
- }
- }
+ if model.DryRun {
+
+
Success: Request completed.
+ However, note that dryrun
was enabled, so no Pull Requests has actually been created.
+
+ } else {
+
+
Success: Request completed. See the created Pull Requests below.
+
+ }
+ if len(model.PullRequests) == 0 {
+
+
+ Warning: No Pull Requests were created.
+ Maybe @components.Linkf("look over the configuration", "/packages/%s", model.Package.NormalizedName()),
+ to ensure it's correct?
+
+
+ } else {
+ for i, pr := range model.PullRequests {
+
+ PR #{ fmt.Sprint(i + 1) }
+
+ Title
+
+ if pr.Title != "" {
+ { pr.Title }
+ } else {
+ (missing title)
+ }
+
+ Branches
+
+ if pr.Base != "" && pr.Head != "" {
+ into { pr.Base }
from { pr.Head }
+ } else {
+ (missing branch info)
+ }
+
+ URL
+
+ if pr.URL != "" {
+ @components.ExternalLink(pr.URL, pr.URL)
+ } else if pr.RepoRef.URL != "" {
+ (would've been created on repo:{" "}
+ @components.ExternalLink(pr.RepoRef.URL, pr.RepoRef.URL)
+ )
+ } else {
+ (missing URL)
+ }
+
+ Description
+
+ if pr.Description != "" {
+
+ { pr.Description }
+
+ } else {
+ (missing description)
+ }
+
+ Git diff
+
+ if pr.Commit.Diff != "" {
+
+ { pr.Commit.Diff }
+
+ } else {
+ (missing Git diff)
+ }
+
+
+
+ }
+ }
}
\ No newline at end of file
diff --git a/templates/pages/packages_createpr_templ.go b/templates/pages/packages_createpr_templ.go
index 0491c9f..f0b4525 100644
--- a/templates/pages/packages_createpr_templ.go
+++ b/templates/pages/packages_createpr_templ.go
@@ -270,31 +270,31 @@ func PackagesCreatePR(model PackagesCreatePRModel) templ.Component {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var18 := `
- (function() {
- const form = document.getElementById("create-pr-form");
- form.addEventListener("submit", function() {
- document.getElementById("results").innerHTML = ` + "`" + `Processing, please wait...
` + "`" + `;
- document.getElementById("submit").setAttribute('disabled', 'disabled');
+ (function() {
+ const form = document.getElementById("create-pr-form");
+ form.addEventListener("submit", function() {
+ document.getElementById("results").innerHTML = ` + "`" + `Processing, please wait...
` + "`" + `;
+ document.getElementById("submit").setAttribute('disabled', 'disabled');
- // Some magic to make URL query params match the POSTed form data
- const url = new URL(location);
-
- // Need to Array.from(), as without that this becomes glitchy,
- // because we're removing items at the same time we're iterating it.
- const searchParamKeys = Array.from(url.searchParams.keys());
- for (const key of searchParamKeys) {
- url.searchParams.delete(key);
- }
- for (const [key, value] of new FormData(form).entries()) {
- if (typeof value === "string" && value !== "") {
- url.searchParams.set(key, value);
- }
- }
- console.log("Pushing state:", url);
- history.pushState({}, "", url);
- });
- })();
- `
+ // Some magic to make URL query params match the POSTed form data
+ const url = new URL(location);
+
+ // Need to Array.from(), as without that this becomes glitchy,
+ // because we're removing items at the same time we're iterating it.
+ const searchParamKeys = Array.from(url.searchParams.keys());
+ for (const key of searchParamKeys) {
+ url.searchParams.delete(key);
+ }
+ for (const [key, value] of new FormData(form).entries()) {
+ if (typeof value === "string" && value !== "") {
+ url.searchParams.set(key, value);
+ }
+ }
+ console.log("Pushing state:", url);
+ history.pushState({}, "", url);
+ });
+ })();
+ `
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
diff --git a/templates/pages/packages_item.templ b/templates/pages/packages_item.templ
index c7288ab..a616d50 100644
--- a/templates/pages/packages_item.templ
+++ b/templates/pages/packages_item.templ
@@ -18,39 +18,39 @@
package pages
import (
- "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/templates/components"
"github.com/RiskIdent/jelease/pkg/config"
)
type PackageItemModel struct {
- Package config.Package
+ Package config.Package
}
templ PackagesItem(model PackageItemModel) {
- @Layout(model.Package.Name) {
- @components.Breadcrumbs() {
- @components.Linkf("Packages", "/packages")
- { model.Package.Name }
- }
-
- { model.Package.Name }
-
- @components.Buttonf("Create PR", "/packages/%s/create-pr", model.Package.NormalizedName())
-
-
- Affected repositories
-
- for _, repo := range model.Package.Repos {
-
- @components.ExternalLink(repo.URL, repo.URL)
-
- }
-
-
-
-
- Config
- @components.CodeBlock(model.Package)
-
- }
-}
\ No newline at end of file
+ @Layout(model.Package.Name) {
+ @components.Breadcrumbs() {
+ @components.Linkf("Packages", "/packages")
+ { model.Package.Name }
+ }
+
+ { model.Package.Name }
+
+ @components.Buttonf("Create PR", "/packages/%s/create-pr", model.Package.NormalizedName())
+
+
+ Affected repositories
+
+ for _, repo := range model.Package.Repos {
+
+ @components.ExternalLink(repo.URL, repo.URL)
+
+ }
+
+
+
+
+ Config
+ @components.CodeBlock(model.Package)
+
+ }
+}
diff --git a/templates/pages/packages_list.templ b/templates/pages/packages_list.templ
index 7b4f047..685f488 100644
--- a/templates/pages/packages_list.templ
+++ b/templates/pages/packages_list.templ
@@ -18,46 +18,46 @@
package pages
import (
- "github.com/RiskIdent/jelease/templates/components"
+ "github.com/RiskIdent/jelease/templates/components"
"github.com/RiskIdent/jelease/pkg/config"
)
templ PackagesList(cfg *config.Config) {
- @Layout("Packages") {
- @components.Breadcrumbs() {
- Packages
- }
+ @Layout("Packages") {
+ @components.Breadcrumbs() {
+ Packages
+ }
- Packages
+ Packages
-
- List of all packages found in Jelease's configuration file.
-
+
+ List of all packages found in Jelease's configuration file.
+
-
-
-
- Name
- Associated repositories
-
-
-
- for _, pkg := range cfg.Packages {
-
-
- @components.Linkf(pkg.Name, "/packages/%s", pkg.NormalizedName())
-
-
- for i, repo := range pkg.Repos {
- if i > 0 {
-
- }
- @components.ExternalLink(repo.URL, repo.URL)
- }
-
-
- }
-
-
- }
+
+
+
+ Name
+ Associated repositories
+
+
+
+ for _, pkg := range cfg.Packages {
+
+
+ @components.Linkf(pkg.Name, "/packages/%s", pkg.NormalizedName())
+
+
+ for i, repo := range pkg.Repos {
+ if i > 0 {
+
+ }
+ @components.ExternalLink(repo.URL, repo.URL)
+ }
+
+
+ }
+
+
+ }
}
\ No newline at end of file
From c27b23729b204000f533fd2273b891e5091d5b88 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Fri, 20 Oct 2023 20:17:10 +0200
Subject: [PATCH 06/16] Added license header to .editorconfig
---
.editorconfig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.editorconfig b/.editorconfig
index d442d3c..a765a0b 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: 2022 Risk.Ident GmbH
+#
+# SPDX-License-Identifier: CC0-1.0
+
root = true
[*]
From dbc8f25724b44e511bacbcc1dbff33729ba35832 Mon Sep 17 00:00:00 2001
From: Kalle Fagerberg
Date: Mon, 23 Oct 2023 13:31:07 +0200
Subject: [PATCH 07/16] Added missing LF at EOF
---
templates/components/alerts.templ | 2 +-
templates/components/breadcrumbs.templ | 2 +-
templates/components/codeblock.templ | 2 +-
templates/components/link.templ | 2 +-
templates/pages/errors.templ | 2 +-
templates/pages/index.templ | 2 +-
templates/pages/layout.templ | 2 +-
templates/pages/packages_createpr.templ | 2 +-
templates/pages/packages_list.templ | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/templates/components/alerts.templ b/templates/components/alerts.templ
index 1f4c30a..37d5be0 100644
--- a/templates/components/alerts.templ
+++ b/templates/components/alerts.templ
@@ -30,4 +30,4 @@ templ AlertDangerErr(title string, err error) {
{ children... }
{ err.Error() }
-}
\ No newline at end of file
+}
diff --git a/templates/components/breadcrumbs.templ b/templates/components/breadcrumbs.templ
index 735a6c0..688e631 100644
--- a/templates/components/breadcrumbs.templ
+++ b/templates/components/breadcrumbs.templ
@@ -23,4 +23,4 @@ templ Breadcrumbs() {
{ children... }
-}
\ No newline at end of file
+}
diff --git a/templates/components/codeblock.templ b/templates/components/codeblock.templ
index 33bf13b..c6a1ceb 100644
--- a/templates/components/codeblock.templ
+++ b/templates/components/codeblock.templ
@@ -28,4 +28,4 @@ templ CodeBlock(value any) {
{ string(b) }
}
-}
\ No newline at end of file
+}
diff --git a/templates/components/link.templ b/templates/components/link.templ
index 6a051bd..c4c359e 100644
--- a/templates/components/link.templ
+++ b/templates/components/link.templ
@@ -80,4 +80,4 @@ templ LinkCustomf(format string, args ...string) {
templ LinkCustom(url string) {
{ children... }
-}
\ No newline at end of file
+}
diff --git a/templates/pages/errors.templ b/templates/pages/errors.templ
index 5cd9125..4f49994 100644
--- a/templates/pages/errors.templ
+++ b/templates/pages/errors.templ
@@ -40,4 +40,4 @@ templ Error405() {
Click here to return to the start page.
}
-}
\ No newline at end of file
+}
diff --git a/templates/pages/index.templ b/templates/pages/index.templ
index 232281d..db20ccd 100644
--- a/templates/pages/index.templ
+++ b/templates/pages/index.templ
@@ -23,4 +23,4 @@ templ Index() {
}
-}
\ No newline at end of file
+}
diff --git a/templates/pages/layout.templ b/templates/pages/layout.templ
index 955298c..ca0fa40 100644
--- a/templates/pages/layout.templ
+++ b/templates/pages/layout.templ
@@ -107,4 +107,4 @@ templ Layout(title string) {