mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
fix: missing notification group input in settings (#24)
* fix: missing notification group input in settings * change script name * license * update settings api * improve: cell width * feat: site name
This commit is contained in:
@@ -34,7 +34,7 @@ export default function AlertRulePage() {
|
||||
toast(t("Error"), {
|
||||
description: t("Results.ErrorFetchingResource", { error: error.message }),
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [error]);
|
||||
|
||||
const columns: ColumnDef<ModelAlertRule>[] = [
|
||||
@@ -44,7 +44,7 @@ export default function AlertRulePage() {
|
||||
<Checkbox
|
||||
checked={
|
||||
table.getIsAllPageRowsSelected() ||
|
||||
(table.getIsSomePageRowsSelected() && "indeterminate")
|
||||
(table.getIsSomePageRowsSelected() && "indeterminate")
|
||||
}
|
||||
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
|
||||
aria-label="Select all"
|
||||
@@ -86,8 +86,10 @@ export default function AlertRulePage() {
|
||||
},
|
||||
{
|
||||
header: t("Rules"),
|
||||
accessorKey: "rules",
|
||||
accessorFn: (row) => JSON.stringify(row.rules),
|
||||
cell: ({ row }) => {
|
||||
const s = row.original;
|
||||
return <div className="max-w-48 whitespace-normal break-words">{JSON.stringify(s.rules)}</div>;
|
||||
},
|
||||
},
|
||||
{
|
||||
header: t("TasksToTriggerOnAlert"),
|
||||
|
||||
+9
-1
@@ -1,4 +1,5 @@
|
||||
import { Outlet } from "react-router-dom";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
@@ -6,9 +7,16 @@ import Header from "@/components/header";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
import useSetting from "@/hooks/useSetting";
|
||||
|
||||
export default function Root() {
|
||||
const { t } = useTranslation();
|
||||
const settings = useSetting();
|
||||
|
||||
useEffect(() => {
|
||||
document.title = settings?.site_name || "哪吒监控 Nezha Monitoring";
|
||||
}, [settings]);
|
||||
|
||||
return (
|
||||
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
||||
<Card className="text-sm max-w-7xl mx-auto mt-5 min-h-[90%] flex flex-col justify-between">
|
||||
@@ -17,7 +25,7 @@ export default function Root() {
|
||||
<Outlet />
|
||||
</div>
|
||||
<footer className="mx-5 pb-5 text-foreground/60 font-thin text-center">
|
||||
© 2019-2024 {t('nezha')}
|
||||
© 2019-2024 {t('nezha')} {settings?.version}
|
||||
</footer>
|
||||
</Card>
|
||||
<Toaster />
|
||||
|
||||
+33
-2
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { ModelConfig, settingCoverageTypes, nezhaLang } from "@/types";
|
||||
import { ModelSettingResponse, settingCoverageTypes, nezhaLang } from "@/types";
|
||||
import { SettingsTab } from "@/components/settings-tab";
|
||||
import { z } from "zod";
|
||||
import { asOptionalField } from "@/lib/utils";
|
||||
@@ -43,13 +43,14 @@ const settingFormSchema = z.object({
|
||||
custom_code_dashboard: asOptionalField(z.string()),
|
||||
real_ip_header: asOptionalField(z.string()),
|
||||
|
||||
tls: asOptionalField(z.boolean()),
|
||||
enable_ip_change_notification: asOptionalField(z.boolean()),
|
||||
enable_plain_ip_in_notification: asOptionalField(z.boolean()),
|
||||
});
|
||||
|
||||
export default function SettingsPage() {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [config, setConfig] = useState<ModelConfig>();
|
||||
const [config, setConfig] = useState<ModelSettingResponse>();
|
||||
const [error, setError] = useState<Error>();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -196,6 +197,23 @@ export default function SettingsPage() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="tls"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex items-center space-x-2">
|
||||
<FormControl>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox checked={field.value} onCheckedChange={field.onChange} />
|
||||
<Label className="text-sm">
|
||||
{t("ConfigTLS")}
|
||||
</Label>
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="custom_nameservers"
|
||||
@@ -280,6 +298,19 @@ export default function SettingsPage() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="ip_change_notification_group_id"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("NotifierGroupID")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="0" type="number" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="enable_ip_change_notification"
|
||||
|
||||
Reference in New Issue
Block a user