From a791fbfff6b5a95c5bd15df4ae94d93f5d15606f Mon Sep 17 00:00:00 2001
From: Tom Baker <92309070+tobaker@users.noreply.github.com>
Date: Mon, 17 Jul 2023 17:18:52 +0100
Subject: [PATCH] feat: Add username to main lock screen (#3597)
* Add username to lock screen
---
server/controllers/templates/web_templates.go | 5 +++++
server/server.go | 1 +
server/static/css/custom.css | 6 +++++-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/server/controllers/templates/web_templates.go b/server/controllers/templates/web_templates.go
index a7a0b4140..23c8835cf 100644
--- a/server/controllers/templates/web_templates.go
+++ b/server/controllers/templates/web_templates.go
@@ -36,6 +36,7 @@ type LockIndexData struct {
PullNum int
Path string
Workspace string
+ LockedBy string
Time time.Time
TimeFormatted string
}
@@ -119,6 +120,7 @@ var IndexTemplate = template.Must(template.New("index.html.tmpl").Parse(`
Repository
Project
Workspace
+ Locked By
Date/Time
Status
@@ -133,6 +135,9 @@ var IndexTemplate = template.Must(template.New("index.html.tmpl").Parse(`
{{.Workspace}}
+
+ {{.LockedBy}}
+
{{.TimeFormatted}}
diff --git a/server/server.go b/server/server.go
index ac0277402..91aca3be8 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1037,6 +1037,7 @@ func (s *Server) Index(w http.ResponseWriter, _ *http.Request) {
// query params as part of the lock URL.
LockPath: lockURL.String(),
RepoFullName: v.Project.RepoFullName,
+ LockedBy: v.Pull.Author,
PullNum: v.Pull.Num,
Path: v.Project.Path,
Workspace: v.Workspace,
diff --git a/server/static/css/custom.css b/server/static/css/custom.css
index ab1cc63eb..644131d32 100644
--- a/server/static/css/custom.css
+++ b/server/static/css/custom.css
@@ -238,7 +238,7 @@ tbody {
/* Styles for the lock index */
.lock-grid{
display: grid;
- grid-template-columns: auto auto auto auto auto;
+ grid-template-columns: auto auto auto auto auto auto;
border: 1px solid #dbeaf4;
width: 100%;
font-size: 12px;
@@ -282,6 +282,10 @@ tbody {
word-break: break-all;
}
+.lock-username {
+ word-break: break-all;
+}
+
.lock-path {
padding: .2rem .5rem;
margin: 0 .2rem;