Skip to content

Commit 2e6f993

Browse files
MDE/PKFE-19 additional code documentation
1 parent 6aad38c commit 2e6f993

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

app/back-end/src/routes/workspace_route.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777

7878
# pylint: disable=import-error
7979
# pylint: disable=too-many-locals
80+
# pylint: disable=too-many-lines
8081

8182
import os
8283
import shutil
@@ -793,7 +794,7 @@ def put_workspace_rename(relative_path):
793794
}
794795
```
795796
"""
796-
797+
797798
uuid = request.headers.get("uuid")
798799
sid = request.headers.get("sid")
799800

@@ -948,7 +949,7 @@ def put_workspace_delete(relative_path):
948949
}
949950
```
950951
"""
951-
952+
952953
uuid = request.headers.get("uuid")
953954
sid = request.headers.get("sid")
954955

app/front-end/src/features/editor/components/fileTreeView/fileTreeItem/fileTreeItemContextMenu.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,37 @@ export interface FileTreeItemContextMenuProps {
1616
onClose: () => void;
1717
}
1818

19+
/**
20+
* `FileTreeItemContextMenu` component provides a context menu for file tree items with options for creating, renaming,
21+
* deleting files and folders, as well as other related actions.
22+
*
23+
* @description This component displays a context menu that allows users to perform various actions on file tree items,
24+
* such as creating new files or folders, renaming existing items, or deleting items. The menu items are conditionally
25+
* rendered based on the type of the selected file or folder. It also includes dialogs for entering information and
26+
* confirming actions.
27+
*
28+
* The component uses `FileTreeItemContextMenuTextfieldDialog` for dialogs requiring text input and `FileTreeItemContextMenuConfirmationDialog`
29+
* for actions requiring confirmation. The menu and dialogs are controlled via state hooks and props.
30+
*
31+
* @component
32+
*
33+
* @param {FileTreeItemContextMenuProps} props - The props for the component.
34+
* @param {FileTreeViewItemProps} props.item - The file or folder item for which the context menu is displayed.
35+
* @param {{ top: number; left: number }} props.anchorPosition - The position of the menu relative to the anchor.
36+
* @param {boolean} props.open - A boolean indicating whether the context menu is open or not.
37+
* @param {Function} props.onClose - The function to be called when the context menu is closed.
38+
*
39+
* @example
40+
* // Example usage of the FileTreeItemContextMenu component
41+
* <FileTreeItemContextMenu
42+
* item={selectedItem}
43+
* anchorPosition={{ top: 100, left: 200 }}
44+
* open={isMenuOpen}
45+
* onClose={handleCloseMenu}
46+
* />
47+
*
48+
* @returns {JSX.Element} The context menu component with various menu items and dialogs.
49+
*/
1950
export const FileTreeItemContextMenu: React.FC<FileTreeItemContextMenuProps> = ({
2051
item,
2152
anchorPosition,

app/front-end/src/features/editor/components/fileTreeView/fileTreeView.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ declare module 'react' {
1616
}
1717

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

0 commit comments

Comments
 (0)