Skip to content

Frontend: Map Open edX AuthZ icon identifiers to Paragon icons in the catalog #681

Todo

Description

@BryanttV

Description

openedx-authz is replacing Paragon icon names with its own fixed set of icon identifiers (#651, implemented in #669). The icon field of categories, permissions and roles in the role catalog API will hold identifiers such as remove_red_eye or library_books instead of Paragon names such as RemoveRedEye. Today the admin console treats that value as a Paragon icon name, so once the backend change ships, every catalog icon stops rendering. This issue is the frontend side of #651: the admin console owns the mapping from each identifier to the icon it renders.

Current Behavior

CatalogIcon (src/authz-module/catalog/CatalogIcon.tsx) takes the catalog icon value as a Paragon icon name and lazily imports @openedx/paragon/icons/es5/${name}.js. When the name is unknown or doesn't match /^[A-Za-z0-9]+$/, it renders an empty placeholder. snake_case identifiers such as remove_red_eye fail that pattern, so they render nothing. The console doesn't decide which icons a value can resolve to: any Paragon icon name works, and a renamed or removed Paragon icon fails silently.

Expected Behavior

The console maps each identifier of the Open edX AuthZ icon set to a Paragon icon component. CatalogIcon renders the mapped icon for known identifiers and a default icon for any identifier that has no mapping or whose mapped icon can't be loaded. When the catalog sends null, it still renders nothing. The mapping is documented as a public API, so extension authors know how each identifier looks in the console.

Acceptance Criteria

  • Every identifier in the backend icon set (AUTHZ_ICONS in openedx_authz/constants/icons.py, documented in docs/references/icons.rst) maps to a Paragon icon.
  • CatalogIcon renders the mapped icon for a known identifier, such as remove_red_eye.
  • CatalogIcon renders a default icon for an unknown identifier, and for an identifier whose mapped icon can't be loaded.
  • CatalogIcon still renders nothing when icon is null.
  • Paragon names such as RemoveRedEye are no longer accepted as icon values.
  • A unit test fails if a mapped Paragon icon is renamed or removed.
  • The test fixtures in src/authz-module/catalog/testUtils.ts use the new identifiers (for example book_open instead of BookOpen).
  • The README documents the mapping as a public API: each identifier, the icon it renders, and the default icon.
  • The permission views that use CatalogIcon (PermissionTable, RenderPermissionColumn, RenderPermissionInline) show icons for the built-in roles with the new backend schema loaded.

Dependencies

Technical Notes

  • The identifier set has 154 values. They use snake_case and drop Paragon's Icon suffix (RemoveRedEye → remove_red_eye, MenuIcon → menu). The backend list is the source of truth: the mapping should not add identifiers the backend rejects.
  • CatalogIcon loads each icon lazily to keep the bundle small. The mapping can keep that by mapping identifiers to Paragon file names, or it can import the icons statically. Measure the bundle size impact before choosing static imports.
  • The icon set is a public API of openedx-authz. Adding an identifier there needs a matching entry here, otherwise the console shows the default icon for it.

Notes or Additional Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions