Monorepo for Tangled

appview/pulls: directly pass diff and diff opts into main PR page

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

authored by oppi.li and committed by tangled.org f2f6c80b 6a123c31

+16 -5
+2
appview/pages/pages.go
··· 1110 1110 MergeCheck types.MergeCheckResponse 1111 1111 ResubmitCheck ResubmitResult 1112 1112 Pipelines map[string]models.Pipeline 1113 + Diff *types.NiceDiff 1114 + DiffOpts types.DiffOpts 1113 1115 1114 1116 OrderedReactionKinds []models.ReactionKind 1115 1117 Reactions map[models.ReactionKind]models.ReactionDisplayData
+1 -1
appview/pages/templates/layouts/repobase.html
··· 1 1 {{ define "title" }}{{ .RepoInfo.FullName }}{{ end }} 2 2 3 3 {{ define "content" }} 4 - <section id="repo-header" class="mb-4 p-2 dark:text-white"> 4 + <section id="repo-header" class="mb-2 py-2 px-4 dark:text-white"> 5 5 <div class="text-lg flex flex-col sm:flex-row items-start gap-4 justify-between"> 6 6 <!-- left items --> 7 7 <div class="flex flex-col gap-2">
+11 -2
appview/pulls/pulls.go
··· 236 236 defs[l.AtUri().String()] = &l 237 237 } 238 238 239 - s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 239 + patch := pull.LatestSubmission().CombinedPatch() 240 + diff := patchutil.AsNiceDiff(patch, pull.TargetBranch) 241 + var diffOpts types.DiffOpts 242 + if d := r.URL.Query().Get("diff"); d == "split" { 243 + diffOpts.Split = true 244 + } 245 + 246 + log.Println(s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{ 240 247 LoggedInUser: user, 241 248 RepoInfo: s.repoResolver.GetRepoInfo(r, user), 242 249 Pull: pull, ··· 247 254 MergeCheck: mergeCheckResponse, 248 255 ResubmitCheck: resubmitResult, 249 256 Pipelines: m, 257 + Diff: &diff, 258 + DiffOpts: diffOpts, 250 259 251 260 OrderedReactionKinds: models.OrderedReactionKinds, 252 261 Reactions: reactionMap, 253 262 UserReacted: userReactions, 254 263 255 264 LabelDefs: defs, 256 - }) 265 + })) 257 266 } 258 267 259 268 func (s *Pulls) mergeCheck(r *http.Request, f *models.Repo, pull *models.Pull, stack models.Stack) types.MergeCheckResponse {
+2 -2
spindle/models/models.go
··· 53 53 StatusKindRunning, 54 54 } 55 55 FinishStates [4]StatusKind = [4]StatusKind{ 56 - StatusKindCancelled, 57 56 StatusKindFailed, 58 - StatusKindSuccess, 59 57 StatusKindTimeout, 58 + StatusKindCancelled, 59 + StatusKindSuccess, 60 60 } 61 61 ) 62 62