From 72a39012b6421eb992e1aab82a6675e7d8ab186c Mon Sep 17 00:00:00 2001 From: Alpha Vylly <65187737+AlphaLawless@users.noreply.github.com> Date: Sun, 23 Nov 2025 09:22:57 -0300 Subject: [PATCH] feat: add script disable functionality with visual indicators (#9374) --- frontend/public/json/opnsense-vm.json | 43 ++++++++++++++ .../src/app/json-editor/_schemas/schemas.ts | 10 ++++ frontend/src/app/json-editor/page.tsx | 20 +++++++ .../scripts/_components/script-accordion.tsx | 6 +- .../app/scripts/_components/script-item.tsx | 57 +++++++++++-------- .../script-items/disable-description.tsx | 26 +++++++++ frontend/src/components/text-parse-links.tsx | 52 +++++++++++++++++ frontend/src/lib/types.ts | 2 + 8 files changed, 190 insertions(+), 26 deletions(-) create mode 100644 frontend/public/json/opnsense-vm.json create mode 100644 frontend/src/app/scripts/_components/script-items/disable-description.tsx create mode 100644 frontend/src/components/text-parse-links.tsx diff --git a/frontend/public/json/opnsense-vm.json b/frontend/public/json/opnsense-vm.json new file mode 100644 index 000000000..6ec515507 --- /dev/null +++ b/frontend/public/json/opnsense-vm.json @@ -0,0 +1,43 @@ +{ + "name": "OPNsense", + "slug": "opnsense-vm", + "categories": [ + 4, + 2 + ], + "date_created": "2025-02-11", + "type": "vm", + "updateable": true, + "privileged": false, + "interface_port": 443, + "documentation": "https://docs.opnsense.org/", + "website": "https://opnsense.org/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/opnsense.webp", + "config_path": "", + "description": "OPNsense is an open-source firewall and routing platform based on FreeBSD. It provides advanced security features, including intrusion detection, VPN support, traffic shaping, and web filtering, with an intuitive web interface for easy management. Known for its reliability and regular updates, OPNsense is a popular choice for both businesses and home networks.", + "disable": true, + "disable_description": "This script has been temporarily disabled due to installation failures. The OPNsense bootstrap process was not completing successfully, resulting in a plain FreeBSD VM instead of a functional OPNsense installation. The issue is being investigated and the script will be re-enabled once resolved. For more details, see: https://github.com/community-scripts/ProxmoxVE/issues/6183", + "install_methods": [ + { + "type": "default", + "script": "vm/opnsense-vm.sh", + "resources": { + "cpu": 4, + "ram": 8192, + "hdd": 10, + "os": "FreeBSD", + "version": "latest" + } + } + ], + "default_credentials": { + "username": "root", + "password": "opnsense" + }, + "notes": [ + { + "text": "It will fail with default settings if there is no vmbr0 and vmbr1 on your node. Use advanced settings in this case.", + "type": "warning" + } + ] +} diff --git a/frontend/src/app/json-editor/_schemas/schemas.ts b/frontend/src/app/json-editor/_schemas/schemas.ts index ef278afd0..ed104e18e 100644 --- a/frontend/src/app/json-editor/_schemas/schemas.ts +++ b/frontend/src/app/json-editor/_schemas/schemas.ts @@ -35,12 +35,22 @@ export const ScriptSchema = z.object({ logo: z.string().url().nullable(), config_path: z.string(), description: z.string().min(1, "Description is required"), + disable: z.boolean().optional(), + disable_description: z.string().optional(), install_methods: z.array(InstallMethodSchema).min(1, "At least one install method is required"), default_credentials: z.object({ username: z.string().nullable(), password: z.string().nullable(), }), notes: z.array(NoteSchema), +}).refine((data) => { + if (data.disable === true && !data.disable_description) { + return false; + } + return true; +}, { + message: "disable_description is required when disable is true", + path: ["disable_description"], }); export type Script = z.infer; diff --git a/frontend/src/app/json-editor/page.tsx b/frontend/src/app/json-editor/page.tsx index 351750282..748d864c9 100644 --- a/frontend/src/app/json-editor/page.tsx +++ b/frontend/src/app/json-editor/page.tsx @@ -42,6 +42,8 @@ const initialScript: Script = { website: null, logo: null, description: "", + disable: undefined, + disable_description: undefined, install_methods: [], default_credentials: { username: null, @@ -261,7 +263,25 @@ export default function JSONGenerator() { updateScript("privileged", checked)} /> +
+ updateScript("disable", checked)} /> + +
+ {script.disable && ( +
+ +