In the IDE, modules are used to encapsulate sets of related functionalities and correspond to workspaces accessible through entries in the menu on the left-hand side bar.
### Module structure
Each module is composed of a ui and a server function. The ui function takes as input the session id while the server function needs additional inputs. Below are the templates for both functions:
Global reactive values are stored in the rv object which is defined in datafile.R. If a module needs a new variable in rv, this variable must be added to the rv definition in datafile.R (starting at line 125).
The session_parent variable is currently only needed when automatically switching to another workspace.
### Adding a module to the app
To add a new module to the sidebar menu, add a new entry to the sideBarMenu() function in the server function in image\_data\_explorer.R (line 141). Below is a template for a new menuItem entry:
The corresponding workspace is created as a new tabItem() entry in the dashboardBody() function in the ui() function in image\_data\_explorer.R. Below is a template for a new tabItem entry:
```
tabItem( tabName = "<Workspace name>",
fluidRow(
ui_<module>("<module name>_module")
)),
```
To trigger the switch to the workspace when it is selected in the sidebar menu, add an observeEvent entry to the server function(). Below is a template for a new observeEvent entry: