From de8a9ebf808e018b432332872e72dfb919f06d6c Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 5 Jun 2024 09:16:18 +0100 Subject: [release status] Do not render security advisory table headers if there are no advisories --- plugins/release-status.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/plugins/release-status.lua b/plugins/release-status.lua index d7b0fd7..19d2708 100644 --- a/plugins/release-status.lua +++ b/plugins/release-status.lua @@ -39,21 +39,24 @@ function generate_table(vyos_version, version_table) HTML.append_child(target_elem, notes) end - local status_table = HTML.create_element("table") - HTML.append_child(status_table, HTML.parse("CVENameDescriptionStatus")) + if not Table.is_empty(version_table["security_advisory"]) then + Log.debug(JSON.pretty_print(version_table["security_advisory"])) + local status_table = HTML.create_element("table") + HTML.append_child(status_table, HTML.parse("CVENameDescriptionStatus")) - local i = 1 - while version_table["security_advisory"][i] do - local row = version_table["security_advisory"][i] - local advisory = HTML.create_element("tr") - HTML.append_child(advisory, HTML.create_element("td", row["cve"])) - HTML.append_child(advisory, HTML.create_element("td", row["title"])) - HTML.append_child(advisory, HTML.create_element("td", row["description"])) - HTML.append_child(advisory, HTML.create_element("td", row["status"])) - HTML.append_child(status_table, advisory) - i = i + 1 + local i = 1 + while version_table["security_advisory"][i] do + local row = version_table["security_advisory"][i] + local advisory = HTML.create_element("tr") + HTML.append_child(advisory, HTML.create_element("td", row["cve"])) + HTML.append_child(advisory, HTML.create_element("td", row["title"])) + HTML.append_child(advisory, HTML.create_element("td", row["description"])) + HTML.append_child(advisory, HTML.create_element("td", row["status"])) + HTML.append_child(status_table, advisory) + i = i + 1 + end + HTML.append_child(HTML.select_one(page, selector), status_table) end - HTML.append_child(HTML.select_one(page, selector), status_table) end if toml_string then -- cgit v1.2.3