♻️ mark forms as readonly

This commit is contained in:
Fred KISSIE
2026-03-11 03:47:15 +01:00
parent 9a680d2374
commit a22a4b6e74
3 changed files with 38 additions and 8 deletions

View File

@@ -242,7 +242,7 @@ export function EditPolicyAuthMethodsSectionForm({
</SettingsSectionDescription>
</SettingsSectionHeader>
<SettingsSectionBody>
{!readonly && (
{!readonly ? (
<Button
type="button"
variant="outline"
@@ -251,6 +251,10 @@ export function EditPolicyAuthMethodsSectionForm({
<Plus className="mr-2 h-4 w-4" />
{t("resourcePolicyAuthMethodAdd")}
</Button>
) : (
<div className="text-muted-foreground flex items-center h-full size-full bg-muted rounded-md px-8 py-6 border-dashed text-sm">
<p>{t("resourcePolicyAuthMethodsEmpty")}</p>
</div>
)}
</SettingsSectionBody>
</SettingsSection>

View File

@@ -144,7 +144,7 @@ export function EditPolicyOtpEmailSectionForm({
</SettingsSectionDescription>
</SettingsSectionHeader>
<SettingsSectionBody>
{!readonly && (
{!readonly ? (
<Button
type="button"
variant="outline"
@@ -153,6 +153,10 @@ export function EditPolicyOtpEmailSectionForm({
<Plus className="mr-2 h-4 w-4" />
{t("resourcePolicyOtpEmailAdd")}
</Button>
) : (
<div className="text-muted-foreground flex items-center h-full size-full bg-muted rounded-md px-8 py-6 border-dashed text-sm">
<p>{t("resourcePolicyOtpEmpty")}</p>
</div>
)}
</SettingsSectionBody>
</SettingsSection>

View File

@@ -701,7 +701,7 @@ export function EditPolicyRulesSectionForm({
</SettingsSectionDescription>
</SettingsSectionHeader>
<SettingsSectionBody>
{!readonly && (
{!readonly ? (
<Button
type="button"
variant="outline"
@@ -710,6 +710,10 @@ export function EditPolicyRulesSectionForm({
<Plus className="mr-2 h-4 w-4" />
{t("resourcePolicyRulesAdd")}
</Button>
) : (
<div className="text-muted-foreground flex items-center h-full size-full bg-muted rounded-md px-8 py-6 border-dashed text-sm">
<p>{t("resourcePolicyRulesEmpty")}</p>
</div>
)}
</SettingsSectionBody>
</SettingsSection>
@@ -757,7 +761,10 @@ export function EditPolicyRulesSectionForm({
<FormControl>
<Select
value={field.value}
disabled={readonly || !rulesEnabled}
disabled={
readonly ||
!rulesEnabled
}
onValueChange={
field.onChange
}
@@ -793,7 +800,10 @@ export function EditPolicyRulesSectionForm({
<FormControl>
<Select
value={field.value}
disabled={readonly || !rulesEnabled}
disabled={
readonly ||
!rulesEnabled
}
onValueChange={
field.onChange
}
@@ -860,7 +870,10 @@ export function EditPolicyRulesSectionForm({
<Button
variant="outline"
role="combobox"
disabled={readonly || !rulesEnabled}
disabled={
readonly ||
!rulesEnabled
}
aria-expanded={
openAddRuleCountrySelect
}
@@ -950,7 +963,10 @@ export function EditPolicyRulesSectionForm({
<Button
variant="outline"
role="combobox"
disabled={readonly || !rulesEnabled}
disabled={
readonly ||
!rulesEnabled
}
aria-expanded={
openAddRuleAsnSelect
}
@@ -1063,7 +1079,13 @@ export function EditPolicyRulesSectionForm({
</PopoverContent>
</Popover>
) : (
<Input {...field} disabled={readonly || !rulesEnabled} />
<Input
{...field}
disabled={
readonly ||
!rulesEnabled
}
/>
)}
</FormControl>
<FormMessage />