-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ui): Present items as a hierarchical list #406
Conversation
Coverage Report for ./frontend
File Coverage
|
Two suggestions:
|
View is reserved because we follow the smart / dumb pattern and by vue's layout. Indeed everything in the "views" folder is something that is "smart" (i.e. it does API calls) So the word view is banned from components names.
No Accordions and there node have no clues of the underlining data. The tree is parsed in the report store. Edit: describe keysAsTree function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like it to be possible to add items by clicking rather than dragging. Can you add this back?
This should be discussed with @anasstarfaoui this leads to question in the future. Where does a clicked item goes in the list ? Do we need to trigger a scroll to the added item ? Which cursor type should be use ? (For now on mouse press you get the drag cursor). |
@anasstarfaoui @rouk1 could we use double-click to add an item to the end of the view? |
It's done : ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement with LUT, thanks!
4639815
to
3bdf179
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the rewrite of the double-click mechanic!
A new UI component is introduced: a tree accordion 🪗 It can have as many nested level as needed and is collapsible. Transforming a list of keys to tree structure is now done in the report store. It's implemented in the `keysAsTree` function. 1. The function starts by initializing an empty array tree to hold the root nodes of the tree structure. 2. It gets all the keys from the items object (or an empty object if items is null). 3. The function then iterates over each key: a. It splits the key into segments, filtering out any empty segments. b. It identifies the root segment (first part of the path). c. It checks if a node for this root segment already exists in the tree. If not, it creates a new node and adds it to the tree. d. It then iterates through the remaining segments of the key: - For each segment, it builds the full path up to that point. - It checks if a child node with this path already exists. - If not, it creates a new child node and adds it to the current node's children. - It then moves to this child node for the next iteration. 4. After building the basic structure, it defines an addSelf function: - This function recursively goes through the tree. - If a node's name matches a key in the original list and it has children, it adds a "(self)" node as the first child. - This handles cases where a path is both a key itself and has child keys. 5. Finally, it applies the addSelf function to each root node in the tree. 6. The function returns the completed tree structure. Usage: ```vue <script setup lang="ts"> import TreeAccordion, { type TreeAccordionNode } from "@/components/TreeAccordion.vue"; const fileTreeNodes: TreeAccordionNode[] = [ { name: "fraud", children: [{ name: "fraud/accuracy" }, { name: "fraud/accuracy3" }], }, { name: "fraud2", children: [{ name: "fraud2/accuracy" }, { name: "fraud2/accuracy3" }], }, { name: "nested", children: [ { name: "nested/fraud2/accuracy", children: [ { name: "nested/fraud2/accuracy/self" }, { name: "nested/fraud2/accuracy/self2" }, { name: "nested/fraud2/accuracy/self3" }, ], }, { name: "nested/fraud2/accuracy3", children: [] }, ], }, ]; </script> <template> <TreeAccordion :nodes="fileTreeNodes" /> </template ``` https://github.com/user-attachments/assets/b5d83778-1c40-429d-beec-1f20d6814dd9 Fixes #335
A new UI component is introduced: a tree accordion 🪗
It can have as many nested level as needed and is collapsible.
Transforming a list of keys to tree structure is now done in the report store. It's implemented in the
keysAsTree
function.a. It splits the key into segments, filtering out any empty segments.
b. It identifies the root segment (first part of the path).
c. It checks if a node for this root segment already exists in the tree. If not, it creates a new node and adds it to the tree.
d. It then iterates through the remaining segments of the key:
Usage:
accordion.mp4
Fixes #335