This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / repo / pipelines / workflow.html
7.3 kB 162 lines
1{{ define "title" }}{{ .Workflow }} &middot; Pipeline {{ .Pipeline.Id }} &middot; {{ .RepoInfo.FullName }} &middot; Tangled{{ end }} 2 3{{ define "extrameta" }} 4 {{ $title := "Pipelines"}} 5 {{ $url := printf "https://tangled.org/%s/pipelines" .RepoInfo.FullName }} 6 {{ template "repo/fragments/og" (dict "RepoInfo" .RepoInfo "Title" $title "Url" $url) }} 7{{ end }} 8 9{{ define "repoContentLayout" }} 10<section class="w-full rounded bg-white py-4 pl-5 pr-8 dark:bg-gray-800"> 11 <div class="grid grid-cols-1 gap-[14px] lg:grid-cols-[240px_minmax(0,1fr)]"> 12 <div class="min-w-0"> 13 {{ template "sidebar" . }} 14 </div> 15 <div class="min-w-0"> 16 {{ template "repoContent" . }} 17 </div> 18 </div> 19</section> 20{{ template "fragments/workflow-timers" }} 21{{ end }} 22 23{{ define "repoContent" }} 24 {{ with (index .Pipeline.Statuses .Workflow).Latest }} 25 {{ if .Error }} 26 <div class="mb-4 flex items-start gap-2 rounded border border-red-200 bg-red-50/60 p-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/20 dark:text-red-400"> 27 {{ i "triangle-alert" "size-4 shrink-0 mt-0.5" }} 28 <div class="min-w-0 flex-1"> 29 <div class="break-words whitespace-pre-wrap">{{- .ErrorMessage -}}</div> 30 {{- with .ErrorDetails }} 31 <div class="break-words whitespace-pre-wrap font-mono">{{- . -}}</div> 32 {{- end }} 33 </div> 34 </div> 35 {{ end }} 36 {{ end }} 37 {{ template "logs" . }} 38{{ end }} 39 40{{ define "sidebar" }} 41 {{ $active := .Workflow }} 42 43 {{ with .Pipeline }} 44 {{ $id := .Id }} 45 {{ $pipeline := . }} 46 <div class="sticky top-2 flex h-full min-h-[398px] w-full flex-col gap-2 lg:w-[240px]"> 47 <div class="flex flex-col gap-2"> 48 {{ range $name, $all := .Statuses }} 49 {{ $lastStatus := $all.Latest }} 50 {{ $status := $lastStatus.Status }} 51 {{ $kind := $status.String }} 52 <div 53 class="flex flex-col gap-1.5 rounded px-3 py-2.5 transition-colors {{ if eq $name $active }}border border-transparent bg-gray-100 dark:bg-gray-700{{ else }}border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-800{{ end }}"> 54 <div class="flex h-5 items-center justify-between gap-[14px]"> 55 <a href="/{{ $.RepoInfo.FullName }}/pipelines/{{ $id }}/workflow/{{ $name }}" class="flex min-w-0 items-center gap-0.5 no-underline hover:no-underline"> 56 <span class="truncate text-sm font-medium leading-5 text-gray-900 dark:text-gray-100" title="{{ $name }}">{{ $name }}</span> 57 {{ i "arrow-up-right" "size-4 shrink-0 text-gray-900 dark:text-gray-100" }} 58 </a> 59 <div class="shrink-0 text-sm leading-5 text-gray-500 dark:text-gray-400"> 60 {{ template "repo/fragments/shortTimeAgo" $lastStatus.Created }} 61 </div> 62 </div> 63 <div class="flex h-8 items-center justify-between gap-2"> 64 <div class="flex min-w-0 items-center gap-1"> 65 <div id="workflow-symbol-{{ normalizeForHtmlId $name }}" class="flex-shrink-0"> 66 {{ template "repo/pipelines/fragments/workflowSymbol" $all }} 67 </div> 68 <span class="truncate text-sm font-semibold leading-5 text-gray-900 dark:text-gray-100">{{ $kind }}</span> 69 </div> 70 {{ template "workflowActions" (dict "Root" $ "Pipeline" $pipeline "Name" $name "Kind" $kind "Status" $status) }} 71 </div> 72 </div> 73 {{ end }} 74 </div> 75 {{ template "sidebarActions" $ }} 76 </div> 77 {{ end }} 78{{ end }} 79 80{{ define "workflowActions" }} 81 {{ $root := .Root }} 82 {{ $status := .Status }} 83 {{ $kind := .Kind }} 84 {{ if and $root.RepoInfo.Roles.IsPushAllowed (ne $kind "success") }} 85 <div class="flex shrink-0 items-center gap-0.5"> 86 <button 87 class="group inline-flex h-8 w-[30px] min-h-8 items-center justify-center rounded px-2 py-1.5 text-gray-900 dark:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700" 88 title="Retry workflow" 89 hx-post="/{{ $root.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Name }}/retry" 90 hx-swap="none" 91 hx-disabled-elt="this" 92 > 93 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 94 {{ i "rotate-ccw" "size-4 group-[.htmx-request]:hidden" }} 95 </button> 96 {{ if not $status.IsFinish }} 97 <button 98 class="group inline-flex h-8 w-[30px] min-h-8 items-center justify-center rounded px-2 py-1.5 text-gray-900 dark:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700" 99 title="Cancel workflow" 100 hx-post="/{{ $root.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Name }}/cancel" 101 hx-swap="none" 102 hx-disabled-elt="this" 103 > 104 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 105 {{ i "x" "size-4 group-[.htmx-request]:hidden" }} 106 </button> 107 {{ end }} 108 </div> 109 {{ end }} 110{{ end }} 111 112{{ define "sidebarActions" }} 113 <div class="mt-auto flex w-full flex-col gap-2"> 114 {{ with .SSHLogCommand }} 115 <button type="button" class="btn flex h-9 min-h-9 w-full items-center justify-center gap-1.5 px-2 py-2 text-sm leading-5" onclick="const button=this; navigator.clipboard.writeText(button.title).then(() => { const content=button.innerHTML; button.textContent='Copied!'; setTimeout(() => button.innerHTML=content, 1500) })" title="{{ . }}"> 116 {{ i "copy" "size-4" }} Watch logs via SSH 117 </button> 118 {{ end }} 119 {{ if .RepoInfo.Roles.IsPushAllowed }} 120 <div class="flex w-full gap-2"> 121 <div id="workflow-error" class="empty:hidden text-red-500 dark:text-red-400"></div> 122 <button 123 class="btn group flex h-9 min-h-9 flex-1 items-center justify-center gap-1.5 px-2 py-2 text-sm leading-5" 124 hx-post="/{{ .RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/retry" 125 hx-swap="none" 126 hx-disabled-elt="this" 127 > 128 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 129 {{ i "rotate-ccw" "size-4 group-[.htmx-request]:hidden" }} 130 <span>Retry all</span> 131 </button> 132 {{ if .Pipeline.InProgress }} 133 <button 134 class="btn group flex h-9 min-h-9 flex-1 items-center justify-center gap-1.5 px-2 py-2 text-sm leading-5" 135 hx-post="/{{ .RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/cancel" 136 hx-swap="none" 137 hx-disabled-elt="this" 138 > 139 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 140 {{ i "circle-stop" "size-4 group-[.htmx-request]:hidden" }} 141 <span>Cancel all</span> 142 </button> 143 {{ end }} 144 </div> 145 {{ end }} 146 </div> 147{{ end }} 148 149{{ define "logs" }} 150 <div id="log-stream" 151 class="text-sm" 152 hx-ext="ws" 153 ws-connect="/{{ $.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Workflow }}/logs"> 154 <div id="lines" class="flex flex-col gap-3"> 155 <div class="hidden items-center justify-center rounded border border-gray-200 p-12 text-base italic text-gray-500 only:flex dark:border-gray-700"> 156 <span class="flex items-center gap-2"> 157 {{ i "triangle-alert" "size-4" }} No logs for this workflow 158 </span> 159 </div> 160 </div> 161 </div> 162{{ end }}