-
Notifications
You must be signed in to change notification settings - Fork 478
feat(content-types): Introduce field types for content model #31964
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?
feat(content-types): Introduce field types for content model #31964
Conversation
…CMS content model
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/ |
…s and metadata interfaces
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…ntentType in unit tests for improved clarity and consistencys
…ce mock data creation for improved test clarity and maintainability
…ional data types and update related components for improved flexibility
…ck data creation for enhanced test clarity and maintainability
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…BasicMock in unit tests for improved clarity and maintainability
…-aligning-resolutionvalue-and-getfinalcastedvalue' of github.com:dotCMS/core into 31911-refactor-unify-field-type-transformation-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
… improved clarity and maintainability, and enhance mock data consistency across components
…FakeBaseField to use static boolean values for improved consistency and clarity
…m and ContentTypesForm components to enhance mock data consistency and improve test clarity
…onditionally render relationship tree and improve type safety in field definitions
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.
Pull Request Overview
This pull request refactors and enhances test data management for content types by replacing inline mock definitions with reusable helper functions and introducing a new property (forceIncludeInApi) to better simulate field attributes. Key changes include:
- Replacing spread-based mock objects with strongly typed createFake* helper functions.
- Adding the forceIncludeInApi property in multiple test cases.
- Updating various test files for improved maintainability and clarity.
Reviewed Changes
Copilot reviewed 69 out of 69 changed files in this pull request and generated no comments.
File | Description |
---|---|
core-web/libs/dotcms-field-elements/src/components/dot-form/utils/index.ts | Minor formatting improvements and helper refactoring in utility functions. |
core-web/libs/dotcms-field-elements/src/components/dot-form/utils/fields.tsx | Refactored mock definitions to use typed helper functions. |
dot-content-types-edit.component.spec.ts and related tests | Replaced inline mocks with reusable createFake* helpers and updated test expectations. |
dot-add-variable.component.spec.ts, dot-block-editor-sidebar.component.spec.ts | Added forceIncludeInApi property to updated test mock objects. |
Comments suppressed due to low confidence (2)
core-web/libs/dotcms-field-elements/src/components/dot-form/utils/index.ts:110
- Consider adding error handling (e.g., try-catch) around JSON.parse to prevent runtime exceptions when the message is not valid JSON.
const messageObj = JSON.parse(message);
core-web/apps/dotcms-ui/src/app/portlets/shared/dot-content-types-edit/components/fields/content-type-field-dragabble-item/content-type-field-dragabble-item.component.spec.ts:62
- [nitpick] Consider using the createFakeTextField helper for consistency with the rest of the test suite instead of spreading dotcmsContentTypeFieldBasicMock.
const field: DotCMSContentTypeField = { ...dotcmsContentTypeFieldBasicMock, fixed: true, ... }
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…ucture for consistency
…ed utility file for improved clarity and maintainability
…tions for improved clarity and maintainability
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…tilize consistent mock data and improve clarity
…oved clarity and maintainability
…rSeoComponent and enhance test assertions for clarity
… Time, Select, Radio, and Flattened Field resolutions with comprehensive cases and assertions
…support numeric timestamps and improve form value processing in DotEditContentFormComponent
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…-aligning-resolutionvalue-and-getfinalcastedvalue' of github.com:dotCMS/core into 31911-refactor-unify-field-type-transformation-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
@Input({ required: true }) | ||
set field(contentTypeField: DotCMSContentTypeField) { | ||
this.$field.set(contentTypeField); | ||
} | ||
@Input({ required: true }) contentlet: DotCMSContentlet; |
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.
No new api?
@Input({ required: true }) contentlet: DotCMSContentlet; | ||
@Input() imageEditor = false; | ||
|
||
$field = signal<DotCMSContentTypeField>({} as DotCMSContentTypeField); | ||
$field = input.required<ContentTypeBinaryField>({ alias: 'field' }); |
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.
I think we use the old api here because we use this in DOJO. The new api failed.
'com.dotcms.contenttype.model.field.ImmutableTextAreaField', | ||
'com.dotcms.contenttype.model.field.ImmutableTextField' | ||
#dotFormFields: string[] = [ | ||
DotCMSClazzes.BINARY, |
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.
cool
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
…on-logic-by-aligning-resolutionvalue-and-getfinalcastedvalue
Proposed Changes
This pull request introduces several updates to improve test data management and enhance the clarity of mock data in the
dotcms-ui
tests. The most significant changes include the addition of theforceIncludeInApi
property to mock content type fields, the use of strongly typed mock objects, and the replacement of repetitive mock definitions with reusable helper functions.Enhancements to mock data:
forceIncludeInApi
property to mock content type fields in multiple test cases to reflect updated field attributes. (dot-add-variable.component.spec.ts
: [1] [2] [3] [4];dot-block-editor-sidebar.component.spec.ts
: [5]Refactoring of mock definitions:
createFakeTextField
,createFakeBlockEditorField
,createFakeRowField
, and others, to improve code maintainability and readability. (content-type-fields-drop-zone.component.spec.ts
: [1] [2] [3] [4] [5] [6] [7] [8] [9]Strongly typed mock objects:
DotCMSContentTypeField
type explicitly, ensuring type safety and consistency across test cases. (content-type-field-dragabble-item.component.spec.ts
: [1] [2] [3] [4] [5] [6] [7] [8] [9]These changes improve test reliability, streamline mock data creation, and ensure better alignment with the application's evolving data model.
Checklist