tangled
alpha
login
or
join now
tjh.dev
/
test
forked from
tangled.org/core
0
fork
atom
Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork
atom
overview
issues
pulls
pipelines
move actions closer to the submission round
oppi.li
1 year ago
440223a4
f75a36ba
+111
-25
2 changed files
expand all
collapse all
unified
split
appview
pages
templates
repo
pulls
pull.html
state
pull.go
+109
-25
appview/pages/templates/repo/pulls/pull.html
reviewed
···
66
66
</div>
67
67
</section>
68
68
69
69
-
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
70
70
-
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
71
71
-
72
72
-
{{ if and $isPullAuthor (not .Pull.State.IsMerged) }}
73
73
-
<section id="update-card" class="mt-8 space-y-4 relative">
74
74
-
{{ block "resubmitCard" . }} {{ end }}
75
75
-
</section>
76
76
-
{{ end }}
77
77
-
78
78
-
<section id="merge-card" class="mt-8 space-y-4 relative">
79
79
-
{{ if .Pull.State.IsMerged }}
80
80
-
{{ block "alreadyMergedCard" . }} {{ end }}
81
81
-
{{ else if .MergeCheck }}
82
82
-
{{ if .MergeCheck.IsConflicted }}
83
83
-
{{ block "isConflictedCard" $ }} {{ end }}
84
84
-
{{ else }}
85
85
-
{{ block "noConflictsCard" $ }} {{ end }}
86
86
-
{{ end }}
87
87
-
{{ end }}
88
88
-
</section>
89
89
-
90
69
<div id="pull-close"></div>
91
70
<div id="pull-reopen"></div>
92
71
{{ end }}
···
79
100
{{ with $item }}
80
101
{{ $oneIndexedRound := add .RoundNumber 1 }}
81
102
<details {{ if eq $idx $lastIdx }}open{{ end }}>
82
82
-
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer text-sm">
103
103
+
<summary id="round-#{{ $oneIndexedRound }}" class="list-none cursor-pointer">
83
104
<div class="flex gap-2 items-center">
84
105
<div class="rounded bg-white drop-shadow-sm p-3">
85
106
#{{ $oneIndexedRound }}
···
89
110
{{ $owner := index $.DidHandleMap $.Pull.OwnerDid }}
90
111
submitted by <a href="/{{ $owner }}">{{ $owner }}</a>
91
112
<span class="select-none before:content-['\00B7']"></span>
92
92
-
<a href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a>
113
113
+
<a class="text-gray-500 hover:text-gray-500" href="#round-#{{ $oneIndexedRound }}"><time>{{ .Created | timeFmt }}</time></a>
93
114
<span class="select-none before:content-['·']"></span>
94
115
{{ $s := "s" }}
95
116
{{ if eq (len .Comments) 1 }}
···
117
138
</div>
118
139
</div>
119
140
{{ end }}
120
120
-
{{ block "newComment" (list $ .ID) }} {{ end }}
141
141
+
142
142
+
{{ block "mergeStatus" $ }} {{ end }}
143
143
+
144
144
+
{{ if $.LoggedInUser }}
145
145
+
{{ block "actions" (list $ .ID) }} {{ end }}
146
146
+
{{ else }}
147
147
+
<div class="bg-white rounded drop-shadow-sm px-6 py-4 w-fit">
148
148
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
149
149
+
<a href="/login" class="underline">login</a> to join the discussion
150
150
+
</div>
151
151
+
{{ end }}
121
152
</div>
122
153
</details>
123
123
-
<hr />
124
154
{{ end }}
155
155
+
{{ end }}
156
156
+
{{ end }}
157
157
+
158
158
+
{{ define "mergeStatus" }}
159
159
+
{{ if .Pull.State.IsMerged }}
160
160
+
<div class="bg-purple-50 border border-purple-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
161
161
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
162
162
+
<div class="flex items-center gap-2 text-purple-500">
163
163
+
<i data-lucide="git-merge" class="w-4 h-4"></i>
164
164
+
<span class="font-medium">pull request successfully merged</span
165
165
+
>
166
166
+
</div>
167
167
+
</div>
168
168
+
{{ else if and .MergeCheck .MergeCheck.IsConflicted }}
169
169
+
<div class="bg-red-50 border border-red-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
170
170
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
171
171
+
<div class="flex items-center gap-2 text-red-500">
172
172
+
<i data-lucide="alert-triangle" class="w-4 h-4"></i>
173
173
+
<span class="font-medium">merge conflicts detected</span>
174
174
+
<ul class="text-sm space-y-1">
175
175
+
{{ range .MergeCheck.Conflicts }}
176
176
+
{{ if .Filename }}
177
177
+
<li class="flex items-center">
178
178
+
<i
179
179
+
data-lucide="file-warning"
180
180
+
class="w-3 h-3 mr-1.5 text-red-500"
181
181
+
></i>
182
182
+
<span class="font-mono">{{ slice .Filename 0 (sub (len .Filename) 2) }}</span>
183
183
+
</li>
184
184
+
{{ end }}
185
185
+
{{ end }}
186
186
+
</ul>
187
187
+
</div>
188
188
+
</div>
189
189
+
{{ else if .MergeCheck }}
190
190
+
<div class="bg-green-50 border border-green-500 rounded drop-shadow-sm px-6 py-2 relative w-fit">
191
191
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
192
192
+
<div class="flex items-center gap-2 text-green-500">
193
193
+
<i data-lucide="check-circle" class="w-4 h-4"></i>
194
194
+
<span class="font-medium">no conflicts, ready to merge</span>
195
195
+
</div>
196
196
+
</div>
197
197
+
{{ end }}
198
198
+
{{ end }}
199
199
+
200
200
+
{{ define "actions" }}
201
201
+
{{ $rootObj := index . 0 }}
202
202
+
{{ $submissionId := index . 1 }}
203
203
+
204
204
+
{{ with $rootObj }}
205
205
+
{{ $isPushAllowed := .RepoInfo.Roles.IsPushAllowed }}
206
206
+
{{ $isMerged := .Pull.State.IsMerged }}
207
207
+
{{ $isClosed := .Pull.State.IsClosed }}
208
208
+
{{ $isOpen := .Pull.State.IsOpen }}
209
209
+
{{ $isConflicted := and .MergeCheck .MergeCheck.IsConflicted }}
210
210
+
{{ $isPullAuthor := and .LoggedInUser (eq .LoggedInUser.Did .Pull.OwnerDid) }}
211
211
+
<div class="relative w-fit">
212
212
+
<div class="absolute left-8 -top-2 w-px h-2 bg-gray-300"></div>
213
213
+
<div class="flex flex-wrap gap-2">
214
214
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
215
215
+
<i data-lucide="message-square-plus" class="w-4 h-4"></i>
216
216
+
<span>comment</span>
217
217
+
</button>
218
218
+
{{ if and $isPushAllowed $isOpen }}
219
219
+
{{ $disabled := "" }}
220
220
+
{{ if $isConflicted }}
221
221
+
{{ $disabled = "disabled" }}
222
222
+
{{ end }}
223
223
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline" {{ $disabled }}>
224
224
+
<i data-lucide="git-merge" class="w-4 h-4"></i>
225
225
+
<span>merge</span>
226
226
+
</button>
227
227
+
{{ end }}
228
228
+
229
229
+
{{ if and $isPullAuthor $isOpen }}
230
230
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
231
231
+
<i data-lucide="rotate-ccw" class="w-4 h-4"></i>
232
232
+
<span>resubmit</span>
233
233
+
</button>
234
234
+
{{ end }}
235
235
+
236
236
+
{{ if and $isPullAuthor $isPushAllowed $isOpen }}
237
237
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
238
238
+
<i data-lucide="ban" class="w-4 h-4"></i>
239
239
+
<span>close</span>
240
240
+
</button>
241
241
+
{{ end }}
242
242
+
243
243
+
{{ if and $isPullAuthor $isPushAllowed $isClosed }}
244
244
+
<button href="#" class="btn p-2 flex items-center gap-2 no-underline hover:no-underline">
245
245
+
<i data-lucide="circle-dot" class="w-4 h-4"></i>
246
246
+
<span>reopen</span>
247
247
+
</button>
248
248
+
{{ end }}
249
249
+
</div>
250
250
+
</div>
125
251
{{ end }}
126
252
{{ end }}
127
253
+2
appview/state/pull.go
reviewed
···
94
94
}
95
95
}
96
96
97
97
+
log.Println(mergeCheckResponse)
98
98
+
97
99
s.pages.RepoSinglePull(w, pages.RepoSinglePullParams{
98
100
LoggedInUser: user,
99
101
RepoInfo: f.RepoInfo(s, user),