mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-09-19 09:40:13 +00:00
feat: server transfer rotation
This commit is contained in:
+12
-11
@@ -51,7 +51,7 @@ import { ModelServer } from "@/types"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { HelpCircle } from "lucide-react"
|
||||
import { useState } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useForm, useWatch } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
import { KeyedMutator } from "swr"
|
||||
@@ -94,7 +94,7 @@ const serverFormSchema = z.object({
|
||||
try {
|
||||
JSON.parse(val)
|
||||
return true
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
},
|
||||
@@ -120,6 +120,7 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
keepDefaultValues: false,
|
||||
},
|
||||
})
|
||||
const enableDDNS = useWatch({ control: form.control, name: "enable_ddns" })
|
||||
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
@@ -278,7 +279,7 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
{form.watch("enable_ddns") ? (
|
||||
{enableDDNS ? (
|
||||
<>
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -467,7 +468,7 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
?.startDate
|
||||
? new Date(
|
||||
publicNoteObj.billingDataMod!.startDate!,
|
||||
).toLocaleDateString()
|
||||
).toLocaleDateString()
|
||||
: "YYYY-MM-DD"}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
@@ -492,7 +493,7 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
?.startDate
|
||||
? new Date(
|
||||
publicNoteObj.billingDataMod!.startDate!,
|
||||
)
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
onSelect={(d) => {
|
||||
@@ -559,17 +560,17 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
{publicNoteObj.billingDataMod
|
||||
?.endDate
|
||||
? publicNoteObj
|
||||
.billingDataMod
|
||||
?.endDate ===
|
||||
.billingDataMod
|
||||
?.endDate ===
|
||||
"0000-00-00T23:59:59+08:00"
|
||||
? t(
|
||||
"PublicNote.NoExpiry",
|
||||
)
|
||||
"PublicNote.NoExpiry",
|
||||
)
|
||||
: new Date(
|
||||
publicNoteObj
|
||||
.billingDataMod
|
||||
?.endDate as string,
|
||||
).toLocaleDateString()
|
||||
).toLocaleDateString()
|
||||
: "YYYY-MM-DD"}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
@@ -600,7 +601,7 @@ export const ServerCard: React.FC<ServerCardProps> = ({ data, mutate }) => {
|
||||
publicNoteObj
|
||||
.billingDataMod
|
||||
?.endDate as string,
|
||||
)
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
onSelect={(d) => {
|
||||
|
||||
Reference in New Issue
Block a user