this repo has no description
1{{ define "repo/fragments/pipelineStatusSymbol" }} 2 <div class="group relative inline-block"> 3 {{ block "icon" $ }} {{ end }} 4 {{ block "tooltip" $ }} {{ end }} 5 </div> 6{{ end }} 7 8{{ define "icon" }} 9<div class="cursor-pointer"> 10 {{ $c := .Counts }} 11 {{ $statuses := .Statuses }} 12 {{ $total := len $statuses }} 13 {{ $success := index $c "success" }} 14 {{ $allPass := eq $success $total }} 15 16 {{ if $allPass }} 17 <div class="flex gap-1 items-center"> 18 {{ i "check" "size-4 text-green-600 dark:text-green-400 " }} {{ $total }}/{{ $total }} 19 </div> 20 {{ else }} 21 {{ $radius := f64 8 }} 22 {{ $circumference := mulf64 2.0 (mulf64 3.1416 $radius) }} 23 {{ $offset := 0.0 }} 24 <div class="flex gap-1 items-center"> 25 <svg class="w-4 h-4 transform -rotate-90" viewBox="0 0 20 20"> 26 <circle cx="10" cy="10" r="{{ $radius }}" fill="none" stroke="#f3f4f633" stroke-width="2"/> 27 28 {{ range $kind, $count := $c }} 29 {{ $color := "" }} 30 {{ if or (eq $kind "pending") (eq $kind "running") }} 31 {{ $color = "#eab308" }} 32 {{ else if eq $kind "success" }} 33 {{ $color = "#10b981" }} 34 {{ else if eq $kind "cancelled" }} 35 {{ $color = "#6b7280" }} 36 {{ else }} 37 {{ $color = "#ef4444" }} 38 {{ end }} 39 40 {{ $percent := divf64 (f64 $count) (f64 $total) }} 41 {{ $length := mulf64 $percent $circumference }} 42 43 <circle 44 cx="10" cy="10" r="{{ $radius }}" 45 fill="none" 46 stroke="{{ $color }}" 47 stroke-width="2" 48 stroke-dasharray="{{ printf "%.2f %.2f" $length (subf64 $circumference $length) }}" 49 stroke-dashoffset="{{ printf "%.2f" (negf64 $offset) }}" 50 /> 51 {{ $offset = addf64 $offset $length }} 52 {{ end }} 53 </svg> 54 <span>{{$success}}/{{ $total }}</span> 55 </div> 56 {{ end }} 57</div> 58{{ end }} 59 60{{ define "tooltip" }} 61<div class="absolute z-[9999] hidden group-hover:block bg-white dark:bg-gray-900 text-sm text-black dark:text-white rounded-md shadow p-2 w-80 top-full mt-2"> 62 <div class="flex flex-col divide-y divide-gray-200 dark:divide-gray-700"> 63 {{ range $name, $all := .Statuses }} 64 <div class="flex items-center justify-between p-1"> 65 {{ $lastStatus := $all.Latest }} 66 {{ $kind := $lastStatus.Status.String }} 67 68 {{ $icon := "dot" }} 69 {{ $color := "text-gray-600 dark:text-gray-500" }} 70 {{ $text := "Failed" }} 71 {{ $time := "" }} 72 73 {{ if eq $kind "pending" }} 74 {{ $icon = "circle-dashed" }} 75 {{ $color = "text-yellow-600 dark:text-yellow-500" }} 76 {{ $text = "Queued" }} 77 {{ $time = timeFmt $lastStatus.Created }} 78 {{ else if eq $kind "running" }} 79 {{ $icon = "circle-dashed" }} 80 {{ $color = "text-yellow-600 dark:text-yellow-500" }} 81 {{ $text = "Running" }} 82 {{ $time = timeFmt $lastStatus.Created }} 83 {{ else if eq $kind "success" }} 84 {{ $icon = "check" }} 85 {{ $color = "text-green-600 dark:text-green-500" }} 86 {{ $text = "Success" }} 87 {{ with $all.TimeTaken }} 88 {{ $time = durationFmt . }} 89 {{ end }} 90 {{ else if eq $kind "cancelled" }} 91 {{ $icon = "circle-slash" }} 92 {{ $color = "text-gray-600 dark:text-gray-500" }} 93 {{ $text = "Cancelled" }} 94 {{ with $all.TimeTaken }} 95 {{ $time = durationFmt . }} 96 {{ end }} 97 {{ else }} 98 {{ $icon = "x" }} 99 {{ $color = "text-red-600 dark:text-red-500" }} 100 {{ $text = "Failed" }} 101 {{ with $all.TimeTaken }} 102 {{ $time = durationFmt . }} 103 {{ end }} 104 {{ end }} 105 106 <div id="left" class="flex items-center gap-2 flex-shrink-0"> 107 {{ i $icon "size-4" $color }} 108 {{ $name }} 109 </div> 110 <div id="right" class="flex items-center gap-2 flex-shrink-0"> 111 <span class="font-bold">{{ $text }}</span> 112 <time class="text-gray-400 dark:text-gray-600">{{ $time }}</time> 113 </div> 114 </div> 115 {{ end }} 116 </div> 117</div> 118{{ end }}