Skip to content

Conversation

@nicobytes
Copy link
Contributor

@nicobytes nicobytes commented Dec 30, 2025

Proposed Changes

This pull request focuses on improving type safety and consistency in API response handling across several data access services. It introduces the use of a shared DotCMSAPIResponse type for HTTP responses, updates service methods to use more explicit typing and map operators, and refactors related unit tests to use new test utilities for creating mock data. Additionally, minor improvements were made to ESLint configuration and utility code.

API Response Handling and Type Safety Improvements:

  • Updated DotContentletService, DotFolderService, and DotSiteService to use the shared DotCMSAPIResponse type for all HTTP responses, ensuring consistent and type-safe extraction of the entity property using the map operator instead of pluck. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • Refactored DotContentletService to add a new method getContentletByInodeWithContent, which retrieves a contentlet and augments it with file content using the injected DotUploadFileService.

Test Refactoring and Utilities:

  • Updated dot-contentlet-service.spec.ts to use new mock data utilities (createFakeContentlet, createFakeLanguage) and mockProvider from @ngneat/spectator/jest, streamlining test setup and improving test readability and maintainability. [1] [2]

Dependency Injection and Service Decorators:

  • Updated service decorators to use providedIn: 'root' for DotFolderService, aligning with Angular best practices for singleton services.

Minor Improvements and Fixes:

  • Fixed a bug in DotSeoMetaTagsUtilService by converting HTMLCollection to an array before iteration, ensuring compatibility with modern JavaScript.
  • Relaxed ESLint ignore patterns to explicitly ignore node_modules directories in the MCP server configuration.
  • Cleaned up type definitions and imports in DotSiteService, removing redundant interface definitions.

Checklist

  • Tests
  • Translations
  • Security Implications Contemplated (add notes if applicable)

…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.
@nicobytes nicobytes linked an issue Dec 30, 2025 that may be closed by this pull request
10 tasks
@alwaysmeticulous
Copy link

Meticulous was unable to execute a test run for this PR because the most recent commit is associated with multiple PRs. To execute a test run, please try pushing up a new commit that is only associated with this PR.

Last updated for commit 159208d. This comment will update as new commits are pushed.

@mergify
Copy link

mergify bot commented Dec 30, 2025

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

…nality

- Refactored SCSS for native field component to exclude custom select button from button styles.
- Introduced new styles for custom select button and dropdown options in the template custom field.
- Improved accessibility and usability of the custom dropdown with enhanced event handling and state management.

These changes aim to provide a more consistent and user-friendly experience when interacting with custom fields
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 PR implements a custom field template refactor (#34029) with the following key changes:

  • Major refactoring of the template selector custom field from a simple dropdown to a custom-styled button with paginated dropdown
  • Introduction of a new DotBrowsingService to consolidate site/folder browsing logic previously duplicated across multiple components
  • Implementation of a reusable DotBrowserSelectorComponent for content selection modals
  • Enhancement of the form bridge to support opening browser modals from custom fields
  • Code cleanup including removal of unused imports, duplicate functions, and dependency consolidation

Reviewed changes

Copilot reviewed 79 out of 84 changed files in this pull request and generated no comments.

Show a summary per file
File Description
template_custom_field_new.vtl Complete rewrite from simple select dropdown to custom button with paginated dropdown, added browser modal support
redirect_custom_field*.vtl Split into old/new versions with conditional loading pattern
DotBrowsingService New centralized service for site/folder browsing operations
DotBrowserSelectorComponent New reusable component for content selection with tree navigation
angular-form-bridge.ts Added openBrowserModal method to support custom field modal dialogs
Various test files Updated imports and mocks to use new service structure
yarn.lock Cleaned up duplicate/unused dependencies
Config files TypeScript strictness adjustments for bridge library

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