Show corpus categories to instance administrators
https://redmine.teklia.com/issues/11416
Requires backend#1945 (closed)
The Corpus interface in src/types/index.ts needs to be updated to add a category: CorpusCategory | null. CorpusCategory is a new interface with the new category properties exposed in the corpus API endpoints.
A new src/components/Corpus/Category.vue component takes a category as a required prop and shows a Bulma tag with the display_name in white text, and a background set to the category's color.
When the user is an instance administrator (the isAdmin getter of the auth store returns true):
- The project list should show a new Category column, between Description and Users;
- Each row of the project list shows a
Categorycomponent in this new column, or nothing if thecategoryis set tonullto keep TypeScript happy; - The Details tab of the project information page shows a Category field with the
Categorycomponent and a help text to invite instance administrators to update the category in the Django admin, along with a link to the corpus page of the admin, similarly to what is done insrc/views/Budget/Details.vue. There is no field at all if thecategoryis set tonull, to keep TypeScript happy.
When the user is not authenticated or not an instance administrator, the interface should be exactly as it is currently.