Skip to content

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Dec 27, 2025

This pull request refactors several data access services to improve consistency, type safety, and test coverage across the codebase. The main changes include standardizing API response handling, updating tests to use new utilities and patterns, and enhancing service methods for contentlets and folders. These improvements should make the services easier to maintain and extend.

Service API response standardization:

  • Updated all service methods in dot-contentlet.service.ts, dot-folder.service.ts, and dot-site.service.ts to use the DotCMSAPIResponse<T> type for API responses, replacing manual type assertions and pluck operators with consistent usage of map to extract the entity property. This improves type safety and clarity for API responses. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

DotContentletService enhancements:

  • Added a new method getContentletByInodeWithContent to dot-contentlet.service.ts that retrieves a contentlet and augments it with file content using the injected DotUploadFileService.
  • Updated method signatures in dot-contentlet.service.ts to accept optional HttpParams, enabling more flexible API requests.

Test improvements and modernization:

  • Refactored dot-contentlet-service.spec.ts to use new test utilities (createFakeContentlet, createFakeLanguage) and the mockProvider pattern, improving test readability and maintainability. Added new test cases for methods like getContentletByInodeWithContent. [1] [2]

General code and ESLint configuration updates:

  • Updated ESLint ignore patterns in .eslintrc.json to exclude node_modules directories, preventing unnecessary linting of dependencies.
  • Minor fix in dot-seo-meta-tags-util.service.ts to correctly iterate over HTMLCollection using Array.from, preventing potential runtime issues.

Type and dependency cleanup:

  • Removed redundant type definitions and imports in dot-site.service.ts, relying on shared models for better maintainability.

Let me know if you have any questions about these changes or want to discuss how they might affect your work!

This PR fixes: #34029

…dit mode support

- Updated the title custom field template to support a new edit mode using the `DotCustomFieldApi`.
- Implemented event listeners for the title box to automatically update the URL and friendly name fields based on the title input.
- Improved code structure by separating logic for new edit mode and legacy Dojo implementation.
- Ensured backward compatibility by maintaining the original script for non-edit mode scenarios.

This change enhances user experience by providing real-time updates and a more modern approach to handling custom fields.
…:dotCMS/core into 34029-task-migrate-pages-vtls-to-new-api
…:dotCMS/core into 34029-task-migrate-pages-vtls-to-new-api
…ment, enhance data access with new utility methods
…e and DotTruncatePathPipe to improve modularity
…rity and maintainability. Updated mock responses and added tests for contentlet retrieval, locking, and language suggestions. Enhanced test structure with meaningful variable names and consistent use of async patterns.
… improved clarity and maintainability. Updated mock responses and added tests for various upload scenarios, including handling of abort signals and contentlet uploads. Enhanced test structure with meaningful variable names and consistent use of async patterns.
…arity and maintainability. Implemented tests for site and folder retrieval, error handling, and tree structure transformation. Enhanced test structure with meaningful variable names and consistent use of async patterns.
… and error handling. Added lint target in project.json, refined ignore patterns in .eslintrc.json, and adjusted TypeScript configurations for better type safety. Enhanced unit tests in DotBrowsingService for error handling and folder retrieval, ensuring consistent use of async patterns and meaningful variable names.
…settings and focus on testing and build targets.
…lderParams for improved type safety and clarity. Updated getContentByFolder method signatures and adjusted related components to streamline content retrieval parameters. Enhanced DotBrowserSelectorComponent to manage folder parameters using Angular's signals for better state management.
…to utilize ContentByFolderParams for improved clarity and type safety. Updated test cases to pass parameters directly, ensuring consistent use of the new structure. Enhanced AngularFormBridge to accept params for better content filtering and retrieval. Streamlined test assertions for better maintainability..
…s for the DotCustomFieldApi modal. Updated the onClose callback to handle the new URL structure, improving the functionality of the page selection feature.
…eldComponent, and NativeFieldComponent. Updated return type description and field accessibility notes for clarity and consistency.
…or improved modularity and clarity. Updated service methods to utilize DotCMSAPIResponse for consistent response handling. Enhanced unit tests for DotBrowsingService to ensure robust error handling and folder retrieval functionality.
…to use providedIn root for improved dependency injection clarity and consistency across services
…gService to enhance modularity and maintainability in the browser store tests and implementation.
@nicobytes nicobytes requested a review from Copilot December 27, 2025 00:03
@mergify
Copy link

mergify bot commented Dec 27, 2025

⚠️ The sha of the head commit of this PR conflicts with #34126. Mergify cannot evaluate rules on this PR. ⚠️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a comprehensive refactoring of data access services and creates a reusable browser component infrastructure. The main focus is on standardizing API response handling, improving type safety, and consolidating browsing functionality into shared services and components.

Key Changes:

  • Created DotBrowsingService to consolidate site/folder browsing logic previously duplicated across components
  • Introduced DotBrowserSelectorComponent as a reusable content browser modal
  • Extended form bridge API with openBrowserModal() method for custom field integration
  • Standardized all service methods to use DotCMSAPIResponse<T> type and map() operator for consistency
  • Refactored Velocity redirect custom field to support both legacy Dojo and new Angular modes

Reviewed changes

Copilot reviewed 77 out of 81 changed files in this pull request and generated no comments.

Show a summary per file
File Description
redirect_custom_field.vtl Conditional template dispatch based on edit mode
redirect_custom_field_new.vtl Angular-based redirect field using form bridge API
redirect_custom_field_old.vtl Legacy Dojo-based redirect field implementation
dot-browsing.service.ts New centralized service for site/folder browsing operations
dot-browsing.service.spec.ts Comprehensive test suite for browsing service
dot-browser-selector.component.ts New reusable browser modal component
browser.store.ts NgRx signals store for browser selector state
dot-contentlet.service.ts Added getContentletByInodeWithContent() method and standardized response handling
dot-folder.service.ts Standardized API response handling with DotCMSAPIResponse<T>
dot-site.service.ts Moved ContentByFolderParams to models and standardized responses
dot-tags.service.ts Added getTags() method and standardized response handling
dot-upload-file.service.ts Added uploadDotAssetWithContent() and addContent() methods
dot-edit-content.service.ts Refactored to use DotBrowsingService instead of duplicating logic
angular-form-bridge.ts Implemented openBrowserModal() for custom field browser integration
form-bridge.interface.ts Extended interface with browser modal support
browser-selector.interface.ts New interfaces for browser selector functionality
Various test files Updated tests to use new utilities (createFakeContentlet, createFakeLanguage)
DotTruncatePathPipe Renamed from TruncatePathPipe for consistency
Config files Updated TypeScript, ESLint, and build configurations

@nicobytes nicobytes closed this Dec 27, 2025
@nicobytes nicobytes deleted the 34029-browser-component-v2 branch December 27, 2025 02:15
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.

[TASK] Migrate "Pages" VTLs to new API

2 participants