show (deprecated) for deprecated APIs on API reference

Signed-off-by: Jared Watts <jbw976@gmail.com>
This commit is contained in:
Jared Watts 2025-03-28 18:06:21 -07:00
parent d060988e5b
commit 0c56ab2d5c
No known key found for this signature in database
GPG Key ID: 0467EEAE3B6EC0D2
3 changed files with 9 additions and 3 deletions

View File

@ -1,19 +1,23 @@
{{/* Pass a schema and find the currently active version and return a dict of (version: <version>, schema: <schema>) */}}
{{ $version := "" }}
{{ $schema := dict }}
{{ $deprecated := false }}
{{ range .versions }}
{{ if index . "storage" }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
{{ else if (and (index . "served") (not $version)) }}
{{ $version = .name }}
{{ $schema = .schema }}
{{ $deprecated = .deprecated }}
{{ end }}
{{ end }}
{{ return (dict "version" $version
"schema" $schema)
"schema" $schema
"deprecated" $deprecated)
}}

View File

@ -2,6 +2,7 @@
{{ $group := .group }}
{{ $kind := .kind }}
{{ $version := .version }}
{{ $deprecated := .deprecated }}
{{ $bigName := partial "apiBuilder/checkBigName" $kind }}
{{/* Collapse/Expand Button and Kind name */}}
@ -11,7 +12,7 @@
{{/* CRD name text */}}
<button class="crd-root collapsed align-middle" data-bs-toggle="collapse" data-bs-target="#{{$kind}}" type="button" aria-expanded="false" aria-controls="{{$kind}}">
<span class="align-middle {{ $kind }}"><a class="expansion-link" name="{{ $kind }}">{{ $kind }}</a></span>
<span class="align-middle {{ $kind }}"><a class="expansion-link" name="{{ $kind }}">{{ $kind }}{{ if $deprecated }} (deprecated){{ end }}</a></span>
</button>
</div>

View File

@ -27,13 +27,14 @@
{{ $versionAndSchema := partial "apiBuilder/getVersionAndSchema" $crdContent.spec }}
{{ $schema := $versionAndSchema.schema.openAPIV3Schema }}
{{ $version := $versionAndSchema.version }}
{{ $deprecated := $versionAndSchema.deprecated }}
{{ $description := $schema.description }}
{{/* The div containing the entire CRD information including the Expand All/Collapse All row */}}
<div class="crd-root-row crd-container row align-middle bigName-row" data-kind="{{ $kind }}" data-group="{{ $group }}-{{ $kind}}" data-version="{{ $version }}-{{ $kind }}">
{{/* generate the GKV line to expand/collapse the CRD data */}}
{{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind) }}
{{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind "deprecated" $deprecated) }}
{{/* The container to show/hide with information related to the CRD */}}