diff --git a/package.json b/package.json index e20593bb..485f2943 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "@nodesecure/documentation-ui": "^1.3.0", "@nodesecure/flags": "^3.0.3", "@nodesecure/i18n": "^4.0.1", - "@nodesecure/js-x-ray": "^8.2.0", + "@nodesecure/js-x-ray": "^9.0.0", "@nodesecure/licenses-conformance": "^2.1.0", "@nodesecure/npm-registry-sdk": "^3.0.0", "@nodesecure/ossf-scorecard-sdk": "^3.2.1", diff --git a/public/components/views/settings/settings.js b/public/components/views/settings/settings.js index f9881523..7cbec4b0 100644 --- a/public/components/views/settings/settings.js +++ b/public/components/views/settings/settings.js @@ -1,5 +1,9 @@ // Import Third-party Dependencies import { getJSON } from "@nodesecure/vis-network"; +import { warnings } from "@nodesecure/js-x-ray/warnings"; + +// Import Internal Dependencies +import * as utils from "../../../common/utils.js"; // CONSTANTS const kAllowedHotKeys = new Set([ @@ -21,6 +25,7 @@ export class Settings { static defaultMenuName = "info"; constructor() { + this.#generateWarningCheckboxes(); this.saveEnabled = false; this.dom = { /** @type {HTMLSelectElement} */ @@ -95,6 +100,31 @@ export class Settings { this.updateFormHotKeys(hotkeys); } + #generateWarningCheckboxes() { + const warningsSettings = document.getElementById("warnings-settings"); + const checkboxes = Object.keys(warnings).map((id) => utils.createDOMElement("div", { + childs: [ + utils.createDOMElement("input", { + attributes: { + id, + value: id, + type: "checkbox", + checked: true, + name: "warnings" + } + }), + utils.createDOMElement("label", { + attributes: { + for: id + }, + text: id.replaceAll("-", " ") + }) + ] + }) + ); + warningsSettings.append(...checkboxes); + } + updateNavigationHotKey(hotkeys) { const navigationElement = document.getElementById("view-navigation"); navigationElement.querySelectorAll("span").forEach((span) => { diff --git a/views/index.html b/views/index.html index 8771c75d..8e007f52 100644 --- a/views/index.html +++ b/views/index.html @@ -122,60 +122,8 @@
[[=z.token('settings.general.warnings')]]:
-[[=z.token('settings.general.flags')]]: