From 26f6bc6b3bdc546a6c18d115017d74849ef26787 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sun, 16 Mar 2025 19:38:37 +0200 Subject: [PATCH] appview/pulls: improve ui + validate patches --- .../pages/templates/repo/issues/issue.html | 5 +- appview/pages/templates/repo/pulls/new.html | 24 ++++--- appview/pages/templates/repo/pulls/pull.html | 67 ++++++++----------- appview/state/pull.go | 38 ++++++++++- appview/state/signer.go | 21 ++++-- 5 files changed, 98 insertions(+), 57 deletions(-) diff --git a/appview/pages/templates/repo/issues/issue.html b/appview/pages/templates/repo/issues/issue.html index 6cbca117..a32d2fbc 100644 --- a/appview/pages/templates/repo/issues/issue.html +++ b/appview/pages/templates/repo/issues/issue.html @@ -1,7 +1,4 @@ -{{ define "title" }} - {{ .Issue.Title }} · issue #{{ .Issue.IssueId }} · - {{ .RepoInfo.FullName }} -{{ end }} +{{ define "title" }}{{ .Issue.Title }} · issue #{{ .Issue.IssueId }} ·{{ .RepoInfo.FullName }}{{ end }} {{ define "repoContent" }}
diff --git a/appview/pages/templates/repo/pulls/new.html b/appview/pages/templates/repo/pulls/new.html index b7f3ed13..4d09d809 100644 --- a/appview/pages/templates/repo/pulls/new.html +++ b/appview/pages/templates/repo/pulls/new.html @@ -15,15 +15,16 @@

The branch you want to make your change against.

- + + {{ range .Branches }} + + {{ end }}
@@ -44,7 +45,12 @@ rows="10" class="w-full resize-y font-mono" placeholder="Paste your git-format-patch output here." + hx-post="/pulls/validate" + hx-trigger="input changed delay:500ms" + hx-target="#patch-validation" + hx-include="[name='patch']" > +
diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 65c8b85f..466f2aa0 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -69,7 +69,7 @@ {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }} {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} - {{ if $isPullAuthor }} + {{ if and $isPullAuthor (not .Pull.State.IsMerged) }}
{{ block "resubmitCard" . }} {{ end }}
@@ -87,24 +87,6 @@ {{ end }} - {{ if and (or $isPullAuthor $isPushAllowed) (not .Pull.State.IsMerged) }} - {{ $action := "close" }} - {{ $icon := "circle-x" }} - {{ $hoverColor := "red" }} - {{ if .Pull.State.IsClosed }} - {{ $action = "reopen" }} - {{ $icon = "circle-dot" }} - {{ $hoverColor = "green" }} - {{ end }} - - {{ end }} -
{{ end }} @@ -202,21 +184,11 @@
- {{ if gt (len .Comments) 0 }} -
- {{ else }} -
- {{ end }} -
Pull request successfully mergedpull request successfully merged
@@ -263,6 +235,7 @@ {{ define "noConflictsCard" }} {{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }} + {{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
@@ -291,6 +264,24 @@ {{ end }} + {{ if and (or $isPullAuthor $isPushAllowed) (not .Pull.State.IsMerged) }} + {{ $action := "close" }} + {{ $icon := "circle-x" }} + {{ $hoverColor := "red" }} + {{ if .Pull.State.IsClosed }} + {{ $action = "reopen" }} + {{ $icon = "circle-dot" }} + {{ $hoverColor = "green" }} + {{ end }} + + {{ end }} +
@@ -304,21 +295,21 @@
- Resubmit your patch + resubmit your patch
- You can update this patch to address reviews if any. - This begins a new round of reviews, - you can still view your previous submissions and reviews. + You can update this patch to address any reviews. + This will begin a new round of reviews, + but you'll still be able to view your previous submissions and feedback.
-
-
+
+