renamed templates package to ui

This commit is contained in:
Erik Brakkee 2024-08-17 10:22:03 +02:00
parent 49912e02d0
commit c66be7775f
12 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
templates2 "git.wamblee.org/converge/pkg/server/templates" templates2 "git.wamblee.org/converge/pkg/server/ui"
"net/http" "net/http"
) )

View File

@ -2,7 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"git.wamblee.org/converge/pkg/server/templates" "git.wamblee.org/converge/pkg/server/ui"
"github.com/gliderlabs/ssh" "github.com/gliderlabs/ssh"
"math/rand" "math/rand"
"net/http" "net/http"
@ -32,7 +32,7 @@ func generateCLIExammple(w http.ResponseWriter, r *http.Request) {
downloadCommand := r.FormValue("download-command") downloadCommand := r.FormValue("download-command")
certificateValidation := r.FormValue("certificate-validation") != "" certificateValidation := r.FormValue("certificate-validation") != ""
sshPublicKeys := strings.Split(keysString, "\n") sshPublicKeys := strings.Split(keysString, "\n")
usageInputs := templates.NewUsageInputs(id, sshPublicKeys, remoteShells, localShells, downloadCommand, usageInputs := ui.NewUsageInputs(id, sshPublicKeys, remoteShells, localShells, downloadCommand,
certificateValidation) certificateValidation)
if generatedId { if generatedId {
usageInputs.ErrorMessages = append(usageInputs.ErrorMessages, "rendez-vous id is randomly generated, changes on every page refresh") usageInputs.ErrorMessages = append(usageInputs.ErrorMessages, "rendez-vous id is randomly generated, changes on every page refresh")
@ -64,7 +64,7 @@ func generateCLIExammple(w http.ResponseWriter, r *http.Request) {
"No valid public keys configured. Without these the agent will not work.") "No valid public keys configured. Without these the agent will not work.")
} }
err = templates.ShellUsage(access, usageInputs).Render(r.Context(), w) err = ui.ShellUsage(access, usageInputs).Render(r.Context(), w)
if err != nil { if err != nil {
http.Error(w, err.Error(), 500) http.Error(w, err.Error(), 500)
} }

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"git.wamblee.org/converge/pkg/comms" "git.wamblee.org/converge/pkg/comms"
"git.wamblee.org/converge/pkg/models" "git.wamblee.org/converge/pkg/models"
templates2 "git.wamblee.org/converge/pkg/server/templates" templates2 "git.wamblee.org/converge/pkg/server/ui"
"github.com/a-h/templ" "github.com/a-h/templ"
"log" "log"
"math/rand" "math/rand"

View File

@ -3,7 +3,7 @@ package matchmaker
import ( import (
"context" "context"
"git.wamblee.org/converge/pkg/models" "git.wamblee.org/converge/pkg/models"
"git.wamblee.org/converge/pkg/server/templates" "git.wamblee.org/converge/pkg/server/ui"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -138,7 +138,7 @@ func (session *WebSession) WriteNotifications(location *time.Location, ctx conte
func (session *WebSession) writeNotificationToClient(location *time.Location, notification *models.State) bool { func (session *WebSession) writeNotificationToClient(location *time.Location, notification *models.State) bool {
agents, clients := notification.Slices() agents, clients := notification.Slices()
err := templates.State(agents, clients, location).Render(context.Background(), session.conn) err := ui.State(agents, clients, location).Render(context.Background(), session.conn)
if err != nil { if err != nil {
log.Printf("WS connection closed: %v", err) log.Printf("WS connection closed: %v", err)
return false return false

View File

@ -1,4 +1,4 @@
package templates package ui
templ About() { templ About() {
<div> <div>

View File

@ -1,4 +1,4 @@
package templates package ui
func active(actual int, active int) string { func active(actual int, active int) string {

View File

@ -1,4 +1,4 @@
package templates package ui
type Shell string type Shell string

View File

@ -1,4 +1,4 @@
package templates package ui
templ Downloads() { templ Downloads() {

View File

@ -1,4 +1,4 @@
package templates package ui
import "git.wamblee.org/converge/pkg/models" import "git.wamblee.org/converge/pkg/models"

View File

@ -1,4 +1,4 @@
package templates package ui
import ( import (
"git.wamblee.org/converge/pkg/models" "git.wamblee.org/converge/pkg/models"

View File

@ -1,4 +1,4 @@
package templates package ui
import "git.wamblee.org/converge/pkg/models" import "git.wamblee.org/converge/pkg/models"

View File

@ -1,4 +1,4 @@
package templates package ui
import ( import (
"fmt" "fmt"