Shimoku docs
Search
K

Erase Sidebar Paths and Components

1. Deleting boards

The boards can contain many menu paths and make it easy for the user to group some menu paths that can be shared publicly through embedding, but it is important to have the necessary tools to delete them. Boards can not be deleted if they include menu paths, so it is advisable to first delete the menu paths that are linked to it. If the board is clean then it is as simple as calling:
s.boards.delete_board(uuid: Optional[str], name: Optional[str])
In case the board to be deleted contains a menu path that can't be deleted there exists the option to force delete that board, this function will delete all the menu path links of the board and then delete it:
s.boards.force_delete_board(uuid: Optional[str], name: Optional[str])
Some times there are too many boards and is a hassle to be deleting them one by one, the best option the is to use the following function that will delete all the boards in a workspace, given that they don't include any apps:
s.workspaces.delete_all_workspace_boards(uuid: Optional[str], name: Optional[str])

2. Deleting menu paths

For deleting menu paths there are the following two options:
s.menu_paths.delete_menu_path(uuid: Optional[str], name: Optional[str])
Which will delete a specified menu path and:
s.workspaces.delete_all_workspace_menu_paths(uuid: Optional[str], name: Optional[str])
Which will delete all menu paths in a workspace.
A menu path with activities can not be deleted, so make sure to delete the activities first.

3. Deleting sub-paths and components

The sub-paths are not an exisiting entity like the boards or the menu paths, they are defined by the components themselves, so if there exists a component with a certain sub-path it will appear in the sidebar, but if no component has a specific sub-path it will not exist, even if it is referenced in the code. There are three modules that can erase components:
  • By s.components:
    This module lets the user delete a component by providing its uuid, through the use of:
    s.components.delete_component(uuid: str)
  • By s.menu_paths:
    Similar to the boards and menu paths there is a way to delete all of them by referencing its parent resource, by calling the following function all components inside of a menu path will be deleted:
    s.menu_paths.delete_all_menu_path_components(uuid: Optional[str], name: Optional[str])
  • By s.plt:
    This will be the most common way to delete the components that are not wanted anymore, because it is able to use the execution context and other information to delete the components. To delete a specific component the options are:
    # Deletes a chart component by the context of execution and the order specified
    s.plt.delete_chart_by_order(order: int)
    # Deletes a tabs group component by its name in the menu path
    s.plt.delete_tabs_group(name: str)
    # Deletes a modal component by its name in the menu path
    s.plt.delete_modal(name: str)
    And lastly the function very similar to the s.menu_paths one, the only differene is that this function uses the given context and can delete a group of components from a specific sub-path:
    s.plt.clear_menu_path(path: Optional[str])
    A typical use case is to locate it just below the s.set_menu_path as it will clean everything and create it from 0:
    s.set_menu_path('menu path', 'sub-path')
    s.plt.clear_menu_path('sub-path')
    data = [
    {'date': dt.date(2021, 1, 1), 'x': 5, 'y': 10},
    {'date': dt.date(2021, 1, 2), 'x': 6, 'y': 8},
    {'date': dt.date(2021, 1, 3), 'x': 4, 'y': 10},
    {'date': dt.date(2021, 1, 4), 'x': 7, 'y': 2},
    {'date': dt.date(2021, 1, 5), 'x': 3, 'y': 14},
    {'date': dt.date(2021, 1, 6), 'x': 6, 'y': 10},
    {'date': dt.date(2021, 1, 7), 'x': 3, 'y': 12},
    {'date': dt.date(2021, 1, 8), 'x': 8, 'y': 14},
    ]
    s.plt.bar(data=data, x='date', order=0)