diff --git a/webui/src/features/mail/MailProfileManagement.tsx b/webui/src/features/mail/MailProfileManagement.tsx
index 1cbf19c..518b560 100644
--- a/webui/src/features/mail/MailProfileManagement.tsx
+++ b/webui/src/features/mail/MailProfileManagement.tsx
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState, type ReactNode } from "react";
-import { ConnectionTree, FieldLabel, LoadingFrame, MailServerSettingsPanel, PolicyLockedHint, PolicyRow, PolicySourcePath, PolicyTable, ToggleSwitch, hasMailImapSettings, mailImapSettingsPayload, mailServerSecurityOptions, mailSmtpSettingsPayload, mailTextOrNull, mailTransportCredentialsPayload, mergeDeltaRows, normalizeMailServerSecurity, useDeltaWatermarks, type ConnectionTreeColumn, type MailServerConnectionTestResult, type MailServerCredentialSettings, type MailServerFolderLookupResult, type MailServerImapSettings, type MailServerSmtpSettings, type PolicySourcePathItem } from "@govoplan/core-webui";
+import { ConnectionTree, FieldLabel, LoadingFrame, MailServerSettingsPanel, PolicyLockedHint, PolicyPathHelp, PolicyRow, PolicySourcePath, PolicyTable, ToggleSwitch, hasMailImapSettings, mailImapSettingsPayload, mailServerSecurityOptions, mailSmtpSettingsPayload, mailTextOrNull, mailTransportCredentialsPayload, mergeDeltaRows, normalizeMailServerSecurity, normalizePolicySourcePathItems, useDeltaWatermarks, type ConnectionTreeColumn, type MailServerConnectionTestResult, type MailServerCredentialSettings, type MailServerFolderLookupResult, type MailServerImapSettings, type MailServerSmtpSettings, type NormalizedPolicySourcePathItem, type PolicySourcePathItem } from "@govoplan/core-webui";
import { Pencil, Plus, Trash2 } from "lucide-react";
import type { ApiSettings } from "../../types";
import {
@@ -1280,28 +1280,15 @@ function policyHelp(description: string): ReactNode {
return {description};
}
-type PolicySourceItem = {
- label: string;
- policy?: MailProfilePolicy | Record | null;
-};
-
function mailBooleanPolicyPathHelp(key: "allow_user_profiles" | "allow_group_profiles" | "allow_campaign_profiles", sources: PolicySourcePathItem[]): ReactNode {
- return ;
+ return ;
}
function mailCredentialPolicyPathHelp(protocol: "smtp_credentials" | "imap_credentials", sources: PolicySourcePathItem[]): ReactNode {
- return ;
+ return ;
}
-function PolicyPathHelp({ lines }: {lines: string[];}) {
- return (
-
- {lines.map((line, index) => {line})}
- );
-
-}
-
-function mailBooleanPolicyPathLines(key: "allow_user_profiles" | "allow_group_profiles" | "allow_campaign_profiles", items: PolicySourceItem[]): string[] {
+function mailBooleanPolicyPathLines(key: "allow_user_profiles" | "allow_group_profiles" | "allow_campaign_profiles", items: NormalizedPolicySourcePathItem[]): string[] {
if (items.length === 0) return ["i18n:govoplan-mail.system_allow.ed6744b1"];
const lines: string[] = [];
for (const [index, item] of items.entries()) {
@@ -1316,7 +1303,7 @@ function mailBooleanPolicyPathLines(key: "allow_user_profiles" | "allow_group_pr
return lines;
}
-function mailCredentialPolicyPathLines(protocol: "smtp_credentials" | "imap_credentials", items: PolicySourceItem[]): string[] {
+function mailCredentialPolicyPathLines(protocol: "smtp_credentials" | "imap_credentials", items: NormalizedPolicySourcePathItem[]): string[] {
if (items.length === 0) return ["i18n:govoplan-mail.system_profile_inherited.f4b8b5ce"];
const lines: string[] = [];
for (const [index, item] of items.entries()) {
@@ -1331,14 +1318,7 @@ function mailCredentialPolicyPathLines(protocol: "smtp_credentials" | "imap_cred
return lines;
}
-function normalizePolicySourceItems(items: PolicySourcePathItem[]): PolicySourceItem[] {
- return items.map((item) => {
- if (typeof item === "string") return { label: item };
- return { label: item.label, policy: item.policy };
- }).filter((item) => item.label.trim());
-}
-
-function policySourceRecord(item: PolicySourceItem): Record {
+function policySourceRecord(item: NormalizedPolicySourcePathItem): Record {
return asRecord(item.policy);
}