-
Notifications
You must be signed in to change notification settings - Fork 478
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
base: main
Are you sure you want to change the base?
Conversation
Please use a Conventional Commit title format for this PR. For more information, see https://www.conventionalcommits.org/en/v1.0.0/ |
Please use a Conventional Commit title format for this PR. For more information, see https://www.conventionalcommits.org/en/v1.0.0/ |
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class DotEditorDialogService { |
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.
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.
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.
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!
This pull request refactors the
DotEmaDialogComponent
to replace the existingDotEmaDialogStore
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
withDotEditorDialogService
for managing dialog state and actions inDotEmaDialogComponent
. Updated all references to use the new service, such asdialogService.resetDialog()
anddialogService.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 likecreateContentlet
,translatePage
,setDirty
, andsetSaved
. ([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 byDotEditorDialogService
. ([[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
providers
array inDotEmaDialogComponent
to removeDotEmaDialogStore
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)
)