A vibe coded tangled fork which supports pijul.
at d2134de36028e2a884f2e9f54ee158188929efd0 66 lines 2.3 kB view raw
1{{ define "repo/pipelines/fragments/pipelineSymbol" }} 2 <div class="cursor-pointer"> 3 {{ $c := .Counts }} 4 {{ $statuses := .Statuses }} 5 {{ $total := len $statuses }} 6 {{ $success := index $c "success" }} 7 {{ $fail := index $c "failed" }} 8 {{ $empty := eq $total 0 }} 9 {{ $allPass := eq $success $total }} 10 {{ $allFail := eq $fail $total }} 11 12 {{ if $empty }} 13 <div class="flex gap-1 items-center"> 14 {{ i "hourglass" "size-4 text-gray-600 dark:text-gray-400 " }} 15 <span>0/{{ $total }}</span> 16 </div> 17 {{ else if $allPass }} 18 <div class="flex gap-1 items-center"> 19 {{ i "check" "size-4 text-green-600" }} 20 <span>{{ $total }}/{{ $total }}</span> 21 </div> 22 {{ else if $allFail }} 23 <div class="flex gap-1 items-center"> 24 {{ i "x" "size-4 text-red-600" }} 25 <span>0/{{ $total }}</span> 26 </div> 27 {{ else }} 28 {{ $radius := f64 8 }} 29 {{ $circumference := mulf64 2.0 (mulf64 3.1416 $radius) }} 30 {{ $offset := 0.0 }} 31 <div class="flex gap-1 items-center"> 32 <svg class="w-4 h-4 transform -rotate-90" viewBox="0 0 20 20"> 33 <circle cx="10" cy="10" r="{{ $radius }}" fill="none" stroke="#f3f4f633" stroke-width="2"/> 34 35 {{ range $kind, $count := $c }} 36 {{ $color := "" }} 37 {{ if or (eq $kind "pending") (eq $kind "running") }} 38 {{ $color = "#eab308" }} 39 {{ else if eq $kind "success" }} 40 {{ $color = "#10b981" }} 41 {{ else if eq $kind "cancelled" }} 42 {{ $color = "#6b7280" }} 43 {{ else }} 44 {{ $color = "#ef4444" }} 45 {{ end }} 46 47 {{ $percent := divf64 (f64 $count) (f64 $total) }} 48 {{ $length := mulf64 $percent $circumference }} 49 50 <circle 51 cx="10" cy="10" r="{{ $radius }}" 52 fill="none" 53 stroke="{{ $color }}" 54 stroke-width="2" 55 stroke-dasharray="{{ printf "%.2f %.2f" $length (subf64 $circumference $length) }}" 56 stroke-dashoffset="{{ printf "%.2f" (negf64 $offset) }}" 57 /> 58 {{ $offset = addf64 $offset $length }} 59 {{ end }} 60 </svg> 61 <span>{{ $success }}/{{ $total }}</span> 62 </div> 63 {{ end }} 64 </div> 65{{ end }} 66