diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 0dca0b7e..0bc50ef8 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -6,15 +6,56 @@ {{ template "repo/pulls/fragments/og" (dict "RepoInfo" .RepoInfo "Pull" .Pull) }} {{ end }} -{{ define "repoContentLayout" }} -
-
-
- {{ block "repoContent" . }}{{ end }} -
- {{ block "repoAfter" . }}{{ end }} +{{ define "mainLayout" }} +
+
+ {{ block "contentLayout" . }} + {{ block "content" . }}{{ end }} + {{ end }}
-
+ {{ block "contentAfterLayout" . }} +
+ {{ block "contentAfter" . }}{{ end }} +
+ {{ end }} +
+ +{{ end }} + +{{ define "repoContentLayout" }} +
+
+ {{ block "repoContent" . }}{{ end }} +
+
{{ template "repo/fragments/labelPanel" (dict "RepoInfo" $.RepoInfo "Defs" $.LabelDefs @@ -29,9 +70,12 @@
{{ end }} +{{ define "contentAfter" }} + {{ template "repo/fragments/diff" (list .Diff .DiffOpts $) }} +{{ end }} + {{ define "repoContent" }} {{ template "repo/pulls/fragments/pullHeader" . }} - {{ if .Pull.IsStacked }}
{{ template "repo/pulls/fragments/pullStack" . }} @@ -39,184 +83,339 @@ {{ end }} {{ end }} -{{ define "repoAfter" }} -
-
- {{ block "submissions" . }} {{ end }} +{{ define "diffLayout" }} + {{ $diff := index . 0 }} + {{ $opts := index . 1 }} + {{ $root := index . 2 }} + +
+ + + + +
+ {{ template "diffFiles" (list $diff $opts) }} +
+ + + {{ template "subsPanel" $ }} +
+{{ end }} + +{{ define "subsPanel" }} + {{ $root := index . 2 }} + {{ $pull := $root.Pull }} + + +
+
+ +
+
+ +

Review Panel

+ {{ template "subsPanelSummary" $ }} +
+
+ {{ template "submissions" $root }}
-
+ +
+{{ end }} + +{{ define "subsPanelSummary" }} + {{ $root := index . 2 }} + {{ $pull := $root.Pull }} + {{ $latest := $pull.LastRoundNumber }} +
+ {{ if $root.IsInterdiff }} + + viewing interdiff of + #{{ $root.ActiveRound }} + and + #{{ sub $root.ActiveRound 1 }} + + {{ else }} + + viewing round + #{{ $root.ActiveRound }} + + {{ if ne $root.ActiveRound $latest }} + (outdated) + + + view latest + + {{ end }} + {{ end }} + + {{ i "chevron-up" "size-4" }} + + +
+{{ end }} + +{{ define "subsCheckbox" }} + +{{ end }} + +{{ define "subsToggle" }} + + {{ end }} + {{ define "submissions" }} {{ $lastIdx := sub (len .Pull.Submissions) 1 }} - {{ $targetBranch := .Pull.TargetBranch }} - {{ $repoName := .RepoInfo.FullName }} - {{ range $idx, $item := .Pull.Submissions }} - {{ with $item }} -
- -
- -
- {{ i "hash" "w-4 h-4" }}{{ .RoundNumber }} -
- -
- - {{ $owner := resolve $.Pull.OwnerDid }} - {{ $re := "re" }} - {{ if eq .RoundNumber 0 }} - {{ $re = "" }} - {{ end }} - - by {{ template "user/fragments/picHandleLink" $.Pull.OwnerDid }} - - {{ template "repo/fragments/shortTime" .Created }} - - {{ $s := "s" }} - {{ if eq (len .Comments) 1 }} - {{ $s = "" }} - {{ end }} - {{ len .Comments }} comment{{$s}} - -
- - - {{ i "file-diff" "w-4 h-4" }} - - {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} - - {{ if ne $idx 0 }} - - {{ i "chevrons-left-right-ellipsis" "w-4 h-4 rotate-90" }} - - {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} - - {{ end }} - -
-
+ {{ range $ridx, $item := reverse .Pull.Submissions }} + {{ $idx := sub $lastIdx $ridx }} + {{ template "submission" (list $item $idx $lastIdx $) }} + {{ end }} +{{ end }} - {{ if .IsFormatPatch }} - {{ $patches := .AsFormatPatch }} - {{ $round := .RoundNumber }} -
- - {{ $s := "s" }} - {{ if eq (len $patches) 1 }} - {{ $s = "" }} - {{ end }} -
- {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $patches }} commit{{$s}} -
- -
- {{ range $patches }} -
-
- {{ i "git-commit-horizontal" "w-4 h-4" }} -
- - {{ $fullRepo := "" }} - {{ if and $.Pull.IsForkBased $.Pull.PullSource.Repo }} - {{ $fullRepo = printf "%s/%s" $owner $.Pull.PullSource.Repo.Name }} - {{ else if $.Pull.IsBranchBased }} - {{ $fullRepo = $.RepoInfo.FullName }} - {{ end }} - - - {{ if $fullRepo }} - {{ slice .SHA 0 8 }} - {{ else }} - {{ slice .SHA 0 8 }} - {{ end }} -
-
- {{ .Title | description }} - {{ if gt (len .Body) 0 }} - - {{ end }} -
-
- {{ if gt (len .Body) 0 }} - - {{ end }} -
- {{ end }} -
- {{ end }} - - -
- {{ range $cidx, $c := .Comments }} -
- {{ if gt $cidx 0 }} -
- {{ end }} -
- {{ template "user/fragments/picHandleLink" $c.OwnerDid }} - - {{ template "repo/fragments/time" $c.Created }} -
-
- {{ $c.Body | markdown }} -
-
- {{ end }} +{{ define "submission" }} + {{ $item := index . 0 }} + {{ $idx := index . 1 }} + {{ $lastIdx := index . 2 }} + {{ $root := index . 3 }} +
+ {{ template "submissionHeader" $ }} + {{ template "submissionComments" $ }} + + {{ if eq $lastIdx $item.RoundNumber }} + {{ block "mergeStatus" $root }} {{ end }} + {{ block "resubmitStatus" $root }} {{ end }} + {{ end }} - {{ block "pipelineStatus" (list $ .) }} {{ end }} + {{ if $root.LoggedInUser }} + {{ template "repo/pulls/fragments/pullActions" + (dict + "LoggedInUser" $root.LoggedInUser + "Pull" $root.Pull + "RepoInfo" $root.RepoInfo + "RoundNumber" $item.RoundNumber + "MergeCheck" $root.MergeCheck + "ResubmitCheck" $root.ResubmitCheck + "BranchDeleteStatus" $root.BranchDeleteStatus + "Stack" $root.Stack) }} + {{ else }} + {{ template "loginPrompt" $ }} + {{ end }} +
+{{ end }} - {{ if eq $lastIdx .RoundNumber }} - {{ block "mergeStatus" $ }} {{ end }} - {{ block "resubmitStatus" $ }} {{ end }} +{{ define "submissionHeader" }} + {{ $item := index . 0 }} + {{ $lastIdx := index . 2 }} + {{ $root := index . 3 }} + {{ $round := $item.RoundNumber }} +
+ +
+ +
+ +
+ {{ template "submissionInfo" $ }} + {{ template "submissionCommits" $ }} + {{ template "submissionPipeline" $ }} + {{ if eq $lastIdx $round }} + {{ block "mergeCheck" $root }} {{ end }} + {{ end }} +
+
+{{ end }} + +{{ define "submissionInfo" }} + {{ $item := index . 0 }} + {{ $idx := index . 1 }} + {{ $root := index . 3 }} + {{ $round := $item.RoundNumber }} +
+ + {{ resolve $root.Pull.OwnerDid }} submitted v{{ $round }} + + + {{ template "repo/fragments/shortTimeAgo" $item.Created }} + + +
+ {{ if ne $root.ActiveRound $round }} + + {{ i "diff" "w-4 h-4" }} + diff + + {{ end }} + {{ if ne $idx 0 }} + + {{ i "chevrons-left-right-ellipsis" "w-4 h-4 rotate-90" }} + interdiff + + {{ end }} +
+
+{{ end }} + +{{ define "submissionCommits" }} + {{ $item := index . 0 }} + {{ $root := index . 3 }} + {{ $round := $item.RoundNumber }} + {{ $patches := $item.AsFormatPatch }} + {{ if $patches }} +
+ + {{ i "git-commit-horizontal" "w-4 h-4" }} + {{ len $patches }} commit{{ if ne (len $patches) 1 }}s{{ end }} +
+ expand + +
+
+ {{ range $patches }} + {{ template "submissionCommit" (list . $item $root) }} + {{ end }} +
+ {{ end }} +{{ end }} + +{{ define "submissionCommit" }} + {{ $patch := index . 0 }} + {{ $item := index . 1 }} + {{ $root := index . 2 }} + {{ $round := $item.RoundNumber }} + {{ with $patch }} +
+
+
+ + {{ $fullRepo := "" }} + {{ if and $root.Pull.IsForkBased $root.Pull.PullSource.Repo }} + {{ $fullRepo = printf "%s/%s" $root.Pull.OwnerDid $root.Pull.PullSource.Repo.Name }} + {{ else if $root.Pull.IsBranchBased }} + {{ $fullRepo = $root.RepoInfo.FullName }} {{ end }} - {{ if $.LoggedInUser }} - {{ template "repo/pulls/fragments/pullActions" - (dict - "LoggedInUser" $.LoggedInUser - "Pull" $.Pull - "RepoInfo" $.RepoInfo - "RoundNumber" .RoundNumber - "MergeCheck" $.MergeCheck - "ResubmitCheck" $.ResubmitCheck - "BranchDeleteStatus" $.BranchDeleteStatus - "Stack" $.Stack) }} + + {{ if $fullRepo }} + {{ slice .SHA 0 8 }} {{ else }} -
- - sign up - - or - login - to add to the discussion -
+ {{ slice .SHA 0 8 }} + {{ end }} +
+ +
+ {{ .Title | description }} + {{ if gt (len .Body) 0 }} + + {{ end }} + {{ if gt (len .Body) 0 }} + {{ end }}
+
+
+ {{ end }} +{{ end }} + +{{ define "mergeCheck" }} + {{ $isOpen := .Pull.State.IsOpen }} + {{ if and $isOpen .MergeCheck .MergeCheck.Error }} +
+ {{ i "triangle-alert" "w-4 h-4 text-red-600 dark:text-red-500" }} + {{ .MergeCheck.Error }} +
+ {{ else if and $isOpen .MergeCheck .MergeCheck.IsConflicted }} +
+ +
+ {{ i "triangle-alert" "text-red-600 dark:text-red-500 w-4 h-4" }} + merge conflicts detected +
+ expand + +
+
+
+ {{ if gt (len .MergeCheck.Conflicts) 0 }} +
    + {{ range .MergeCheck.Conflicts }} + {{ if .Filename }} +
  • + {{ i "file-warning" "inline-flex w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 flex-shrink-0" }} + {{ .Filename }} +
  • + {{ else if .Reason }} +
  • + {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 " }} + {{.Reason}} +
  • + {{ end }} + {{ end }} +
+ {{ end }}
- {{ end }} + {{ else if and $isOpen .MergeCheck }} +
+ {{ i "check" "w-4 h-4 text-green-600 dark:text-green-500" }} + no conflicts, ready to merge +
{{ end }} {{ end }} {{ define "mergeStatus" }} {{ if .Pull.State.IsClosed }} -
+
{{ i "ban" "w-4 h-4" }} closed without merging
{{ else if .Pull.State.IsMerged }} -
+
{{ i "git-merge" "w-4 h-4" }} pull request successfully merged
{{ else if .Pull.State.IsDeleted }} -
+
{{ i "git-pull-request-closed" "w-4 h-4" }} This pull has been deleted (possibly by jj abandon or jj squash)
- {{ else if and .MergeCheck .MergeCheck.Error }} -
-
- {{ i "triangle-alert" "w-4 h-4" }} - {{ .MergeCheck.Error }} -
-
- {{ else if and .MergeCheck .MergeCheck.IsConflicted }} -
-
-
- {{ i "triangle-alert" "w-4 h-4" }} - merge conflicts detected -
- {{ if gt (len .MergeCheck.Conflicts) 0 }} -
    - {{ range .MergeCheck.Conflicts }} - {{ if .Filename }} -
  • - {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-500 dark:text-red-300" }} - {{ .Filename }} -
  • - {{ else if .Reason }} -
  • - {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-500 dark:text-red-300" }} - {{.Reason}} -
  • - {{ end }} - {{ end }} -
- {{ end }} -
-
- {{ else if .MergeCheck }} -
-
- {{ i "circle-check-big" "w-4 h-4" }} - no conflicts, ready to merge -
-
{{ end }} {{ end }} {{ define "resubmitStatus" }} {{ if .ResubmitCheck.Yes }} -
+
{{ i "triangle-alert" "w-4 h-4" }} this branch has been updated, consider resubmitting @@ -292,37 +451,94 @@ {{ end }} {{ end }} -{{ define "pipelineStatus" }} - {{ $root := index . 0 }} - {{ $submission := index . 1 }} - {{ $pipeline := index $root.Pipelines $submission.SourceRev }} +{{ define "submissionPipeline" }} + {{ $item := index . 0 }} + {{ $root := index . 3 }} + {{ $pipeline := index $root.Pipelines $item.SourceRev }} {{ with $pipeline }} {{ $id := .Id }} {{ if .Statuses }} -
{{ end }} {{ end }} {{ end }} + +{{ define "submissionComments" }} + {{ $item := index . 0 }} +
+ {{ range $item.Comments }} + {{ template "submissionComment" . }} + {{ end }} +
+{{ end }} + +{{ define "submissionComment" }} +
+ +
+ +
+ +
+ + + +
+ {{ .Body | markdown }} +
+
+
+{{ end }} + +{{ define "loginPrompt" }} +
+ + sign up + + or + login + to add to the discussion +
+{{ end }}