-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add: Bulk export patterns action. #58897
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -1.63 kB (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
8d694d8
to
5c7e1ad
Compare
Flaky tests detected in 5c7e1ad. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7877860058
|
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.
This is nice, though I found a bug with patterns that have the same name. This is how to reproduce:
- duplicate an existing pattern twice
- bulk export
I expected to have the 3 patterns in the ZIP but I only have 2 of them.
From what I see, the pattern's name is not unique, so we need to take that into account for the bulk export action.
That's a good catch! I also made a quick research about alternatives to Thanks Jorge! |
5c7e1ad
to
2616b23
Compare
Good catch @oandregal, it was fixed 👍
Yes, I also did an analysis and client-zip seems to have a good tradeoff between providing what we need and having a small size. |
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.
Besides the small name change in case of duplicate names, this LGTM. Thanks!
I'll pre approve and with a green CI, let's land.
return { | ||
name: `${ | ||
name + | ||
( nameCount[ name ] > 1 ? '-' + nameCount[ name ] : '' ) |
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.
Probably it's better to follow the convention operating systems have and start from 1
for the same name files.
For example:
copy.json
copy-1.json
So we should nameCount[ name ] - 1
. What do you think?
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 agree with the suggestion, it was applied 👍
2616b23
to
fb6d19f
Compare
Can one for instance import the exported patterns to a new site? |
This PR adds the ability to bulk export a set of patterns.
If more than one pattern is selected to be exported a zip file with all the patterns is generated.
How?
I selected multiple patterns.
Went to bulk edit and pressed export.
I downloaded the generated zip file, extracted it, and verified it contained the selected patterns as json files.