Skip to content

Menus

A menu is a section within a category menu that contains one entity, allowing to display it only for the roles that have access to it or disable its visibility within the app.

Definition and purpose of Menus within the system.

Section titled “Definition and purpose of Menus within the system.”

Menus are a system entity. Their purpose is to display a logical entity within a category menu. Allows a system entity to be shown only for the roles that have access to it and turn its visibility on or off.

When creating a category menu, you can create or add existing menus to it. Each menu must have a name, an entity linked to it, and a visibility status. When the menu visibility is set to false, it will be hidden for all roles on the system. When the menu visibility is set to true, it will be shown for the roles that have access to it.

Suppose you have a category menu called “Research Management”. You want to add two menus for the entities “Experiment Protocols” and “Data Pipelines”, each with different access requirements and visibility settings.

  1. Create the structure:

    • Category Menu: Research Management
      • Menu Name: Experiment Protocols
        • Linked entity: ExperimentProtocol
        • Visibility: true
      • Menu Name: Data Pipelines
        • Linked entity: DataPipeline
        • Visibility: false
  2. Assign roles:

    • Grant access to the Research Management category menu to the roles Lead Scientist and Lab Manager.
  3. Result:

    • Users with the Lead Scientist or Lab Manager roles will see the Research Management category menu.
    • Within this category, they will see the Experiment Protocols menu because its visibility is set to true.
    • The Data Pipelines menu will not be visible to any users, regardless of their roles, because its visibility is set to false.
    • When the Data Pipelines are completed and ready to be accessed, you can change its visibility to true, making it available to the same roles.

A menu has the following structure:

{
"id": 1,
"visible": true,
"entity": "ExperimentProtocol",
"menuName": "Experiment Protocols (example)",
// Categories in which the menu is included.
"categoryMenus": [
{
"id": 1,
"name": "Research Management"
}
]
}

Below are the available endpoints for managing menus:

Retrieve all menus stored.

Endpoint:

GET /api/v1/menus/

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <Menu> } ],
"pagination": { <Pagination> }
}

Retrieve a specific menu by its ID.

Endpoint:

GET /api/v1/menus/:id

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <Menu> } ],
"pagination": { <Pagination> }
}

Create a new menu.

Endpoint:

POST /api/v1/menus/
<Menu>

Request example:

{
"visibility": true,
"entity": "ExperimentProtocol",
"menuName": "Experiment Protocols"
}

Response example:

{
"status": 201,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <Menu> } ],
"pagination": { <Pagination> }
}

Update an existing menu.

Endpoint:

PUT /api/v1/menus/:id
<Menu>

Request example:

{
"visibility": false,
"entity": "ExperimentProtocol",
"menuName": "Experiment Protocols"
}

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <Menu> } ],
"pagination": { <Pagination> }
}

Delete a specific menu by its ID.

Endpoint:

DELETE /api/v1/menus/:id

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <Menu> } ],
"pagination": { <Pagination> }
}

Endpoints for assigning categories to a menu

Section titled “Endpoints for assigning categories to a menu”

Below are the available endpoints for assigning categories to menus:

Retrieve all categories assigned to a specific menu.

Endpoint:

GET /api/v1/menus/:id/category-menus

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <CategoryMenu> } ],
"pagination": { <Pagination> }
}

Assign multiple categories to a specific menu.

Endpoint:

POST /api/v1/menus/:id/category-menus

Request example:

{
"categoryMenuIds": [1, 2]
}

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <CategoryMenu> } ],
"pagination": { <Pagination> }
}

Remove one or more categories from a specific menu.

Endpoint:

DELETE /api/v1/menus/:id/category-menus

Request example:

{
"categoryMenuIds": [2]
}

Response example:

{
"status": 200,
"error": false,
"errors": [ {} ],
"message": "string",
"data": [ { <CategoryMenu> } ],
"pagination": { <Pagination> }
}