Skip to content

Commit

Permalink
MDE/PKFE-19 additional code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mantvydasdeltuva committed Aug 28, 2024
1 parent 6aad38c commit 2e6f993
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
5 changes: 3 additions & 2 deletions app/back-end/src/routes/workspace_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

# pylint: disable=import-error
# pylint: disable=too-many-locals
# pylint: disable=too-many-lines

import os
import shutil
Expand Down Expand Up @@ -793,7 +794,7 @@ def put_workspace_rename(relative_path):
}
```
"""

uuid = request.headers.get("uuid")
sid = request.headers.get("sid")

Expand Down Expand Up @@ -948,7 +949,7 @@ def put_workspace_delete(relative_path):
}
```
"""

uuid = request.headers.get("uuid")
sid = request.headers.get("sid")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,37 @@ export interface FileTreeItemContextMenuProps {
onClose: () => void;
}

/**
* `FileTreeItemContextMenu` component provides a context menu for file tree items with options for creating, renaming,
* deleting files and folders, as well as other related actions.
*
* @description This component displays a context menu that allows users to perform various actions on file tree items,
* such as creating new files or folders, renaming existing items, or deleting items. The menu items are conditionally
* rendered based on the type of the selected file or folder. It also includes dialogs for entering information and
* confirming actions.
*
* The component uses `FileTreeItemContextMenuTextfieldDialog` for dialogs requiring text input and `FileTreeItemContextMenuConfirmationDialog`
* for actions requiring confirmation. The menu and dialogs are controlled via state hooks and props.
*
* @component
*
* @param {FileTreeItemContextMenuProps} props - The props for the component.
* @param {FileTreeViewItemProps} props.item - The file or folder item for which the context menu is displayed.
* @param {{ top: number; left: number }} props.anchorPosition - The position of the menu relative to the anchor.
* @param {boolean} props.open - A boolean indicating whether the context menu is open or not.
* @param {Function} props.onClose - The function to be called when the context menu is closed.
*
* @example
* // Example usage of the FileTreeItemContextMenu component
* <FileTreeItemContextMenu
* item={selectedItem}
* anchorPosition={{ top: 100, left: 200 }}
* open={isMenuOpen}
* onClose={handleCloseMenu}
* />
*
* @returns {JSX.Element} The context menu component with various menu items and dialogs.
*/
export const FileTreeItemContextMenu: React.FC<FileTreeItemContextMenuProps> = ({
item,
anchorPosition,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ declare module 'react' {
}

/**
* FileTreeView component displays a hierarchical tree view of files and directories.
* `FileTreeView` component renders a hierarchical tree view of files and directories.
*
* @description This component renders a `RichTreeView` with items fetched from the workspace endpoint. It displays a loading
* indicator while the data is being fetched and presents the tree view when the data is loaded. The tree view uses `FileTreeItem`
* to represent each item. The component handles asynchronous data fetching and provides visual feedback using `LinearProgress`.
* @description This component utilizes `RichTreeView` from Material-UI to display a hierarchical view of files and directories
* fetched from the workspace endpoint. It handles loading states with `LinearProgress` and displays a context menu for file
* operations. The context menu is controlled by state and provides options such as creating new files or folders.
*
* The `RichTreeView` component from Material-UI's TreeView package is utilized to render the hierarchical structure, with
* a custom `item` slot for rendering each tree node via the `FileTreeItem` component.
* The component:
* - Fetches file tree data asynchronously from the workspace API endpoint.
* - Displays a loading indicator while data is being fetched.
* - Renders the file tree using `FileTreeItem` for each item.
* - Manages the state and position of a context menu that appears on right-click or button click.
* - Listens for updates via WebSocket to refresh the file tree data.
*
* @component
*
Expand All @@ -33,7 +37,7 @@ declare module 'react' {
* <FileTreeView />
* );
*
* @returns {JSX.Element} The rendered tree view component, displaying either a loading indicator or the file tree.
* @returns {JSX.Element} The rendered tree view component, showing either a loading indicator or the file tree.
*/
export const FileTreeView: React.FC = () => {
const { connected } = useSessionContext();
Expand Down

0 comments on commit 2e6f993

Please sign in to comment.