diff --git a/appview/pages/pages.go b/appview/pages/pages.go --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -1241,7 +1241,7 @@ Active string FilterState string FilterQuery string - Stacks map[string]models.Stack + Stacks []models.Stack Pipelines map[string]models.Pipeline LabelDefs map[string]*models.LabelDefinition Page pagination.Page @@ -1277,7 +1277,6 @@ Active string Pull *models.Pull Stack models.Stack - AbandonedPulls []*models.Pull Backlinks []models.RichReferenceLink BranchDeleteStatus *models.BranchDeleteStatus MergeCheck types.MergeCheckResponse diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -108,7 +108,7 @@ {{ define "repoContent" }} {{ template "repo/pulls/fragments/pullHeader" . }} - {{ if .Pull.IsStacked }} + {{ if (gt (len .Stack) 1) }}
{{ template "repo/pulls/fragments/pullStack" . }}
@@ -164,7 +164,7 @@ {{ $bgColor = "bg-green-600 dark:bg-green-700" }} {{ else if $pull.State.IsMerged }} {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} - {{ else if $pull.State.IsDeleted }} + {{ else if $pull.State.IsAbandoned }} {{ $bgColor = "bg-red-600 dark:bg-red-700" }} {{ end }} @@ -503,7 +503,7 @@ > - {{ else if .Pull.State.IsDeleted }} + {{ else if .Pull.State.IsAbandoned }}
{{ i "git-pull-request-closed" "w-4 h-4" }} diff --git a/appview/pages/templates/repo/pulls/pulls.html b/appview/pages/templates/repo/pulls/pulls.html --- a/appview/pages/templates/repo/pulls/pulls.html +++ b/appview/pages/templates/repo/pulls/pulls.html @@ -69,62 +69,45 @@ {{ define "repoAfter" }}
- {{ range .Pulls }} + {{ range $stack := .Stacks }} + {{ $topPR := index $stack 0 }}
- {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} - {{ $icon := "ban" }} - - {{ if .State.IsOpen }} - {{ $bgColor = "bg-green-600 dark:bg-green-700" }} - {{ $icon = "git-pull-request" }} - {{ else if .State.IsMerged }} - {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} - {{ $icon = "git-merge" }} - {{ end }} - - - - {{ i $icon "w-3 h-3 mr-1.5 text-white" }} - {{ .State.String }} - - + {{ template "repo/pulls/fragments/pullState" $topPR.State }} - {{ template "user/fragments/picHandleLink" .OwnerDid }} + {{ template "user/fragments/picHandleLink" $topPR.OwnerDid }} - {{ template "repo/fragments/time" .Created }} + {{ template "repo/fragments/time" $topPR.Created }} - {{ $commentCount := .TotalComments }} + {{ $commentCount := $topPR.TotalComments }} {{ $commentCount }} comment{{ if ne $commentCount 1 }}s{{ end }} round - #{{ .LastRoundNumber }} + #{{ $topPR.LastRoundNumber }} - {{ $pipeline := index $.Pipelines .LatestSha }} + {{ $pipeline := index $.Pipelines $topPR.LatestSha }} {{ if and $pipeline $pipeline.Id }} {{ template "repo/pipelines/fragments/pipelineSymbol" (dict "Pipeline" $pipeline "ShortSummary" true) }} {{ end }} - {{ $state := .Labels }} + {{ $state := $topPR.Labels }} {{ range $k, $d := $.LabelDefs }} {{ range $v, $s := $state.GetValSet $d.AtUri.String }} {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true) }} @@ -132,25 +115,22 @@ {{ end }}
- {{ if .StackId }} - {{ $otherPulls := index $.Stacks .StackId }} - {{ if gt (len $otherPulls) 0 }} -
- - {{ $s := "s" }} - {{ if eq (len $otherPulls) 1 }} - {{ $s = "" }} - {{ end }} -
- {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $otherPulls }} pull{{$s}} in this stack -
- -
- {{ block "stackedPullList" (list $otherPulls $) }} {{ end }} -
- {{ end }} + {{ if gt (len $stack) 1 }} +
+ + + + {{ i "chevrons-up-down" "size-3" }} + + + {{ $rest := sub (len $stack) 1 }} + expand {{ $rest }} pull{{if ne $rest 1 }}s{{end}} in this stack + + + {{ template "stackedPullList" (list (slice $stack 1) $) }} +
{{ end }}
{{ end }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullActions.html b/appview/pages/templates/repo/pulls/fragments/pullActions.html --- a/appview/pages/templates/repo/pulls/fragments/pullActions.html +++ b/appview/pages/templates/repo/pulls/fragments/pullActions.html @@ -6,7 +6,7 @@ {{ $totalPulls := sub 0 1 }} {{ $below := sub 0 1 }} {{ $stackCount := "" }} - {{ if .Pull.IsStacked }} + {{ if (gt (len .Stack) 1) }} {{ $totalPulls = len $stack }} {{ $below = $stack.Below .Pull }} {{ $mergeable := len $below.Mergeable }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullHeader.html b/appview/pages/templates/repo/pulls/fragments/pullHeader.html --- a/appview/pages/templates/repo/pulls/fragments/pullHeader.html +++ b/appview/pages/templates/repo/pulls/fragments/pullHeader.html @@ -6,25 +6,9 @@ -{{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} -{{ $icon := "ban" }} - -{{ if .Pull.State.IsOpen }} - {{ $bgColor = "bg-green-600 dark:bg-green-700" }} - {{ $icon = "git-pull-request" }} -{{ else if .Pull.State.IsMerged }} - {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} - {{ $icon = "git-merge" }} -{{ end }} -
- - {{ i $icon "w-3 h-3 mr-1.5 text-white" }} - {{ .Pull.State.String }} - + {{ template "repo/pulls/fragments/pullState" .Pull.State }} opened by {{ template "user/fragments/picHandleLink" .Pull.OwnerDid }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullStack.html b/appview/pages/templates/repo/pulls/fragments/pullStack.html --- a/appview/pages/templates/repo/pulls/fragments/pullStack.html +++ b/appview/pages/templates/repo/pulls/fragments/pullStack.html @@ -14,24 +14,6 @@ {{ block "pullList" (list .Stack $) }} {{ end }} - - {{ if gt (len .AbandonedPulls) 0 }} -
- - - - {{ i "chevrons-up-down" "w-4 h-4" }} - - - ABANDONED PULLS - {{ len .AbandonedPulls }} - - - {{ block "pullList" (list .AbandonedPulls $) }} {{ end }} -
- {{ end }} {{ end }} {{ define "pullList" }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullState.html b/appview/pages/templates/repo/pulls/fragments/pullState.html new file mode 100644 --- /dev/null +++ b/appview/pages/templates/repo/pulls/fragments/pullState.html @@ -0,0 +1,22 @@ +{{ define "repo/pulls/fragments/pullState" }} + {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} + {{ $icon := "ban" }} + + {{ if .IsOpen }} + {{ $bgColor = "bg-green-600 dark:bg-green-700" }} + {{ $icon = "git-pull-request" }} + {{ else if .IsMerged }} + {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} + {{ $icon = "git-merge" }} + {{ else if .IsAbandoned }} + {{ $bgColor = "bg-red-600 dark:bg-red-700" }} + {{ $icon = "git-pull-request-closed" }} + {{ end }} + + + {{ i $icon "w-3 h-3 mr-1.5 text-white" }} + {{ .String }} + +{{ end }} + + diff --git a/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html b/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html --- a/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html +++ b/appview/pages/templates/repo/pulls/fragments/summarizedPullState.html @@ -8,7 +8,7 @@ {{ else if .IsMerged }} {{ $fgColor = "text-purple-600 dark:text-purple-500" }} {{ $icon = "git-merge" }} - {{ else if .IsDeleted }} + {{ else if .IsAbandoned }} {{ $fgColor = "text-red-600 dark:text-red-500" }} {{ $icon = "git-pull-request-closed" }} {{ end }}