A vibe coded tangled fork which supports pijul.
at 1931b62baa4452616203ccbb356da72688bc4587 87 lines 3.0 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 {{ $timeout := index $c "timeout" }} 9 {{ $empty := eq $total 0 }} 10 {{ $allPass := eq $success $total }} 11 {{ $allFail := eq $fail $total }} 12 {{ $allTimeout := eq $timeout $total }} 13 14 {{ if $empty }} 15 <div class="flex gap-1 items-center"> 16 {{ i "hourglass" "size-4 text-gray-600 dark:text-gray-400 " }} 17 <span>0/{{ $total }}</span> 18 </div> 19 {{ else if $allPass }} 20 <div class="flex gap-1 items-center"> 21 {{ i "check" "size-4 text-green-600" }} 22 <span>{{ $total }}/{{ $total }}</span> 23 </div> 24 {{ else if $allFail }} 25 <div class="flex gap-1 items-center"> 26 {{ i "x" "size-4 text-red-500" }} 27 <span>0/{{ $total }}</span> 28 </div> 29 {{ else if $allTimeout }} 30 <div class="flex gap-1 items-center"> 31 {{ i "clock-alert" "size-4 text-orange-500" }} 32 <span>0/{{ $total }}</span> 33 </div> 34 {{ else }} 35 {{ $radius := f64 8 }} 36 {{ $circumference := mulf64 2.0 (mulf64 3.1416 $radius) }} 37 {{ $offset := 0.0 }} 38 <div class="flex gap-1 items-center"> 39 <svg class="w-4 h-4 transform -rotate-90" viewBox="0 0 20 20"> 40 <circle 41 cx="10" 42 cy="10" 43 r="{{ $radius }}" 44 fill="none" 45 stroke="#f3f4f633" 46 stroke-width="2" /> 47 48 {{ range $kind, $count := $c }} 49 {{ $color := "" }} 50 {{ if or (eq $kind "pending") (eq $kind "running") }} 51 {{ $color = "#eab308" }} 52 {{/* amber-500 */}} 53 {{ else if eq $kind "success" }} 54 {{ $color = "#10b981" }} 55 {{/* green-500 */}} 56 {{ else if eq $kind "cancelled" }} 57 {{ $color = "#6b7280" }} 58 {{/* gray-500 */}} 59 {{ else if eq $kind "timeout" }} 60 {{ $color = "#fb923c" }} 61 {{/* orange-400 */}} 62 {{ else }} 63 {{ $color = "#ef4444" }} 64 {{/* red-500 for failed or unknown */}} 65 {{ end }} 66 67 {{ $percent := divf64 (f64 $count) (f64 $total) }} 68 {{ $length := mulf64 $percent $circumference }} 69 70 71 <circle 72 cx="10" 73 cy="10" 74 r="{{ $radius }}" 75 fill="none" 76 stroke="{{ $color }}" 77 stroke-width="2" 78 stroke-dasharray="{{ printf "%.2f %.2f" $length (subf64 $circumference $length) }}" 79 stroke-dashoffset="{{ printf "%.2f" (negf64 $offset) }}" /> 80 {{ $offset = addf64 $offset $length }} 81 {{ end }} 82 </svg> 83 <span>{{ $success }}/{{ $total }}</span> 84 </div> 85 {{ end }} 86 </div> 87{{ end }}