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: Add customization support for UI components #4634

Conversation

abhijith-trenser
Copy link
Contributor

@abhijith-trenser abhijith-trenser commented Dec 30, 2024

Context

  • Created a custom hook and provider to manage and share services across the application.
  • Added support for rendering custom UI components.
  • This PR has been incorporated by FlyWheel.io

Changes & Results

  • Developed a new hook and provider for accessing services directly across the application, eliminating the need to pass them through props.
  • By using the new CustomizableRenderingComponents, we made changes to the following components to support receiving custom components through the customization service.
  1. LabellingFlow,
  2. LoadingIndicatorProgress,
  3. LoadingIndicatorTotalPercent,
  4. ProgressLoadingBar,
  5. ContextMenuItem,
  6. ViewportActionCorners
  • As part of this, we moved the default OSS components to the extensions/default and extensions/cornerstone folders and now send the default components through the customization module.
  • This allows users to replace these components with their own customizations, either in mode or global customizations.

Testing

  • Set a new component through the customization service using the corresponding customizationId for the mentioned components.
  • Observe the behavior in the viewer.
  • The newly set component should replace the default OSS component.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals.

Tested Environment

  • OS: Windows 10
  • Node version: 18.19.0
  • Browser: Chrome 131.0.6778.205

Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for ohif-dev canceled.

Name Link
🔨 Latest commit c616d1c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-dev/deploys/67a06c3ae4e69a00083a04ee

Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for ohif-platform-docs ready!

Name Link
🔨 Latest commit c616d1c
🔍 Latest deploy log https://app.netlify.com/sites/ohif-platform-docs/deploys/67a06c3a0cdfe2000879775a
😎 Deploy Preview https://deploy-preview-4634--ohif-platform-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sedghi
Copy link
Member

sedghi commented Jan 8, 2025

we are reworking the customizationService so stay tuned until it is done

@abhijith-trenser
Copy link
Contributor Author

we are reworking the customizationService so stay tuned until it is done

Thank you for the information, @sedghi. Would you happen to have a feature branch or work item that could serve as a reference for the implementation?

@abhijith-trenser abhijith-trenser marked this pull request as draft January 22, 2025 09:50
@abhijith-trenser abhijith-trenser changed the title feat: Integrate CustomizationService with UiDialogService and support customized components in Annotation Labelling feat: Add CustomizableRenderComponent for dynamic component rendering and update component usage Jan 23, 2025
@abhijith-trenser abhijith-trenser force-pushed the feat/integrate-customization-service-with-ui-dialog-service branch from 247b7a3 to 8e39169 Compare January 23, 2025 09:27
@sedghi
Copy link
Member

sedghi commented Jan 23, 2025

Can you rebase on top of the new customization service and follow what's done there please? Sorry for the inconvenience

@abhijith-trenser abhijith-trenser force-pushed the feat/integrate-customization-service-with-ui-dialog-service branch from d9d5415 to 79b8f42 Compare January 24, 2025 06:04
@abhijith-trenser abhijith-trenser marked this pull request as ready for review January 27, 2025 04:59
@abhijith-trenser
Copy link
Contributor Author

Can you rebase on top of the new customization service and follow what's done there please? Sorry for the inconvenience

@sedghi I have updated the branch based on the latest changes in the customization service. Would you mind reviewing it when you have a moment?

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

See my comments thanks

@abhijith-trenser abhijith-trenser changed the title feat: Add CustomizableRenderComponent for dynamic component rendering and update component usage feat: Add customization support for UI components Jan 28, 2025
Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

I really appreciate the PR, which is pretty much in line with our goal of making each component customizable.

I'm not entirely sold on the CustomizableRenderComponent idea, though. You're basically replacing the entire component logic with a customized version, and I'm not sure that's the right approach. This could have some pretty significant side effects - for instance, what if certain parts of the app want to use the default version, while others want to use a customized ContextMenu?

I think a better way to handle this is to consider customization as an all-or-nothing proposition outside of the platform/ui and platform/ui-next. I'm not a fan of calling the customization service directly from our platform/ui and ui-next, as that means services logic is leaking into the UI. I know some components are already doing this, but I'm in the process of cleaning them up. In my opinion, there shouldn't be any mention of services, commands, or managers in the platform/ui and ui-next.

I'd rather see more instances of customizationService.getCustomization('ui.contextMenuItem') than injecting the customization service at the component level. That way, we can keep the customization logic separate from the UI components. Does that make sense?

CCing @wayfarer3130 for his opinion

@abhijith-trenser abhijith-trenser force-pushed the feat/integrate-customization-service-with-ui-dialog-service branch from 1dbee9a to 5f4dec2 Compare February 3, 2025 05:48
@abhijith-trenser
Copy link
Contributor Author

Thanks, don't forget to bun install , try upgrading bun as well to 1.2

@sedghi I have executed the tests after the Bun installation, and everything is working perfectly.

Copy link
Member

@sedghi sedghi left a comment

Choose a reason for hiding this comment

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

Thanks a lot, this is great

@sedghi sedghi merged commit f15eb44 into OHIF:master Feb 3, 2025
17 checks passed
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.

6 participants