Skip to content

fix( UVE): Remove duplicate dialog instances #32054

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rjvelazco
Copy link
Contributor

This pull request refactors the DotEmaDialogComponent to replace the existing DotEmaDialogStore with a new service, DotEditorDialogService, for managing dialog state and actions. The changes simplify the component, improve code organization, and centralize state management in the new service.

Refactoring and State Management

  • Replaced DotEmaDialogStore with DotEditorDialogService for managing dialog state and actions in DotEmaDialogComponent. Updated all references to use the new service, such as dialogService.resetDialog() and dialogService.setStatus(). ([[1]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L16-R32), [[2]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L73-R79), [[3]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L302-R140), [[4]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L312-R150), [[5]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L326-R164), [[6]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L341-R185), [[7]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L359-R197), [[8]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L412-R254))

  • Extracted dialog-related logic (e.g., opening dialogs, creating contentlets, handling translations) into the new DotEditorDialogService. This includes methods like createContentlet, translatePage, setDirty, and setSaved. ([core-web/libs/portlets/edit-ema/portlet/src/lib/components/dot-ema-dialog/services/dot-ema-dialog.service.tsR1-R331](https://github.com/dotCMS/core/pull/32054/files#diff-5271ab70d8a73398b337fbb58fc298a07b805fd1f63b318b520de94b0d694eceR1-R331))

Code Simplification

  • Removed unused imports and reduced the number of imported models and services in DotEmaDialogComponent. ([core-web/libs/portlets/edit-ema/portlet/src/lib/components/dot-ema-dialog/dot-ema-dialog.component.tsL16-R32](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L16-R32))

  • Removed redundant methods from DotEmaDialogComponent (e.g., addContentlet, editContentlet, createContentletFromPalette), as their functionality is now handled by DotEditorDialogService. ([[1]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L73-R79), [[2]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L260-R109), [[3]](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L283-L293))

Dependency Updates

  • Updated the providers array in DotEmaDialogComponent to remove DotEmaDialogStore and include only the necessary services. ([core-web/libs/portlets/edit-ema/portlet/src/lib/components/dot-ema-dialog/dot-ema-dialog.component.tsL60-R47](https://github.com/dotCMS/core/pull/32054/files#diff-90ca5d45502430e9bc18da8661aa443a9530d1dfe57c907854decf65176194b0L60-R47))

Copy link

Please use a Conventional Commit title format for this PR. For more information, see https://www.conventionalcommits.org/en/v1.0.0/

@rjvelazco rjvelazco linked an issue Apr 29, 2025 that may be closed by this pull request
2 tasks
@rjvelazco rjvelazco changed the title Issue 31978 uve remove duplicate dialog instances fix( UVE): Remove duplicate dialog instances Apr 29, 2025
Copy link

Please use a Conventional Commit title format for this PR. For more information, see https://www.conventionalcommits.org/en/v1.0.0/

@rjvelazco rjvelazco marked this pull request as ready for review April 29, 2025 17:10
@Injectable({
providedIn: 'root'
})
export class DotEditorDialogService {
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, that service handle the state and different ways to update that state, I suggest using signal store for this purpose and the signal store is possible to handle as a root service.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That might be the best, but this is an improvement I'm doing in my free time to clean up the code so I'd rather to keep the service for now but I do think we'll end up using a signal store!

@rjvelazco rjvelazco requested a review from nicobytes May 12, 2025 14:00
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.

 UVE: Remove duplicate dialog instances
2 participants