Add retention policy option regression coverage
This commit is contained in:
@@ -21,6 +21,7 @@ import FormField from "../../components/FormField";
|
||||
import ToggleSwitch from "../../components/ToggleSwitch";
|
||||
import { useUnsavedDraftGuard } from "../../components/UnsavedChangesGuard";
|
||||
import {
|
||||
privacyRetentionAuditDetailOptionDisabled,
|
||||
privacyRetentionLocalAllowsLowerLevel,
|
||||
privacyRetentionParentAllowsField } from
|
||||
"./policyLogic";
|
||||
@@ -70,8 +71,6 @@ type FieldDefinition = {
|
||||
type RawJsonValue = "inherit" | "keep" | "disable";
|
||||
type AuditDetailValue = "inherit" | PrivacyRetentionPolicy["audit_detail_level"];
|
||||
|
||||
const auditDetailOrder: Record<PrivacyRetentionPolicy["audit_detail_level"], number> = { full: 0, redacted: 1, minimal: 2 };
|
||||
|
||||
const defaultAllowLowerLevelLimits: PrivacyRetentionLimitPermissions = {
|
||||
store_raw_campaign_json: true,
|
||||
raw_campaign_json_retention_days: true,
|
||||
@@ -517,9 +516,8 @@ function RetentionDaysField({ value, disabled, placeholder, max, onChange }: {va
|
||||
}
|
||||
|
||||
function AuditDetailSelect({ value, includeInherit, parentValue, disabled, onChange }: {value: AuditDetailValue;includeInherit: boolean;parentValue?: PrivacyRetentionPolicy["audit_detail_level"] | null;disabled: boolean;onChange: (value: AuditDetailValue) => void;}) {
|
||||
const minimumOrder = parentValue ? auditDetailOrder[parentValue] : 0;
|
||||
function optionDisabled(option: PrivacyRetentionPolicy["audit_detail_level"]): boolean {
|
||||
return auditDetailOrder[option] < minimumOrder;
|
||||
return privacyRetentionAuditDetailOptionDisabled(option, parentValue);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user