introduce config path to json
This commit is contained in:
parent
de12da037c
commit
79fd16a339
@ -9,6 +9,7 @@
|
||||
"updateable": false,
|
||||
"privileged": false,
|
||||
"interface_port": 80,
|
||||
"config_path": "/opt/librenms/config.php",
|
||||
"documentation": "https://docs.librenms.org/",
|
||||
"website": "https://librenms.org/",
|
||||
"logo": "https://raw.githubusercontent.com/selfhst/icons/refs/heads/main/svg/librenms.svg",
|
||||
@ -31,4 +32,4 @@
|
||||
"password": null
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ export const ScriptSchema = z.object({
|
||||
website: z.string().url().nullable(),
|
||||
logo: z.string().url().nullable(),
|
||||
description: z.string().min(1, "Description is required"),
|
||||
config_path: z.string(),
|
||||
install_methods: z.array(InstallMethodSchema).min(1, "At least one install method is required"),
|
||||
default_credentials: z.object({
|
||||
username: z.string().nullable(),
|
||||
|
@ -32,6 +32,7 @@ const initialScript: Script = {
|
||||
privileged: false,
|
||||
interface_port: null,
|
||||
documentation: null,
|
||||
config_path: "",
|
||||
website: null,
|
||||
logo: null,
|
||||
description: "",
|
||||
@ -184,6 +185,14 @@ export default function JSONGenerator() {
|
||||
onChange={(e) => updateScript("description", e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label>Config Path</Label>
|
||||
<Input
|
||||
placeholder="Path to config file"
|
||||
value={script.config_path || ""}
|
||||
onChange={(e) => updateScript("config_path", e.target.value || null)}
|
||||
/>
|
||||
</div>
|
||||
<Categories script={script} setScript={setScript} categories={categories} />
|
||||
<div className="flex gap-2">
|
||||
<div className="flex flex-col gap-2 w-full">
|
||||
|
@ -18,9 +18,11 @@ import Buttons from "./ScriptItems/Buttons";
|
||||
import DefaultPassword from "./ScriptItems/DefaultPassword";
|
||||
import Description from "./ScriptItems/Description";
|
||||
import InstallCommand from "./ScriptItems/InstallCommand";
|
||||
import ConfigFile from "./ScriptItems/ConfigFile";
|
||||
import InterFaces from "./ScriptItems/InterFaces";
|
||||
import Tooltips from "./ScriptItems/Tooltips";
|
||||
|
||||
|
||||
interface ScriptItemProps {
|
||||
item: Script;
|
||||
setSelectedScript: (script: string | null) => void;
|
||||
@ -141,6 +143,7 @@ export function ScriptItem({ item, setSelectedScript }: ScriptItemProps) {
|
||||
<Alerts item={item} />
|
||||
|
||||
<div className="mt-4 rounded-lg border shadow-sm">
|
||||
|
||||
<div className="flex gap-3 px-4 py-2 bg-accent/25">
|
||||
<h2 className="text-lg font-semibold">
|
||||
How to {item.type === "pve" ? "use" : item.type === "addon" ? "apply" : "install"}
|
||||
@ -151,6 +154,17 @@ export function ScriptItem({ item, setSelectedScript }: ScriptItemProps) {
|
||||
<div className="">
|
||||
<InstallCommand item={item} />
|
||||
</div>
|
||||
<Separator />
|
||||
<div className="flex gap-3 px-4 py-2 bg-accent/25">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Location of config file
|
||||
</h2>
|
||||
</div>
|
||||
<Separator />
|
||||
<div className="">
|
||||
<ConfigFile item={item} />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<DefaultPassword item={item} />
|
||||
|
@ -0,0 +1,10 @@
|
||||
import CodeCopyButton from "@/components/ui/code-copy-button";
|
||||
import { Script } from "@/lib/types";
|
||||
|
||||
export default function ConfigFile({ item }: { item: Script }) {
|
||||
return (
|
||||
<div className="px-4 pb-4">
|
||||
<CodeCopyButton>{item.config_path ? item.config_path : "No config path set"}</CodeCopyButton>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -13,6 +13,7 @@ export type Script = {
|
||||
website: string | null;
|
||||
logo: string | null;
|
||||
description: string;
|
||||
config_path: string | null;
|
||||
install_methods: {
|
||||
type: "default" | "alpine";
|
||||
script: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user