PS-1150 builtin attributes api#804
Open
4rthem wants to merge 18 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a backend-driven “built-in fields” catalog (API resource + provider) and updates the databox client to consume it instead of hardcoding built-in attribute definitions, while also renaming the client-side built-in field enum for clarity.
Changes:
- Added a new API resource (
/built-in-fields) backed byBuiltInFieldRegistry, plus translations for built-in field display names. - Refactored backend built-in-field interface to use
static getName()and added metadata (isSearchable,isMultiple,isListed) surfaced through the new API. - Updated the client attribute-definition store and multiple search/profile UI components to use the new API response and the renamed
BuiltInFieldEnum.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| databox/client/src/types.ts | Adds client BuiltInField type and updates ProfileItem.key typing; imports new enum. |
| databox/client/src/store/attributeDefinitionStore.ts | Replaces hardcoded built-in filters with getBuiltInFields() API call and adds built-in value resolver helper. |
| databox/client/src/hooks/useNotificationUriHandler.ts | Switches to BuiltInFieldEnum for query building. |
| databox/client/src/components/Media/Search/Sorting/SortByRow.tsx | Uses displayName for sorting row label rendering. |
| databox/client/src/components/Media/Search/Sorting/SortBy.tsx | Updates store loading call signature (no t argument). |
| databox/client/src/components/Media/Search/Sorting/EditSortBy.tsx | Switches to BuiltInFieldEnum and updates “score” handling. |
| databox/client/src/components/Media/Search/SortByChip.tsx | Uses displayName for chip label rendering. |
| databox/client/src/components/Media/Search/SearchProvider.tsx | Switches built-in field references to BuiltInFieldEnum. |
| databox/client/src/components/Media/Search/search.ts | Renames built-in enum to BuiltInFieldEnum and updates default sort resolution. |
| databox/client/src/components/Media/Search/AQL/SearchConditions.tsx | Updates store loading call signature (no t argument). |
| databox/client/src/components/Media/Search/AQL/SearchConditionDialog.tsx | Updates store loading call signature (no t argument). |
| databox/client/src/components/Media/CollectionsPanel.tsx | Switches to BuiltInFieldEnum for deleted filter. |
| databox/client/src/components/Media/Asset/Facets/facetWidgets.ts | Switches to BuiltInFieldEnum for facet widget key mapping. |
| databox/client/src/components/Media/Asset/Attribute/Attributes.tsx | Refactors built-in attribute rendering to use getBuiltInFieldValueResolver(). |
| databox/client/src/components/Dialog/Profile/OrganizeProfile.tsx | Updates store loading call signature (no t argument). |
| databox/client/src/api/types.ts | Adds EntityName.BuiltInField. |
| databox/client/src/api/attributes.ts | Adds getBuiltInFields() client API call. |
| databox/api/translations/messages.en.yaml | Adds translation keys for built-in field display names. |
| databox/api/src/Model/BuiltInField.php | New API Platform model representing a built-in field entry. |
| databox/api/src/Api/Provider/BuiltInFieldProvider.php | New provider exposing built-in fields collection from registry. |
| databox/api/src/Elasticsearch/Mapping/FieldNameResolver.php | Uses BuiltInFieldInterface::getName() for built-in ES field resolution. |
| databox/api/src/Elasticsearch/FacetHandler.php | Uses BuiltInFieldInterface::getName() for missing aggregation field selection. |
| databox/api/src/Elasticsearch/BuiltInField/BuiltInFieldInterface.php | Updates interface (static getName) and adds metadata methods. |
| databox/api/src/Elasticsearch/BuiltInField/AbstractBuiltInField.php | Provides defaults for new interface methods and updates facet building field name usage. |
| databox/api/src/Elasticsearch/BuiltInField/AbstractDateTimeBuiltInField.php | Updates date histogram facet field name usage to static::getName(). |
| databox/api/src/Elasticsearch/AQL/AQLToESQuery.php | Uses built-in field getName() when resolving built-in field clusters. |
| databox/api/src/Attribute/Type/IdAttributeType.php | New attribute type for IDs (non-locale-aware, no suggest). |
| databox/api/src/Elasticsearch/BuiltInField/CollectionBuiltInField.php | Renames ES field accessor to static getName() and marks as multiple. |
| databox/api/src/Elasticsearch/BuiltInField/CreatedAtBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/DeletedBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/EditedAtBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/IdBuiltInField.php | Renames ES field accessor to static getName(); switches type to IdAttributeType. |
| databox/api/src/Elasticsearch/BuiltInField/IsStoryBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/OwnerBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/PrivacyBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/RenditionBuiltInField.php | Renames ES field accessor to static getName() and marks as multiple. |
| databox/api/src/Elasticsearch/BuiltInField/ScoreBuiltInField.php | Renames ES field accessor to static getName(). |
| databox/api/src/Elasticsearch/BuiltInField/StoryBuiltInField.php | Renames ES field accessor to static getName() and marks as multiple. |
| databox/api/src/Elasticsearch/BuiltInField/TagBuiltInField.php | Renames ES field accessor to static getName() and marks as multiple. |
| databox/api/src/Elasticsearch/BuiltInField/WorkspaceBuiltInField.php | Renames ES field accessor to static getName(). |
Comments suppressed due to low confidence (2)
databox/client/src/store/attributeDefinitionStore.ts:176
BuiltInFieldEnum.FileNameis currently resolved toasset.createdAt, which is unrelated to the file name. This will display incorrect data when the File Name built-in field is used. Update the resolver to return the appropriate field (e.g., the asset name / source filename as represented in the clientAssetmodel).
databox/client/src/store/attributeDefinitionStore.ts:186- There is a very large block of commented-out legacy built-in-field definitions (with TODOs) below
getBuiltInFieldValueResolver(). This makes the file harder to maintain and can easily drift out of date. Please remove it (or move the remaining TODOs into an issue/tracking ticket) now that built-in fields are being sourced from the API.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # databox/api/src/Api/OutputTransformer/AssetOutputTransformer.php # databox/api/src/Attribute/BatchAttributeManager.php
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 126 out of 127 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
databox/client/src/components/Media/Search/search.ts:15
BuiltInFieldEnumstill exposesFileMimeType = '@mimetype', but there is no corresponding built-in attribute implementation in the API registry anymore. This can mislead users into building AQL queries that will now fail with "Built-in field not found". Either reintroduce a@mimetypebuilt-in attribute (and ES mapping) or remove/deprecate this enum value and any related UI/translation keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.