Monorepo for Tangled
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

appview/pages: update templates to match new pull model

Signed-off-by: oppiliappan <me@oppi.li>

+57 -90
+1 -2
appview/pages/pages.go
··· 1241 1241 Active string 1242 1242 FilterState string 1243 1243 FilterQuery string 1244 - Stacks map[string]models.Stack 1244 + Stacks []models.Stack 1245 1245 Pipelines map[string]models.Pipeline 1246 1246 LabelDefs map[string]*models.LabelDefinition 1247 1247 Page pagination.Page ··· 1277 1277 Active string 1278 1278 Pull *models.Pull 1279 1279 Stack models.Stack 1280 - AbandonedPulls []*models.Pull 1281 1280 Backlinks []models.RichReferenceLink 1282 1281 BranchDeleteStatus *models.BranchDeleteStatus 1283 1282 MergeCheck types.MergeCheckResponse
+1 -1
appview/pages/templates/repo/pulls/fragments/pullActions.html
··· 6 6 {{ $totalPulls := sub 0 1 }} 7 7 {{ $below := sub 0 1 }} 8 8 {{ $stackCount := "" }} 9 - {{ if .Pull.IsStacked }} 9 + {{ if (gt (len .Stack) 1) }} 10 10 {{ $totalPulls = len $stack }} 11 11 {{ $below = $stack.Below .Pull }} 12 12 {{ $mergeable := len $below.Mergeable }}
+1 -17
appview/pages/templates/repo/pulls/fragments/pullHeader.html
··· 6 6 </h1> 7 7 </header> 8 8 9 - {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} 10 - {{ $icon := "ban" }} 11 - 12 - {{ if .Pull.State.IsOpen }} 13 - {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 14 - {{ $icon = "git-pull-request" }} 15 - {{ else if .Pull.State.IsMerged }} 16 - {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 17 - {{ $icon = "git-merge" }} 18 - {{ end }} 19 - 20 9 <section> 21 10 <div class="flex items-center gap-2"> 22 - <span 23 - class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm" 24 - > 25 - {{ i $icon "w-3 h-3 mr-1.5 text-white" }} 26 - <span class="text-white">{{ .Pull.State.String }}</span> 27 - </span> 11 + {{ template "repo/pulls/fragments/pullState" .Pull.State }} 28 12 <span class="text-gray-500 dark:text-gray-400 text-sm flex flex-wrap items-center gap-1"> 29 13 opened by 30 14 {{ template "user/fragments/picHandleLink" .Pull.OwnerDid }}
-18
appview/pages/templates/repo/pulls/fragments/pullStack.html
··· 14 14 </summary> 15 15 {{ block "pullList" (list .Stack $) }} {{ end }} 16 16 </details> 17 - 18 - {{ if gt (len .AbandonedPulls) 0 }} 19 - <details class="mt-4 bg-white dark:bg-gray-800 group" open> 20 - <summary class="p-2 text-sm font-bold list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> 21 - <span class="flex items-center gap-2"> 22 - <span class="group-open:hidden"> 23 - {{ i "chevrons-up-down" "w-4 h-4" }} 24 - </span> 25 - <span class="hidden group-open:flex"> 26 - {{ i "chevrons-down-up" "w-4 h-4" }} 27 - </span> 28 - ABANDONED PULLS 29 - <span class="bg-gray-200 dark:bg-gray-700 rounded py-1/2 px-1 text-sm ml-1">{{ len .AbandonedPulls }}</span> 30 - </span> 31 - </summary> 32 - {{ block "pullList" (list .AbandonedPulls $) }} {{ end }} 33 - </details> 34 - {{ end }} 35 17 {{ end }} 36 18 37 19 {{ define "pullList" }}
+22
appview/pages/templates/repo/pulls/fragments/pullState.html
··· 1 + {{ define "repo/pulls/fragments/pullState" }} 2 + {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} 3 + {{ $icon := "ban" }} 4 + 5 + {{ if .IsOpen }} 6 + {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 7 + {{ $icon = "git-pull-request" }} 8 + {{ else if .IsMerged }} 9 + {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 10 + {{ $icon = "git-merge" }} 11 + {{ else if .IsAbandoned }} 12 + {{ $bgColor = "bg-red-600 dark:bg-red-700" }} 13 + {{ $icon = "git-pull-request-closed" }} 14 + {{ end }} 15 + 16 + <span class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm"> 17 + {{ i $icon "w-3 h-3 mr-1.5 text-white" }} 18 + <span class="text-white">{{ .String }}</span> 19 + </span> 20 + {{ end }} 21 + 22 +
+1 -1
appview/pages/templates/repo/pulls/fragments/summarizedPullState.html
··· 8 8 {{ else if .IsMerged }} 9 9 {{ $fgColor = "text-purple-600 dark:text-purple-500" }} 10 10 {{ $icon = "git-merge" }} 11 - {{ else if .IsDeleted }} 11 + {{ else if .IsAbandoned }} 12 12 {{ $fgColor = "text-red-600 dark:text-red-500" }} 13 13 {{ $icon = "git-pull-request-closed" }} 14 14 {{ end }}
+3 -3
appview/pages/templates/repo/pulls/pull.html
··· 108 108 109 109 {{ define "repoContent" }} 110 110 {{ template "repo/pulls/fragments/pullHeader" . }} 111 - {{ if .Pull.IsStacked }} 111 + {{ if (gt (len .Stack) 1) }} 112 112 <div class="mt-8"> 113 113 {{ template "repo/pulls/fragments/pullStack" . }} 114 114 </div> ··· 164 164 {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 165 165 {{ else if $pull.State.IsMerged }} 166 166 {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 167 - {{ else if $pull.State.IsDeleted }} 167 + {{ else if $pull.State.IsAbandoned }} 168 168 {{ $bgColor = "bg-red-600 dark:bg-red-700" }} 169 169 {{ end }} 170 170 ··· 503 503 > 504 504 </div> 505 505 </div> 506 - {{ else if .Pull.State.IsDeleted }} 506 + {{ else if .Pull.State.IsAbandoned }} 507 507 <div class="bg-red-50 dark:bg-red-900 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative"> 508 508 <div class="flex items-center gap-2 text-red-500 dark:text-red-300"> 509 509 {{ i "git-pull-request-closed" "w-4 h-4" }}
+28 -48
appview/pages/templates/repo/pulls/pulls.html
··· 69 69 70 70 {{ define "repoAfter" }} 71 71 <div class="flex flex-col gap-2 mt-2"> 72 - {{ range .Pulls }} 72 + {{ range $stack := .Stacks }} 73 + {{ $topPR := index $stack 0 }} 73 74 <div class="rounded bg-white dark:bg-gray-800"> 74 75 <div class="px-6 py-4 z-5"> 75 76 <div class="pb-2"> 76 - <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ .PullId }}" class="dark:text-white"> 77 - {{ .Title | description }} 78 - <span class="text-gray-500 dark:text-gray-400">#{{ .PullId }}</span> 77 + <a href="/{{ $.RepoInfo.FullName }}/pulls/{{ $topPR.PullId }}" class="dark:text-white"> 78 + {{ $topPR.Title | description }} 79 + <span class="text-gray-500 dark:text-gray-400">#{{ $topPR.PullId }}</span> 79 80 </a> 80 81 </div> 81 82 <div class="text-sm text-gray-500 dark:text-gray-400 flex flex-wrap items-center gap-1"> 82 - {{ $bgColor := "bg-gray-800 dark:bg-gray-700" }} 83 - {{ $icon := "ban" }} 84 - 85 - {{ if .State.IsOpen }} 86 - {{ $bgColor = "bg-green-600 dark:bg-green-700" }} 87 - {{ $icon = "git-pull-request" }} 88 - {{ else if .State.IsMerged }} 89 - {{ $bgColor = "bg-purple-600 dark:bg-purple-700" }} 90 - {{ $icon = "git-merge" }} 91 - {{ end }} 92 - 93 - 94 - <span 95 - class="inline-flex items-center rounded px-2 py-[5px] {{ $bgColor }} text-sm" 96 - > 97 - {{ i $icon "w-3 h-3 mr-1.5 text-white" }} 98 - <span class="text-white">{{ .State.String }}</span> 99 - </span> 100 - 83 + {{ template "repo/pulls/fragments/pullState" $topPR.State }} 101 84 <span class="ml-1"> 102 - {{ template "user/fragments/picHandleLink" .OwnerDid }} 85 + {{ template "user/fragments/picHandleLink" $topPR.OwnerDid }} 103 86 </span> 104 87 105 88 <span class="before:content-['·']"> 106 - {{ template "repo/fragments/time" .Created }} 89 + {{ template "repo/fragments/time" $topPR.Created }} 107 90 </span> 108 91 109 92 <span class="before:content-['·']"> 110 - {{ $commentCount := .TotalComments }} 93 + {{ $commentCount := $topPR.TotalComments }} 111 94 {{ $commentCount }} comment{{ if ne $commentCount 1 }}s{{ end }} 112 95 </span> 113 96 114 97 <span class="before:content-['·']"> 115 98 round 116 99 <span class="font-mono"> 117 - #{{ .LastRoundNumber }} 100 + #{{ $topPR.LastRoundNumber }} 118 101 </span> 119 102 </span> 120 103 121 - {{ $pipeline := index $.Pipelines .LatestSha }} 104 + {{ $pipeline := index $.Pipelines $topPR.LatestSha }} 122 105 {{ if and $pipeline $pipeline.Id }} 123 106 <span class="before:content-['·']"></span> 124 107 {{ template "repo/pipelines/fragments/pipelineSymbol" (dict "Pipeline" $pipeline "ShortSummary" true) }} 125 108 {{ end }} 126 109 127 - {{ $state := .Labels }} 110 + {{ $state := $topPR.Labels }} 128 111 {{ range $k, $d := $.LabelDefs }} 129 112 {{ range $v, $s := $state.GetValSet $d.AtUri.String }} 130 113 {{ template "labels/fragments/label" (dict "def" $d "val" $v "withPrefix" true) }} ··· 132 115 {{ end }} 133 116 </div> 134 117 </div> 135 - {{ if .StackId }} 136 - {{ $otherPulls := index $.Stacks .StackId }} 137 - {{ if gt (len $otherPulls) 0 }} 138 - <details class="bg-white dark:bg-gray-800 group"> 139 - <summary class="pb-4 px-6 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> 140 - {{ $s := "s" }} 141 - {{ if eq (len $otherPulls) 1 }} 142 - {{ $s = "" }} 143 - {{ end }} 144 - <div class="group-open:hidden flex items-center gap-2"> 145 - {{ i "chevrons-up-down" "w-4 h-4" }} expand {{ len $otherPulls }} pull{{$s}} in this stack 146 - </div> 147 - <div class="hidden group-open:flex items-center gap-2"> 148 - {{ i "chevrons-down-up" "w-4 h-4" }} hide {{ len $otherPulls }} pull{{$s}} in this stack 149 - </div> 150 - </summary> 151 - {{ block "stackedPullList" (list $otherPulls $) }} {{ end }} 152 - </details> 153 - {{ end }} 118 + {{ if gt (len $stack) 1 }} 119 + <details class="group"> 120 + <summary class="px-6 pb-4 text-xs list-none cursor-pointer hover:text-gray-500 hover:dark:text-gray-400"> 121 + <span class="flex items-center gap-2"> 122 + <span class="group-open:hidden"> 123 + {{ i "chevrons-up-down" "size-3" }} 124 + </span> 125 + <span class="hidden group-open:flex"> 126 + {{ i "chevrons-down-up" "size-3" }} 127 + </span> 128 + {{ $rest := sub (len $stack) 1 }} 129 + expand {{ $rest }} pull{{if ne $rest 1 }}s{{end}} in this stack 130 + </span> 131 + </summary> 132 + {{ template "stackedPullList" (list (slice $stack 1) $) }} 133 + </details> 154 134 {{ end }} 155 135 </div> 156 136 {{ end }}