From 7b93fef3bfd2d64ee30476b89be5d31222fd894e Mon Sep 17 00:00:00 2001 From: Laurent Senta Date: Tue, 19 Sep 2023 12:39:41 +0200 Subject: [PATCH] dashboard: render metadata --- munge_aggregates.js | 34 ++++++++++++- www/content/current.md | 3 -- www/themes/conformance/assets/style.css | 48 ++++++++++++------- .../layouts/partials/breadcrumbs.html | 32 +++++-------- .../conformance/layouts/partials/header.html | 6 ++- .../layouts/partials/result-table.html | 1 + .../conformance/layouts/results/term.html | 37 +++++++++++++- 7 files changed, 117 insertions(+), 44 deletions(-) diff --git a/munge_aggregates.js b/munge_aggregates.js index 117a1000b..420a8ff50 100644 --- a/munge_aggregates.js +++ b/munge_aggregates.js @@ -63,6 +63,36 @@ const computeName = (u) => { }; }; +const getTestRunDetails = async (jobUrl) => { + if (!jobUrl) { + return {}; + } + + const match = jobUrl.match(/https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/actions\/runs\/(\d+)/); + if (!match) { + console.warn('Invalid URL format:', jobUrl); + return {}; + } + + const [, owner, repo, run_id] = match; + + const apiUrl = `https://api.github.com/repos/${owner}/${repo}/actions/runs/${run_id}`; + + try { + // Required node18 + const result = await fetch(apiUrl, { + headers: { + 'Accept': 'application/vnd.github.v3+json' + } + }) + const { created_at, head_sha, head_branch, run_started_at } = await result.json() + return { created_at, head_sha, head_branch, run_started_at } + } catch (e) { + console.error(`Error fetch ${jobUrl} details:`, e); + return {} + } +} + const main = async () => { let db = new sqlite3.Database(dbFile, (err) => { if (err) { @@ -86,7 +116,9 @@ const main = async () => { if (!runs[id]) { runs[id] = {}; } - runs[id][version] = rest; + const testRunDetails = await getTestRunDetails(rest.job_url); + + runs[id][version] = { ...rest, ...testRunDetails }; } outputJSON("data/testruns.json", runs); diff --git a/www/content/current.md b/www/content/current.md index 238c9f5ae..c18905c7d 100644 --- a/www/content/current.md +++ b/www/content/current.md @@ -1,9 +1,6 @@ --- title: By Reference Implementation published: true -menu: - main: - weight: 10 --- This table shows the test results organized by test groups and reference implementations. Click on any row or cell to drill down into the tests results. diff --git a/www/themes/conformance/assets/style.css b/www/themes/conformance/assets/style.css index 92c14b41b..6b0d7b894 100644 --- a/www/themes/conformance/assets/style.css +++ b/www/themes/conformance/assets/style.css @@ -788,11 +788,6 @@ video { margin-bottom: 1.5rem; } -.my-auto { - margin-top: auto; - margin-bottom: auto; -} - .mb-3 { margin-bottom: 0.75rem; } @@ -801,8 +796,8 @@ video { margin-bottom: 1rem; } -.ml-4 { - margin-left: 1rem; +.mb-6 { + margin-bottom: 1.5rem; } .mr-2 { @@ -873,10 +868,18 @@ video { width: 1.25rem; } +.w-8 { + width: 2rem; +} + .w-auto { width: auto; } +.w-full { + width: 100%; +} + .min-w-full { min-width: 100%; } @@ -901,10 +904,6 @@ video { grid-template-columns: repeat(1, minmax(0, 1fr)); } -.flex-col { - flex-direction: column; -} - .items-center { align-items: center; } @@ -927,12 +926,6 @@ video { column-gap: 1.5rem; } -.space-x-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(1rem * var(--tw-space-x-reverse)); - margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); -} - .divide-y > :not([hidden]) ~ :not([hidden]) { --tw-divide-y-reverse: 0; border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); @@ -1065,10 +1058,22 @@ video { padding-bottom: 0.5rem; } +.pb-4 { + padding-bottom: 1rem; +} + +.pr-4 { + padding-right: 1rem; +} + .pt-1 { padding-top: 0.25rem; } +.text-left { + text-align: left; +} + .text-center { text-align: center; } @@ -1124,6 +1129,11 @@ video { color: rgb(59 130 246 / var(--tw-text-opacity)); } +.text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity)); +} + .text-blue-700 { --tw-text-opacity: 1; color: rgb(29 78 216 / var(--tw-text-opacity)); @@ -1444,6 +1454,10 @@ article th { color: rgb(55 65 81 / var(--tw-text-opacity)); } +.hover\:underline:hover { + text-decoration-line: underline; +} + @media (min-width: 640px) { .sm\:px-6 { padding-left: 1.5rem; diff --git a/www/themes/conformance/layouts/partials/breadcrumbs.html b/www/themes/conformance/layouts/partials/breadcrumbs.html index bf6652897..d4885f72e 100644 --- a/www/themes/conformance/layouts/partials/breadcrumbs.html +++ b/www/themes/conformance/layouts/partials/breadcrumbs.html @@ -1,23 +1,21 @@ {{ define "breadcrumbitem" }} -
  • -
    {{ if (gt (len .Ancestors) 0) }} {{ .Title }} {{ else }} - + {{/* {{ .Title }} - + */}} {{ end }} -
    -
  • {{ end }} -
    - -
    +{{- range $i, $p := .Ancestors.Reverse }} + {{ template "breadcrumbitem" $p }} +{{ end }} +{{ template "breadcrumbitem" . }} diff --git a/www/themes/conformance/layouts/partials/header.html b/www/themes/conformance/layouts/partials/header.html index f163e6976..df9ceaaae 100644 --- a/www/themes/conformance/layouts/partials/header.html +++ b/www/themes/conformance/layouts/partials/header.html @@ -4,7 +4,7 @@ Logo - {{ if .Site.Menus.main }} + {{ if .Site.Menus.main }} {{ $currentPage := . }} {{ range .Site.Menus.main }} @@ -12,6 +12,10 @@ {{ end }} {{ end }} + + {{- block "breadcrumbs" . }} + {{ partial "breadcrumbs.html" . }} + {{- end -}} \ No newline at end of file diff --git a/www/themes/conformance/layouts/partials/result-table.html b/www/themes/conformance/layouts/partials/result-table.html index 7a6efb0f5..93ab77de2 100644 --- a/www/themes/conformance/layouts/partials/result-table.html +++ b/www/themes/conformance/layouts/partials/result-table.html @@ -51,6 +51,7 @@ href="{{ absURL (path.Join "results" $implementation) }}"> {{ $implementation }} + {{ end }} {{ end }} diff --git a/www/themes/conformance/layouts/results/term.html b/www/themes/conformance/layouts/results/term.html index c96322f15..5da9971fa 100644 --- a/www/themes/conformance/layouts/results/term.html +++ b/www/themes/conformance/layouts/results/term.html @@ -10,6 +10,41 @@

    {{.Title}}

    {{.TableOfContents}} {{.Content}} +
    + {{ $implem := .Params.implementation_id }} + {{ $requestedVersion := .Params.version }} + + {{ with (index site.Data "testruns" .Params.implementation_id ) }} + {{ range $version, $details := . }} + {{ if (or (eq $requestedVersion nil) (eq $requestedVersion $version)) }} +
    +

    Metadata

    + + + + + + + + + + + + + + + + + +
    Conformance Version:{{ $version }}
    Implementation Version:{{ $details.head_branch }} ({{ $details.head_sha }})
    Results Generated At:{{ $details.created_at }}
    Job URL:{{ $details.job_url }}
    +
    + {{ end }} + {{ end }} + {{ end }} +
    + +

    Results

    +
    {{ partial "result-table.html" .Params }}
    @@ -50,4 +85,4 @@

    See Also

  • {{.Title}}
  • {{end}} -{{end}} {{end}} \ No newline at end of file +{{end}} {{end}}