forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

appview: make tooltips persistent, link tooltips to workflow page

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li d2134de3 0df0d697

verified
Changed files
+39 -31
appview
+1 -1
appview/pages/templates/repo/commit.html
···
<div class="text-sm">
{{ if $.Pipeline }}
-
{{ template "repo/pipelines/fragments/pipelineSymbolLong" $.Pipeline }}
+
{{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $.Pipeline "RepoInfo" $.RepoInfo) }}
{{ end }}
</div>
</div>
+1 -1
appview/pages/templates/repo/index.html
···
{{ $pipeline := index $.Pipelines .Hash.String }}
{{ if and $pipeline (gt (len $pipeline.Statuses) 0) }}
<div class="inline-block px-1 select-none after:content-['·']"></div>
-
{{ template "repo/pipelines/fragments/pipelineSymbolLong" $pipeline }}
+
{{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "RepoInfo" $.RepoInfo "Pipeline" $pipeline) }}
{{ end }}
</div>
</div>
+2 -2
appview/pages/templates/repo/log.html
···
<!-- ci status -->
{{ $pipeline := index $.Pipelines .Hash.String }}
{{ if and $pipeline (gt (len $pipeline.Statuses) 0) }}
-
{{ template "repo/pipelines/fragments/pipelineSymbolLong" $pipeline }}
+
{{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $pipeline "RepoInfo" $.RepoInfo) }}
{{ end }}
</td>
<td class=" py-3 align-top text-gray-500 dark:text-gray-400">{{ timeFmt $commit.Committer.When }}</td>
···
{{ if and $pipeline (gt (len $pipeline.Statuses) 0) }}
<div class="inline-block px-1 select-none after:content-['·']"></div>
<span class="text-sm">
-
{{ template "repo/pipelines/fragments/pipelineSymbolLong" $pipeline }}
+
{{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $pipeline "RepoInfo" $.RepoInfo) }}
</span>
{{ end }}
</div>
+9 -5
appview/pages/templates/repo/pipelines/fragments/pipelineSymbolLong.html
···
{{ define "repo/pipelines/fragments/pipelineSymbolLong" }}
-
<div class="group relative inline-block">
-
{{ template "repo/pipelines/fragments/pipelineSymbol" $ }}
-
{{ template "repo/pipelines/fragments/tooltip" $ }}
+
{{ $pipeline := .Pipeline }}
+
{{ $repoinfo := .RepoInfo }}
+
<div class="relative inline-block">
+
<details class="relative">
+
<summary class="cursor-pointer list-none">
+
{{ template "repo/pipelines/fragments/pipelineSymbol" .Pipeline }}
+
</summary>
+
{{ template "repo/pipelines/fragments/tooltip" $ }}
+
</details>
</div>
{{ end }}
-
-
+25 -21
appview/pages/templates/repo/pipelines/fragments/tooltip.html
···
{{ define "repo/pipelines/fragments/tooltip" }}
-
<div class="absolute z-[9999] hidden group-hover:block bg-white dark:bg-gray-900 text-black dark:text-white rounded-md shadow w-80 top-full mt-2">
+
{{ $repoinfo := .RepoInfo }}
+
{{ $pipeline := .Pipeline }}
+
{{ $id := $pipeline.Id }}
+
<div class="absolute z-[9999] bg-white dark:bg-gray-900 text-black dark:text-white rounded shadow-sm w-80 top-full mt-2 p-2">
<div class="flex flex-col divide-y divide-gray-200 dark:divide-gray-700">
-
{{ range $name, $all := .Statuses }}
-
<div class="flex items-center justify-between p-2">
-
{{ $lastStatus := $all.Latest }}
-
{{ $kind := $lastStatus.Status.String }}
+
{{ range $name, $all := $pipeline.Statuses }}
+
<a href="/{{ $repoinfo.FullName }}/pipelines/{{ $id }}/workflow/{{ $name }}" class="hover:no-underline">
+
<div class="flex items-center justify-between p-2">
+
{{ $lastStatus := $all.Latest }}
+
{{ $kind := $lastStatus.Status.String }}
-
{{ $t := .TimeTaken }}
-
{{ $time := "" }}
-
{{ if $t }}
-
{{ $time = durationFmt $t }}
-
{{ else }}
-
{{ $time = printf "%s ago" (shortTimeFmt $.Created) }}
-
{{ end }}
+
{{ $t := .TimeTaken }}
+
{{ $time := "" }}
+
{{ if $t }}
+
{{ $time = durationFmt $t }}
+
{{ else }}
+
{{ $time = printf "%s ago" (shortTimeFmt $.Created) }}
+
{{ end }}
-
<div id="left" class="flex items-center gap-2 flex-shrink-0">
-
{{ template "repo/pipelines/fragments/workflowSymbol" $all }}
-
{{ $name }}
+
<div id="left" class="flex items-center gap-2 flex-shrink-0">
+
{{ template "repo/pipelines/fragments/workflowSymbol" $all }}
+
{{ $name }}
+
</div>
+
<div id="right" class="flex items-center gap-2 flex-shrink-0">
+
<span class="font-bold">{{ $kind }}</span>
+
<time>{{ $time }}</time>
+
</div>
</div>
-
<div id="right" class="flex items-center gap-2 flex-shrink-0">
-
<span class="font-bold">{{ $kind }}</span>
-
<time>{{ $time }}</time>
-
</div>
-
</div>
+
</a>
{{ else }}
<div class="flex items-center gap-2 p-2 italic text-gray-600 dark:text-gray-400 ">
{{ i "hourglass" "size-4" }}
···
</div>
</div>
{{ end }}
-
+1 -1
appview/pages/templates/repo/pipelines/pipelines.html
···
</div>
<div class="text-sm md:text-base col-span-1">
-
{{ template "repo/pipelines/fragments/pipelineSymbolLong" . }}
+
{{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" . "RepoInfo" $root.RepoInfo) }}
</div>
<div class="text-sm md:text-base col-span-1 text-right">