{{ define "repo/pipelines/fragments/pipelineSymbol" }}
{{ template "symbol" .Pipeline }} {{ if .ShortSummary }} {{ .Pipeline.ShortStatusSummary }} {{ else }} {{ .Pipeline.LongStatusSummary }} {{ end }}
{{ end }} {{ define "symbol" }} {{ $c := .Counts }} {{ $statuses := .Statuses }} {{ $total := len $statuses }} {{ $success := index $c "success" }} {{ $fail := index $c "failed" }} {{ $timeout := index $c "timeout" }} {{ $empty := eq $total 0 }} {{ $allPass := eq $success $total }} {{ $allFail := eq $fail $total }} {{ $allTimeout := eq $timeout $total }} {{ if $empty }} {{ i "hourglass" "size-4 text-gray-600 dark:text-gray-400 " }} {{ else if $allPass }} {{ i "check" "size-4 text-green-600 dark:text-green-500" }} {{ else if $allFail }} {{ i "x" "size-4 text-red-600 dark:text-red-500" }} {{ else if $allTimeout }} {{ i "clock-alert" "size-4 text-orange-500" }} {{ else }} {{ $radius := f64 8 }} {{ $circumference := mulf64 2.0 (mulf64 3.1416 $radius) }} {{ $offset := 0.0 }} {{ range $kind, $count := $c }} {{ $colorClass := "" }} {{ if or (eq $kind "pending") (eq $kind "running") }} {{ $colorClass = "stroke-yellow-600 dark:stroke-yellow-500" }} {{ else if eq $kind "success" }} {{ $colorClass = "stroke-green-600 dark:stroke-green-500" }} {{ else if eq $kind "cancelled" }} {{ $colorClass = "stroke-gray-600 dark:stroke-gray-500" }} {{ else if eq $kind "timeout" }} {{ $colorClass = "stroke-orange-600 dark:stroke-orange-500" }} {{ else }} {{ $colorClass = "stroke-red-600 dark:stroke-red-500" }} {{ end }} {{ $percent := divf64 (f64 $count) (f64 $total) }} {{ $length := mulf64 $percent $circumference }} {{ $offset = addf64 $offset $length }} {{ end }} {{ end }} {{ end }}