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

feat(product,dashboard): Allow re-ordering images #10187

Merged
merged 41 commits into from
Nov 25, 2024

Conversation

kasperkristensen
Copy link
Contributor

@kasperkristensen kasperkristensen commented Nov 20, 2024

What

  • Migrates Product <> ProductImage to a OneToMany relationship. The migration script ensures that the current data in the product-images pivot table is migrated.
  • Adds ProductImage.rank field, the field is treated as readonly, and does not allow the user to set it directly. It is instead inferred by the index of an image in the product payload, e.g. images: [{ url: "./funny-cat.jpg" }, { url: "./funny-dog.jpg" }] is saved as [{ url: "./funny-cat.jpg", rank: 0 }, { url: "./funny-dog.jpg", rank: 1 }].
  • Add DnD for the product media form and product create form in admin.
  • Fixes an issue where images in the product media gallery had a width of 0px in Firefox.

Resolves CMRC-723, CMRC-724, CMRC-725

CLOSES #10128

Copy link

vercel bot commented Nov 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 9:18pm
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 9:18pm
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Nov 22, 2024 9:18pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Nov 22, 2024 9:18pm
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Nov 22, 2024 9:18pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Nov 22, 2024 9:18pm
resources-docs ⬜️ Ignored (Inspect) Visit Preview Nov 22, 2024 9:18pm

Copy link

changeset-bot bot commented Nov 20, 2024

🦋 Changeset detected

Latest commit: a166fa9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 65 packages
Name Type
@medusajs/dashboard Patch
@medusajs/product Patch
@medusajs/types Patch
@medusajs/admin-bundler Patch
integration-tests-http Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/promotion Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
@medusajs/cli Patch
@medusajs/medusa-oas-cli Patch
@medusajs/oas-github-ci Patch
@medusajs/telemetry Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

Overall LGTM, would be nice with a pair of extra eyes, if possible.

packages/modules/product/src/models/product-image.ts Outdated Show resolved Hide resolved
@olivermrbl
Copy link
Contributor

@adrien2p, any chance you could glance over the BE in this PR?

@adrien2p
Copy link
Member

@adrien2p, any chance you could glance over the BE in this PR?

Yes for sure, i can have a look tomorrow morning 🙏

Copy link
Collaborator

@srindom srindom left a comment

Choose a reason for hiding this comment

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

Looks good to me - will let someone else take a look as well

.changeset/flat-mugs-try.md Show resolved Hide resolved
Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -52,7 +52,7 @@ export interface SoftDeletableEntity extends BaseEntity {
/**
* Temporary type fixing to allow any level of orders until we get to properly clean all the types
*/
type FindConfigOrder = { [Key: string]: "ASC" | "DESC" | FindConfigOrder }
export type FindConfigOrder = { [Key: string]: "ASC" | "DESC" | FindConfigOrder }
Copy link
Member

Choose a reason for hiding this comment

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

export type FindConfigOrder = { [Key: string]: "ASC" | "DESC" | string & {} | FindConfigOrder }

@olivermrbl olivermrbl merged commit 1659c9b into develop Nov 25, 2024
24 checks passed
@olivermrbl olivermrbl deleted the feat/image-rank-field-many-to-one branch November 25, 2024 08:03
@github-actions github-actions bot mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Admin product media view image in Firefox is zero-width
4 participants