mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
fix: Duplicate template options (#51)
* fix: Duplicate template options * fix: form option i18n text
This commit is contained in:
@@ -81,7 +81,7 @@ export default function AlertRulePage() {
|
||||
{
|
||||
header: t("TriggerMode"),
|
||||
accessorKey: "trigger Mode",
|
||||
accessorFn: (row) => triggerModes[row.trigger_mode] || "",
|
||||
accessorFn: (row) => triggerModes(t)[row.trigger_mode] || "",
|
||||
},
|
||||
{
|
||||
header: t("Rules"),
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ export default function CronPage() {
|
||||
{
|
||||
header: t("Type"),
|
||||
accessorKey: "taskType",
|
||||
accessorFn: (row) => cronTypes[row.task_type] || "",
|
||||
accessorFn: (row) => cronTypes(t)[row.task_type] || "",
|
||||
},
|
||||
{
|
||||
header: t("CronExpression"),
|
||||
|
||||
+1
-87
@@ -248,92 +248,6 @@ export default function SettingsPage() {
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="user_template"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("Theme")}</FormLabel>
|
||||
<FormControl>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={(value) => {
|
||||
const template = config?.frontend_templates?.find(
|
||||
(t) => t.path === value,
|
||||
)
|
||||
if (template) {
|
||||
form.setValue(
|
||||
"user_template",
|
||||
template.path ?? "",
|
||||
)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder={t("SelectTheme")} />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{(
|
||||
config?.frontend_templates?.filter(
|
||||
(t) => !t.is_admin,
|
||||
) || []
|
||||
).map((template) => (
|
||||
<div key={template.path}>
|
||||
<SelectItem value={template.path!}>
|
||||
<div className="flex flex-col items-start gap-1">
|
||||
<div className="font-medium">
|
||||
{template.name}
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<span>
|
||||
{t("Author")}:{" "}
|
||||
{template.author}
|
||||
</span>
|
||||
{!template.is_official ? (
|
||||
<span className="px-1.5 py-0.5 rounded-md bg-red-100 text-red-800 text-xs">
|
||||
{t("Community")}
|
||||
</span>
|
||||
) : (
|
||||
<span className="px-1.5 py-0.5 rounded-md bg-blue-100 text-blue-800 text-xs">
|
||||
{t("Official")}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</SelectItem>
|
||||
<div className="px-8 py-1">
|
||||
<a
|
||||
href={template.repository}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-sm text-blue-600 hover:text-blue-800 hover:underline"
|
||||
>
|
||||
{template.repository}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
{!config?.frontend_templates?.find(
|
||||
(t) => t.path === field.value,
|
||||
)?.is_official && (
|
||||
<div className="mt-2 text-sm text-yellow-700 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-900 border border-yellow-200 dark:border-yellow-700 rounded-md p-2">
|
||||
<div className="font-medium text-lg mb-1">
|
||||
{t("CommunityThemeWarning")}
|
||||
</div>
|
||||
<div className="text-yellow-700 dark:text-yellow-200">
|
||||
{t("CommunityThemeDescription")}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="custom_code"
|
||||
@@ -469,7 +383,7 @@ export default function SettingsPage() {
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
{Object.entries(
|
||||
settingCoverageTypes,
|
||||
settingCoverageTypes(t),
|
||||
).map(([k, v]) => (
|
||||
<SelectItem key={k} value={k}>
|
||||
{v}
|
||||
|
||||
+3
-1
@@ -69,7 +69,9 @@ export default function WAFPage() {
|
||||
header: t("LastBlockReason"),
|
||||
accessorKey: "lastBlockReason",
|
||||
accessorFn: (row) => row.last_block_reason,
|
||||
cell: ({ row }) => <span>{wafBlockReasons[row.original.last_block_reason] || ""}</span>,
|
||||
cell: ({ row }) => (
|
||||
<span>{wafBlockReasons(t)[row.original.last_block_reason] || ""}</span>
|
||||
),
|
||||
},
|
||||
{
|
||||
header: t("LastBlockTime"),
|
||||
|
||||
Reference in New Issue
Block a user