diff options
author | Daniil Baturin <daniil@baturin.org> | 2024-06-05 09:16:18 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2024-06-05 09:16:18 +0100 |
commit | de8a9ebf808e018b432332872e72dfb919f06d6c (patch) | |
tree | a711e266a04a55920e196253fd59508155b4318c | |
parent | 7e5410ea03fb922a0d0787102976129ad283e272 (diff) | |
download | community.vyos.net-de8a9ebf808e018b432332872e72dfb919f06d6c.tar.gz community.vyos.net-de8a9ebf808e018b432332872e72dfb919f06d6c.zip |
[release status] Do not render security advisory table headers if there are no advisories
-rw-r--r-- | plugins/release-status.lua | 29 |
1 files 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("<tr><th>CVE</th><th>Name</th><th>Description</th><th>Status</th></tr>")) + 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("<tr><th>CVE</th><th>Name</th><th>Description</th><th>Status</th></tr>")) - 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 |