mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #2865] [MERGED] feat : smart tree component #4118
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#4118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/2865
Author: @nivedin
Created: 12/1/2022
Status: ✅ Merged
Merged: 1/31/2023
Merged by: @AndrewBastin
Base:
main← Head:feat/smart-tree-component📝 Commits (10+)
12ff5edchore: initial smart tree test5dee938feat: smart tree adapterba8cc34refactor: smart tree update77305acfix: tree child components render28dc055refactor: tree branch type05fcea0refactor: fix ts error and added dynamic slots45e2116refactor: empty state UI0b18576refactor: empty folder and collection UId2f686crefactor: folder using pathbe6b527feat: add collection and request component as node📊 Changes
39 files changed (+4427 additions, -4086 deletions)
View changed files
📝
packages/hoppscotch-common/locales/en.json(+1 -0)📝
packages/hoppscotch-common/src/components.d.ts(+7 -7)📝
packages/hoppscotch-common/src/components/collections/Add.vue(+44 -39)📝
packages/hoppscotch-common/src/components/collections/AddFolder.vue(+44 -45)📝
packages/hoppscotch-common/src/components/collections/AddRequest.vue(+14 -21)➖
packages/hoppscotch-common/src/components/collections/ChooseType.vue(+0 -162)➕
packages/hoppscotch-common/src/components/collections/Collection.vue(+252 -0)📝
packages/hoppscotch-common/src/components/collections/Edit.vue(+45 -39)📝
packages/hoppscotch-common/src/components/collections/EditFolder.vue(+46 -40)📝
packages/hoppscotch-common/src/components/collections/EditRequest.vue(+48 -44)📝
packages/hoppscotch-common/src/components/collections/ImportExport.vue(+111 -195)➕
packages/hoppscotch-common/src/components/collections/MyCollections.vue(+619 -0)➕
packages/hoppscotch-common/src/components/collections/Request.vue(+235 -0)📝
packages/hoppscotch-common/src/components/collections/SaveRequest.vue(+170 -180)➕
packages/hoppscotch-common/src/components/collections/TeamCollections.vue(+625 -0)➕
packages/hoppscotch-common/src/components/collections/TeamSelect.vue(+167 -0)📝
packages/hoppscotch-common/src/components/collections/index.vue(+1442 -846)➖
packages/hoppscotch-common/src/components/collections/my/Collection.vue(+0 -354)➖
packages/hoppscotch-common/src/components/collections/my/Folder.vue(+0 -340)➖
packages/hoppscotch-common/src/components/collections/my/Request.vue(+0 -433)...and 19 more files
📄 Description
Description
This PR introduces a new tree component that can be used for any tree structure. In this PR the collection component has been refactored using the new smart tree. Smart Tree is a flexible tree view component that converts the data into a tree structure.
The separate components like Collection, Folders, Requests for MyCollection, and TeamsCollection have been removed and made common UI components.
A basic tree component structure will look like below -
The tree consists of two components and one Adapter Interface -
Treefor displaying all the nodesTreeBranchfor displaying each tree node.SmartTreeAdapterrepresents the adapter properties.Tree
The main tree component, which has
adapteras the prop.The tree UI is specified by passing it in the slots.
Content Template returns -
EmptyNode Template returns -
TreeBranch
node-itemandadapteras the props.Adapter
The adapter which provides the properties of the adapter -
getChildren- Function used to fetch the children of the nodeidas the prop (id of the node which the children is to fetch)The TreeNode has to be the type
id - Unique id to represent the node
data - The data to be represented
The childrenNode has to be the type ie the data
It has two status -
loading - The data would be null (used in the team collection, when fetching from the db)
loaded - The data is fetched and the data is passed to data
The loading UI has been provided to the tree since it will be common to all components.
The adapter is then initialized by passing the data
Checks
Additional Information
The whole collection component has been refactored to setup - TS. The functionality of the collection component has been kept the same.
TODO:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.