Skip to content
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

Export folders and requests #1396

Merged
merged 5 commits into from
Apr 18, 2019
Merged

Conversation

rickychandra
Copy link
Contributor

Closes: #1273
I implemented the feature to export only certain folders and/or requests in a single workspace.
There is an alternative to this solution which is adding checkboxes in the sidebar, but IMO this makes the exporting not focusable (it's sidebar), and it's more complex in that other components in the sidebar may be disabled, etc.

UI
I added a new option "Current Workspace's Requests" under "Export Data" dropdown button.
screenshot from 2019-03-05 18-30-11

If the option is chosen, then it will open a new dialog displaying the requests tree of the current workspace.
screenshot from 2019-03-05 18-30-36

The initial state is that all folders are expanded and none of the checkboxes is selected. If no folders or requests are selected, then the "Export" button will be disabled.

When the "Export" button is pressed, the flow will be the same as the existing "Export Workspace".

Since the focus here are requests, empty folders (without requests) will not appear in the tree.

There is also a top folder "All requests" which is a dummy folder to make exporting all top requests and folders easier with a single click, but will not be exported itself.

What are exported
The selected requests and their parent folders, the containing workspace, all environments (private ones are asked first), and cookie jar. This behavior is pretty much the same as the existing "Export Workspace".

Implementation
The tree structure and styling (HTML and CSS) are copied from those of sidebar's with many modifications. I am not sure whether it is better to abstract the tree structure as a separate reusable component or not, because there are many parts (DnD wrappers, dropdown buttons, checkbox, etc.) specific to each use cases.

The requests tree is constructed from the globally cached selectSidebarChildren and then stored as React state in the modal component.

Every time a folder is collapsed or checkbox selected, all of its children will be traversed which in worst case will result in O(N) time complexity. However, I think that this is still quite performant for most users.

@rickychandra rickychandra changed the title Export folders Export folders and requests Mar 5, 2019
@gschier
Copy link
Contributor

gschier commented Mar 7, 2019

Woah, awesome work! I haven't looked at your implementation yet but I hope to get to it this week or next

Copy link
Contributor

@gschier gschier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some general design comments. Overall, I think most of this PR is great, so nice work! I'm really excited for people to be able to use this.

@rickychandra
Copy link
Contributor Author

Ok, updated the code.

@gschier gschier merged commit 683ac86 into Kong:develop Apr 18, 2019
@rickychandra rickychandra deleted the feature/export-folders branch April 19, 2019 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Choose which folders to export from a workspace
2 participants