Files
govoplan-access/webui/src/features/admin/interfacePatterns.ts
T

80 lines
4.1 KiB
TypeScript

import type { DocumentationHelpReference } from "@govoplan/core-webui";
export const ACCESS_WORKFLOW_DOCUMENTATION = {
topicId: "access.workflow.grant-user-access",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const ACCESS_REFERENCE_DOCUMENTATION = {
topicId: "access.reference.admin-access-fields",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const FUNCTION_MAPPING_DOCUMENTATION = {
topicId: "access.reference.external-function-role-mappings",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const CREDENTIAL_DOCUMENTATION = {
contextId: "access.credentials",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const FILE_CONNECTOR_DOCUMENTATION = {
topicId: "files.governed-connectors-and-provenance",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const MAIL_PROFILE_DOCUMENTATION = {
topicId: "mail.profiles-and-policy",
documentationType: "admin"
} satisfies DocumentationHelpReference;
export const ACCESS_INTERFACE_I18N = {
loading: "i18n:govoplan-access.administration_data_is_loading.4af2c001",
createPermissionRequired: "i18n:govoplan-access.create_permission_is_required.4af2c002",
updatePermissionRequired: "i18n:govoplan-access.update_or_assignment_permission_is_required.4af2c003",
writePermissionRequired: "i18n:govoplan-access.write_permission_is_required.4af2c004",
completeRequiredFields: "i18n:govoplan-access.complete_the_required_fields_before_saving.4af2c005",
selectUserAndScopes: "i18n:govoplan-access.select_an_account_and_at_least_one_scope.4af2c006",
selectAssignableRole: "i18n:govoplan-access.select_an_assignable_role_before_creating_a_mapping.4af2c007",
assignedObjectCannotBeDeleted: "i18n:govoplan-access.remove_existing_assignments_before_deleting.4af2c008",
lastOwnerCannotBeDeactivated: "i18n:govoplan-access.assign_another_operational_owner_before_deactivating.4af2c009",
systemManagedObject: "i18n:govoplan-access.this_definition_is_managed_by_the_system.4af2c010",
operationInProgress: "i18n:govoplan-access.an_access_administration_operation_is_in_progress.4af2c011",
requiredAction: "i18n:govoplan-access.required_action.4af2c012",
actor: "i18n:govoplan-access.who_can_fix_it.4af2c013",
destinationLabel: "i18n:govoplan-access.where_to_go.4af2c014",
requestAdministrationAccess: "i18n:govoplan-access.request_an_administrative_role_for_the_required_scope.4af2c015",
accessAdministrator: "i18n:govoplan-access.a_tenant_owner_or_system_access_administrator.4af2c016",
accessAdministration: "i18n:govoplan-access.admin_users_groups_and_roles.4af2c017",
installFiles: "i18n:govoplan-access.install_and_enable_the_files_module.4af2c018",
installMail: "i18n:govoplan-access.install_and_enable_the_mail_module.4af2c019",
systemModuleAdministrator: "i18n:govoplan-access.a_system_module_administrator.4af2c020",
moduleManagement: "i18n:govoplan-access.admin_modules.4af2c021",
reusableCredentials: "i18n:govoplan-access.reusable_credentials.4af2c022",
systemCredentials: "i18n:govoplan-access.system_credentials.4af2c023",
tenantCredentials: "i18n:govoplan-access.tenant_credentials.4af2c024",
groupCredentials: "i18n:govoplan-access.group_credentials.4af2c025",
userCredentials: "i18n:govoplan-access.user_credentials.4af2c026",
systemCredentialDescription: "i18n:govoplan-access.instance_credentials_can_be_inherited_and_governed.4af2c027",
tenantCredentialDescription: "i18n:govoplan-access.tenant_credentials_can_be_shared_with_permitted_modules.4af2c028",
groupCredentialDescription: "i18n:govoplan-access.reusable_credentials_owned_by_the_selected_group.4af2c029",
userCredentialDescription: "i18n:govoplan-access.reusable_credentials_owned_by_the_selected_user.4af2c030"
} as const;
export function saveDisabledReason({
busy,
permitted,
complete
}: {
busy: boolean;
permitted: boolean;
complete: boolean;
}): string | undefined {
if (busy) return ACCESS_INTERFACE_I18N.operationInProgress;
if (!permitted) return ACCESS_INTERFACE_I18N.writePermissionRequired;
if (!complete) return ACCESS_INTERFACE_I18N.completeRequiredFields;
return undefined;
}