Monorepo for Tangled
1{{ define "title" }} {{ .Workflow }} · pipeline {{ .Pipeline.Id }} · {{ .RepoInfo.FullName }}{{ 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 "repoContent" }}
10<section class="w-full grid grid-cols-1 md:grid-cols-4 gap-2 mt-2">
11 <div class="col-span-1">
12 {{ block "sidebar" . }} {{ end }}
13 </div>
14 <div class="col-span-1 md:col-span-3">
15 <!-- TODO(boltless): explictly check for pipeline cancel permission -->
16 {{ if $.RepoInfo.Roles.IsOwner }}
17 <div class="flex justify-between mb-2">
18 <div id="workflow-error" class="text-red-500 dark:text-red-400"></div>
19 <button
20 class="btn"
21 hx-post="/{{ $.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Workflow }}/cancel"
22 hx-swap="none"
23 {{ if (index .Pipeline.Statuses .Workflow).Latest.Status.IsFinish -}}
24 disabled
25 {{- end }}
26 >Cancel</button>
27 </div>
28 {{ end }}
29 {{ block "logs" . }} {{ end }}
30 </div>
31</section>
32{{ template "fragments/workflow-timers" }}
33{{ end }}
34
35{{ define "sidebar" }}
36 {{ $active := .Workflow }}
37
38 {{ $activeTab := "bg-white dark:bg-gray-700 drop-shadow-sm" }}
39 {{ $inactiveTab := "bg-gray-100 dark:bg-gray-800" }}
40
41 {{ with .Pipeline }}
42 {{ $id := .Id }}
43 <div class="sticky top-2 grid grid-cols-1 rounded border border-gray-200 dark:border-gray-700 divide-y divide-gray-200 dark:divide-gray-700">
44 {{ range $name, $all := .Statuses }}
45 <a href="/{{ $.RepoInfo.FullName }}/pipelines/{{ $id }}/workflow/{{ $name }}" class="no-underline hover:no-underline hover:bg-gray-100/25 hover:dark:bg-gray-700/25">
46 <div
47 class="flex gap-2 items-center justify-between p-2 {{ if eq $name $active }} {{ $activeTab }} {{ else }} {{ $inactiveTab }} {{ end }}">
48 {{ $lastStatus := $all.Latest }}
49 {{ $kind := $lastStatus.Status.String }}
50
51 <div id="left" class="flex items-center gap-2 flex-shrink-0">
52 {{ template "repo/pipelines/fragments/workflowSymbol" $all }}
53 {{ $name }}
54 </div>
55 <div id="right" class="flex items-center gap-2 flex-shrink-0">
56 <span class="font-bold">{{ $kind }}</span>
57 {{ if .TimeTaken }}
58 {{ template "repo/fragments/duration" .TimeTaken }}
59 {{ else }}
60 {{ template "repo/fragments/shortTimeAgo" $lastStatus.Created }}
61 {{ end }}
62 </div>
63 </div>
64 </a>
65 {{ end }}
66 </div>
67 {{ end }}
68{{ end }}
69
70{{ define "logs" }}
71 <div id="log-stream"
72 class="text-sm"
73 hx-ext="ws"
74 ws-connect="/{{ $.RepoInfo.FullName }}/pipelines/{{ .Pipeline.Id }}/workflow/{{ .Workflow }}/logs">
75 <div id="lines" class="flex flex-col gap-2">
76 <div class="text-base text-gray-500 flex items-center justify-center italic p-12 only:flex hidden border border-gray-200 dark:border-gray-700 rounded">
77 <span class="flex items-center gap-2">
78 {{ i "triangle-alert" "size-4" }} No logs for this workflow
79 </span>
80 </div>
81 </div>
82 </div>
83{{ end }}