[pdm-devel] [PATCH widget-toolkit v5 1/1] api viewer: add support for endpoints that are marked as unstable
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Dec 1 17:26:09 CET 2025
Am 01.12.25 um 11:28 schrieb Shannon Sterz:
> display a warning when an endpoint is marked as unstable.
>
> Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
> Tested-by: Lukas Wagner <l.wagner at proxmox.com>
> Reviewed-by: Lukas Wagner <l.wagner at proxmox.com>
> ---
> src/api-viewer/APIViewer.js | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/src/api-viewer/APIViewer.js b/src/api-viewer/APIViewer.js
> index 7f27e0d..1357741 100644
> --- a/src/api-viewer/APIViewer.js
> +++ b/src/api-viewer/APIViewer.js
> @@ -210,7 +210,21 @@ Ext.onReady(function () {
> usage += cliUsageRenderer(method, endpoint);
> }
>
> - let sections = [
> + let sections = [];
> +
> + if (info.unstable) {
> + sections.push({
> + title: 'Unstable',
> + html: `<div class="proxmox-warning-row" style="padding: 10px;">
> + <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
> + This API endpoint is marked as unstable. All information on this
> + page is subject to change, including input parameters, return values
> + and permissions.
> + </div>`,
> + });
> + }
> +
> + sections.concat([
The concat [0] array method always returns a new array, so with your change
fully rolled out (installing this and then, e.g., rebuilding pve-docs with it)
the Description and Usage section vanished. I simply switched this out with doing
an sections.push, which modifies sections itself.
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat
> {
> title: 'Description',
> html: Ext.htmlEncode(info.description),
> @@ -221,7 +235,7 @@ Ext.onReady(function () {
> html: usage,
> bodyPadding: 10,
> },
> - ];
> + ]);
>
> if (info.parameters && info.parameters.properties) {
> let pstore = Ext.create('Ext.data.Store', {
> --
> 2.47.3
More information about the pdm-devel
mailing list