mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-27 08:54:42 +03:00
* Bump the web-minor-patch group across 1 directory with 24 updates Bumps the web-minor-patch group with 24 updates in the /web directory: | Package | From | To | | --- | --- | --- | | [framer-motion](https://github.com/motiondivision/motion) | `14.0.0` | `14.4.0` | | [i18next](https://github.com/i18next/i18next) | `26.4.2` | `26.5.3` | | [i18next-http-backend](https://github.com/i18next/i18next-http-backend) | `4.0.2` | `4.0.4` | | [js-yaml](https://github.com/nodeca/js-yaml) | `5.4.3` | `5.5.0` | | [konva](https://github.com/konvajs/konva) | `10.7.1` | `10.9.0` | | [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) | `1.52.0` | `1.60.0` | | [react](https://github.com/react/react/tree/HEAD/packages/react) | `19.3.0` | `19.3.1` | | [react-dom](https://github.com/react/react/tree/HEAD/packages/react-dom) | `19.3.0` | `19.3.1` | | [react-dropzone](https://github.com/react-dropzone/react-dropzone) | `20.1.2` | `20.1.4` | | [react-hook-form](https://github.com/react-hook-form/react-hook-form) | `7.89.0` | `7.90.0` | | [react-i18next](https://github.com/i18next/react-i18next) | `17.0.16` | `17.1.0` | | [react-konva](https://github.com/konvajs/react-konva) | `19.3.0` | `19.3.2` | | [tailwind-merge](https://github.com/dcastil/tailwind-merge/tree/HEAD/packages/tailwind-merge) | `2.4.0` | `2.6.1` | | [virtua](https://github.com/inokawa/virtua) | `0.53.3` | `0.53.5` | | [@playwright/test](https://github.com/microsoft/playwright) | `1.64.0` | `1.64.1` | | [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) | `4.17.25` | `4.17.26` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.4` | `26.6.5` | | [eslint](https://github.com/eslint/eslint) | `10.12.0` | `10.13.0` | | [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | `5.5.6` | `5.5.7` | | [monaco-editor](https://github.com/microsoft/monaco-editor) | `0.52.2` | `0.53.0` | | [postcss](https://github.com/postcss/postcss) | `8.5.29` | `8.5.31` | | [prettier](https://github.com/prettier/prettier) | `3.9.9` | `3.9.10` | | [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.71.1` | `8.72.0` | | [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `8.3.3` | `8.3.4` | Updates `framer-motion` from 14.0.0 to 14.4.0 - [Changelog](https://github.com/motiondivision/motion/blob/main/CHANGELOG.md) - [Commits](https://github.com/motiondivision/motion/compare/v14.0.0...v14.4.0) Updates `i18next` from 26.4.2 to 26.5.3 - [Release notes](https://github.com/i18next/i18next/releases) - [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/i18next/compare/v26.4.2...v26.5.3) Updates `i18next-http-backend` from 4.0.2 to 4.0.4 - [Changelog](https://github.com/i18next/i18next-http-backend/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/i18next-http-backend/compare/v4.0.2...v4.0.4) Updates `js-yaml` from 5.4.3 to 5.5.0 - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/5.4.3...5.5.0) Updates `konva` from 10.7.1 to 10.9.0 - [Release notes](https://github.com/konvajs/konva/releases) - [Changelog](https://github.com/konvajs/konva/blob/master/CHANGELOG.md) - [Commits](https://github.com/konvajs/konva/compare/10.7.1...10.9.0) Updates `lucide-react` from 1.52.0 to 1.60.0 - [Release notes](https://github.com/lucide-icons/lucide/releases) - [Commits](https://github.com/lucide-icons/lucide/commits/1.60.0/packages/lucide-react) Updates `react` from 19.3.0 to 19.3.1 - [Release notes](https://github.com/react/react/releases) - [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/react/react/commits/v19.3.1/packages/react) Updates `react-dom` from 19.3.0 to 19.3.1 - [Release notes](https://github.com/react/react/releases) - [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/react/react/commits/v19.3.1/packages/react-dom) Updates `react-dropzone` from 20.1.2 to 20.1.4 - [Release notes](https://github.com/react-dropzone/react-dropzone/releases) - [Commits](https://github.com/react-dropzone/react-dropzone/compare/v20.1.2...v20.1.4) Updates `react-hook-form` from 7.89.0 to 7.90.0 - [Release notes](https://github.com/react-hook-form/react-hook-form/releases) - [Changelog](https://github.com/react-hook-form/react-hook-form/blob/master/CHANGELOG.md) - [Commits](https://github.com/react-hook-form/react-hook-form/compare/v7.89.0...v7.90.0) Updates `react-i18next` from 17.0.16 to 17.1.0 - [Changelog](https://github.com/i18next/react-i18next/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/react-i18next/compare/v17.0.16...v17.1.0) Updates `react-konva` from 19.3.0 to 19.3.2 - [Release notes](https://github.com/konvajs/react-konva/releases) - [Changelog](https://github.com/konvajs/react-konva/blob/master/RELEASE_NOTES.md) - [Commits](https://github.com/konvajs/react-konva/compare/v19.3.0...v19.3.2) Updates `tailwind-merge` from 2.4.0 to 2.6.1 - [Release notes](https://github.com/dcastil/tailwind-merge/releases) - [Commits](https://github.com/dcastil/tailwind-merge/commits/v2.6.1/packages/tailwind-merge) Updates `virtua` from 0.53.3 to 0.53.5 - [Release notes](https://github.com/inokawa/virtua/releases) - [Commits](https://github.com/inokawa/virtua/compare/0.53.3...0.53.5) Updates `@playwright/test` from 1.64.0 to 1.64.1 - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.64.0...v1.64.1) Updates `@types/lodash` from 4.17.25 to 4.17.26 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash) Updates `@types/node` from 26.6.4 to 26.6.5 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `eslint` from 10.12.0 to 10.13.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Commits](https://github.com/eslint/eslint/compare/v10.12.0...v10.13.0) Updates `eslint-plugin-prettier` from 5.5.6 to 5.5.7 - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases) - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.5.6...v5.5.7) Updates `monaco-editor` from 0.52.2 to 0.53.0 - [Release notes](https://github.com/microsoft/monaco-editor/releases) - [Changelog](https://github.com/microsoft/monaco-editor/blob/main/CHANGELOG.md) - [Commits](https://github.com/microsoft/monaco-editor/compare/v0.52.2...v0.53.0) Updates `postcss` from 8.5.29 to 8.5.31 - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/8.5.29...8.5.31) Updates `prettier` from 3.9.9 to 3.9.10 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.9.9...3.9.10) Updates `typescript-eslint` from 8.71.1 to 8.72.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.72.0/packages/typescript-eslint) Updates `vite` from 8.3.3 to 8.3.4 - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v8.3.4/packages/vite) --- updated-dependencies: - dependency-name: framer-motion dependency-version: 14.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: i18next dependency-version: 26.5.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: i18next-http-backend dependency-version: 4.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: js-yaml dependency-version: 5.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: konva dependency-version: 10.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: lucide-react dependency-version: 1.60.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: react dependency-version: 19.3.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: react-dom dependency-version: 19.3.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: react-dropzone dependency-version: 20.1.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: react-hook-form dependency-version: 7.90.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: react-i18next dependency-version: 17.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: react-konva dependency-version: 19.3.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: tailwind-merge dependency-version: 2.6.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: virtua dependency-version: 0.53.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: "@playwright/test" dependency-version: 1.64.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: "@types/lodash" dependency-version: 4.17.26 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: "@types/node" dependency-version: 26.6.5 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: eslint dependency-version: 10.13.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: eslint-plugin-prettier dependency-version: 5.5.7 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: monaco-editor dependency-version: 0.53.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: postcss dependency-version: 8.5.31 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: prettier dependency-version: 3.9.10 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch - dependency-name: typescript-eslint dependency-version: 8.72.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: web-minor-patch - dependency-name: vite dependency-version: 8.3.4 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: web-minor-patch ... Signed-off-by: dependabot[bot] <support@github.com> * keep monaco's textarea input in the config editor monaco-editor 0.53 focuses EditContext's host div, which the command menu doesn't treat as a text field, so typing "/" or Ctrl+K in the config editor opened the command menu. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
335 lines
10 KiB
TypeScript
335 lines
10 KiB
TypeScript
import useSWR from "swr";
|
|
import * as monaco from "monaco-editor";
|
|
import { configureMonacoYaml } from "monaco-yaml";
|
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
import { useApiHost } from "@/api";
|
|
import Heading from "@/components/ui/heading";
|
|
import ActivityIndicator from "@/components/indicators/activity-indicator";
|
|
import { Button } from "@/components/ui/button";
|
|
import axios, { AxiosError } from "axios";
|
|
import copy from "copy-to-clipboard";
|
|
import { useTheme } from "@/context/theme-provider";
|
|
import { Toaster } from "@/components/ui/sonner";
|
|
import { toast } from "sonner";
|
|
import { LuCopy, LuSave } from "react-icons/lu";
|
|
import { MdOutlineRestartAlt } from "react-icons/md";
|
|
import RestartDialog from "@/components/overlay/dialog/RestartDialog";
|
|
import { useTranslation } from "react-i18next";
|
|
import { useRestart } from "@/api/ws";
|
|
import { useResizeObserver } from "@/hooks/resize-observer";
|
|
import { FrigateConfig } from "@/types/frigateConfig";
|
|
|
|
type SaveOptions = "saveonly" | "restart";
|
|
|
|
type ApiErrorResponse = {
|
|
message?: string;
|
|
detail?: string;
|
|
};
|
|
|
|
function ConfigEditor() {
|
|
const { t } = useTranslation(["views/configEditor"]);
|
|
const apiHost = useApiHost();
|
|
|
|
useEffect(() => {
|
|
document.title = t("documentTitle");
|
|
}, [t]);
|
|
|
|
const { data: config } = useSWR<FrigateConfig>("config", {
|
|
revalidateOnFocus: false,
|
|
});
|
|
const { data: rawConfig } = useSWR<string>("config/raw");
|
|
|
|
const { theme, systemTheme } = useTheme();
|
|
const [error, setError] = useState<string | undefined>();
|
|
|
|
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor | null>(null);
|
|
const modelRef = useRef<monaco.editor.ITextModel | null>(null);
|
|
const configRef = useRef<HTMLDivElement | null>(null);
|
|
const schemaConfiguredRef = useRef(false);
|
|
|
|
const [restartDialogOpen, setRestartDialogOpen] = useState(false);
|
|
const { send: sendRestart } = useRestart();
|
|
const initialValidationRef = useRef(false);
|
|
|
|
const onHandleSaveConfig = useCallback(
|
|
async (save_option: SaveOptions): Promise<void> => {
|
|
if (!editorRef.current) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const response = await axios.post(
|
|
`config/save?save_option=${save_option}`,
|
|
editorRef.current.getValue(),
|
|
{
|
|
headers: { "Content-Type": "text/plain" },
|
|
},
|
|
);
|
|
|
|
if (response.status === 200) {
|
|
setError("");
|
|
setHasChanges(false);
|
|
toast.success(response.data.message, { position: "top-center" });
|
|
}
|
|
} catch (error) {
|
|
toast.error(t("toast.error.savingError"), { position: "top-center" });
|
|
|
|
const axiosError = error as AxiosError<ApiErrorResponse>;
|
|
const errorMessage =
|
|
axiosError.response?.data?.message ||
|
|
axiosError.response?.data?.detail ||
|
|
"Unknown error";
|
|
|
|
setError(errorMessage);
|
|
throw new Error(errorMessage, { cause: error });
|
|
}
|
|
},
|
|
[editorRef, t],
|
|
);
|
|
|
|
const handleCopyConfig = useCallback(async () => {
|
|
if (!editorRef.current) {
|
|
return;
|
|
}
|
|
|
|
copy(editorRef.current.getValue());
|
|
toast.success(t("toast.success.copyToClipboard"), {
|
|
position: "top-center",
|
|
});
|
|
}, [editorRef, t]);
|
|
|
|
const handleSaveAndRestart = useCallback(async () => {
|
|
try {
|
|
await onHandleSaveConfig("saveonly");
|
|
setRestartDialogOpen(true);
|
|
} catch {
|
|
// If save fails, error is already set in onHandleSaveConfig, no dialog opens
|
|
}
|
|
}, [onHandleSaveConfig]);
|
|
|
|
useEffect(() => {
|
|
if (!rawConfig) {
|
|
return;
|
|
}
|
|
|
|
const modelUri = monaco.Uri.parse(
|
|
`a://b/api/config/schema_${Date.now()}.json`,
|
|
);
|
|
|
|
// Configure Monaco YAML schema only once
|
|
if (!schemaConfiguredRef.current) {
|
|
configureMonacoYaml(monaco, {
|
|
enableSchemaRequest: true,
|
|
hover: true,
|
|
completion: true,
|
|
validate: true,
|
|
format: { enable: true },
|
|
schemas: [
|
|
{
|
|
uri: `${apiHost}api/config/schema.json`,
|
|
fileMatch: [String(modelUri)],
|
|
},
|
|
],
|
|
});
|
|
schemaConfiguredRef.current = true;
|
|
}
|
|
|
|
if (!modelRef.current) {
|
|
modelRef.current = monaco.editor.createModel(rawConfig, "yaml", modelUri);
|
|
} else {
|
|
modelRef.current.setValue(rawConfig);
|
|
}
|
|
|
|
const container = configRef.current;
|
|
|
|
if (container && !editorRef.current) {
|
|
editorRef.current = monaco.editor.create(container, {
|
|
language: "yaml",
|
|
model: modelRef.current,
|
|
scrollBeyondLastLine: false,
|
|
// Keep the textarea input. CommandMenu doesn't treat EditContext's
|
|
// host div as a text field, so "/" would open the menu.
|
|
editContext: false,
|
|
theme: (systemTheme || theme) == "dark" ? "vs-dark" : "vs-light",
|
|
});
|
|
editorRef.current?.addCommand(
|
|
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS,
|
|
() => {
|
|
onHandleSaveConfig("saveonly");
|
|
},
|
|
);
|
|
} else if (editorRef.current) {
|
|
editorRef.current.setModel(modelRef.current);
|
|
}
|
|
|
|
return () => {
|
|
if (editorRef.current) {
|
|
editorRef.current.dispose();
|
|
editorRef.current = null;
|
|
}
|
|
if (modelRef.current) {
|
|
modelRef.current.dispose();
|
|
modelRef.current = null;
|
|
}
|
|
schemaConfiguredRef.current = false;
|
|
};
|
|
}, [rawConfig, apiHost, systemTheme, theme, onHandleSaveConfig]);
|
|
|
|
// when in safe mode, attempt to validate the existing (invalid) config immediately
|
|
// so that the user sees the validation errors without needing to press save
|
|
useEffect(() => {
|
|
if (
|
|
config?.safe_mode &&
|
|
rawConfig &&
|
|
!initialValidationRef.current &&
|
|
!error
|
|
) {
|
|
initialValidationRef.current = true;
|
|
axios
|
|
.post(`config/save?save_option=saveonly`, rawConfig, {
|
|
headers: { "Content-Type": "text/plain" },
|
|
})
|
|
.then(() => {
|
|
// if this succeeds while in safe mode, we won't force any UI change
|
|
})
|
|
.catch((e: AxiosError<ApiErrorResponse>) => {
|
|
const errorMessage =
|
|
e.response?.data?.message ||
|
|
e.response?.data?.detail ||
|
|
"Unknown error";
|
|
setError(errorMessage);
|
|
});
|
|
}
|
|
}, [config?.safe_mode, rawConfig, error]);
|
|
|
|
// monitoring state
|
|
|
|
const [hasChanges, setHasChanges] = useState(false);
|
|
|
|
useEffect(() => {
|
|
if (!rawConfig || !modelRef.current) {
|
|
return;
|
|
}
|
|
|
|
modelRef.current.onDidChangeContent(() => {
|
|
if (modelRef.current?.getValue() != rawConfig) {
|
|
setHasChanges(true);
|
|
} else {
|
|
setHasChanges(false);
|
|
}
|
|
});
|
|
}, [rawConfig]);
|
|
|
|
useEffect(() => {
|
|
if (rawConfig && modelRef.current) {
|
|
modelRef.current.setValue(rawConfig);
|
|
setHasChanges(false);
|
|
}
|
|
}, [rawConfig]);
|
|
|
|
useEffect(() => {
|
|
let listener: ((e: BeforeUnloadEvent) => void) | undefined;
|
|
if (hasChanges) {
|
|
listener = (e) => {
|
|
e.preventDefault();
|
|
e.returnValue = true;
|
|
return t("confirm");
|
|
};
|
|
window.addEventListener("beforeunload", listener);
|
|
}
|
|
|
|
return () => {
|
|
if (listener) {
|
|
window.removeEventListener("beforeunload", listener);
|
|
}
|
|
};
|
|
}, [hasChanges, t]);
|
|
|
|
// layout change handler
|
|
|
|
const [{ width, height }] = useResizeObserver(configRef);
|
|
|
|
useEffect(() => {
|
|
if (editorRef.current) {
|
|
// Small delay to ensure DOM has updated
|
|
const timeoutId = setTimeout(() => {
|
|
editorRef.current?.layout();
|
|
}, 0);
|
|
|
|
return () => clearTimeout(timeoutId);
|
|
}
|
|
}, [error, width, height]);
|
|
|
|
if (!rawConfig) {
|
|
return <ActivityIndicator />;
|
|
}
|
|
|
|
return (
|
|
<div className="absolute bottom-2 left-0 right-0 top-2 md:left-2">
|
|
<div className="relative flex h-full flex-col overflow-hidden">
|
|
<div className="mr-1 flex items-center justify-between">
|
|
<div>
|
|
<Heading as="h2" className="mb-0 ml-1 md:ml-0">
|
|
{t(config?.safe_mode ? "safeConfigEditor" : "configEditor")}
|
|
</Heading>
|
|
{config?.safe_mode && (
|
|
<div className="text-sm text-secondary-foreground">
|
|
{t("safeModeDescription")}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<div className="flex flex-row gap-1">
|
|
<Button
|
|
size="sm"
|
|
className="flex items-center gap-2"
|
|
aria-label={t("copyConfig")}
|
|
onClick={() => handleCopyConfig()}
|
|
>
|
|
<LuCopy className="text-secondary-foreground" />
|
|
<span className="hidden md:block">{t("copyConfig")}</span>
|
|
</Button>
|
|
<Button
|
|
size="sm"
|
|
className="flex items-center gap-2"
|
|
aria-label={t("saveAndRestart")}
|
|
onClick={handleSaveAndRestart}
|
|
>
|
|
<div className="relative size-5">
|
|
<LuSave className="absolute left-0 top-0 size-3 text-secondary-foreground" />
|
|
<MdOutlineRestartAlt className="absolute size-4 translate-x-1 translate-y-1/2 text-secondary-foreground" />
|
|
</div>
|
|
<span className="hidden md:block">{t("saveAndRestart")}</span>
|
|
</Button>
|
|
<Button
|
|
size="sm"
|
|
className="flex items-center gap-2"
|
|
aria-label={t("saveOnly")}
|
|
onClick={() => onHandleSaveConfig("saveonly")}
|
|
>
|
|
<LuSave className="text-secondary-foreground" />
|
|
<span className="hidden md:block">{t("saveOnly")}</span>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-2 flex flex-1 flex-col overflow-hidden">
|
|
{error && (
|
|
<div className="mt-2 max-h-[30%] min-h-[2.5rem] overflow-auto whitespace-pre-wrap border-2 border-muted bg-background_alt p-4 text-sm text-danger md:max-h-[40%]">
|
|
{error}
|
|
</div>
|
|
)}
|
|
<div ref={configRef} className="flex-1 overflow-hidden" />
|
|
</div>
|
|
</div>
|
|
<Toaster closeButton={true} />
|
|
<RestartDialog
|
|
isOpen={restartDialogOpen}
|
|
onClose={() => setRestartDialogOpen(false)}
|
|
onRestart={() => sendRestart("restart")}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default ConfigEditor;
|