Migrate Tenancy interface patterns
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import type { DocumentationHelpReference } from "@govoplan/core-webui";
|
||||
|
||||
export const TENANCY_ADMIN_DOCUMENTATION = {
|
||||
topicId: "tenancy.lifecycle-and-settings",
|
||||
documentationType: "admin"
|
||||
} satisfies DocumentationHelpReference;
|
||||
|
||||
export const TENANCY_FIELD_DOCUMENTATION = {
|
||||
topicId: "tenancy.reference.admin-fields",
|
||||
documentationType: "admin"
|
||||
} satisfies DocumentationHelpReference;
|
||||
|
||||
export const TENANCY_INTERFACE_I18N = {
|
||||
loading: "i18n:govoplan-tenancy.tenant_information_is_loading.7c9a1001",
|
||||
busy: "i18n:govoplan-tenancy.a_tenant_change_is_in_progress.7c9a1002",
|
||||
createRequired: "i18n:govoplan-tenancy.tenant_creation_permission_is_required.7c9a1003",
|
||||
updateRequired: "i18n:govoplan-tenancy.tenant_update_permission_is_required.7c9a1004",
|
||||
suspendRequired: "i18n:govoplan-tenancy.tenant_suspension_permission_is_required.7c9a1005",
|
||||
settingsWriteRequired: "i18n:govoplan-tenancy.tenant_settings_write_permission_is_required.7c9a1006",
|
||||
completeRequiredFields: "i18n:govoplan-tenancy.complete_all_required_tenant_fields_before_saving.7c9a1007",
|
||||
noPendingChanges: "i18n:govoplan-tenancy.make_a_change_before_saving.7c9a1008",
|
||||
activeTenant: "i18n:govoplan-tenancy.switch_to_another_tenant_before_suspending_the_active_tenant.7c9a1009",
|
||||
alreadySuspended: "i18n:govoplan-tenancy.this_tenant_is_already_suspended.7c9a1010",
|
||||
readOnlySummary: "i18n:govoplan-tenancy.tenant_administration_is_read_only.7c9a1011",
|
||||
requiredActionLabel: "i18n:govoplan-tenancy.required_action.7c9a1012",
|
||||
actorLabel: "i18n:govoplan-tenancy.responsible_actor.7c9a1013",
|
||||
targetLabel: "i18n:govoplan-tenancy.destination.7c9a1014",
|
||||
administratorActor: "i18n:govoplan-tenancy.a_system_or_tenant_owner_with_the_required_permission.7c9a1015",
|
||||
tenantRegistryTarget: "i18n:govoplan-tenancy.administration_tenants.7c9a1016",
|
||||
tenantSettingsTarget: "i18n:govoplan-tenancy.administration_tenant_settings.7c9a1017",
|
||||
registryPermissionGuidance: "i18n:govoplan-tenancy.request_a_tenant_management_permission_or_contact_a_system_owner.7c9a1018",
|
||||
settingsPermissionGuidance: "i18n:govoplan-tenancy.request_tenant_settings_write_permission_or_contact_a_tenant_owner.7c9a1019",
|
||||
defaultLanguageRequired: "i18n:govoplan-tenancy.the_default_language_must_remain_enabled.7c9a1020",
|
||||
governanceSystemLimit: "i18n:govoplan-tenancy.system_policy_prevents_this_tenant_from_enabling_the_capability.7c9a1021",
|
||||
inheritLabel: "i18n:govoplan-tenancy.inherit.7c9a1022",
|
||||
allowLabel: "i18n:govoplan-tenancy.allow.7c9a1023",
|
||||
denyLabel: "i18n:govoplan-tenancy.deny.7c9a1024"
|
||||
} as const;
|
||||
|
||||
export function tenantMutationDisabledReason({
|
||||
busy,
|
||||
permitted,
|
||||
complete = true,
|
||||
changed = true,
|
||||
permissionReason
|
||||
}: {
|
||||
busy: boolean;
|
||||
permitted: boolean;
|
||||
complete?: boolean;
|
||||
changed?: boolean;
|
||||
permissionReason: string;
|
||||
}): string | undefined {
|
||||
if (busy) return TENANCY_INTERFACE_I18N.busy;
|
||||
if (!permitted) return permissionReason;
|
||||
if (!complete) return TENANCY_INTERFACE_I18N.completeRequiredFields;
|
||||
if (!changed) return TENANCY_INTERFACE_I18N.noPendingChanges;
|
||||
return undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user