Fix issue with AssetType filters - #136
Conversation
There was a problem hiding this comment.
Pull request overview
Adds backend and frontend support to populate the Asset Type filter from a dedicated read-only AssetType API endpoint, enabling the Asset search UI to show available asset types dynamically.
Changes:
- Added
AssetTypesmodel and a read-onlyAssetTypeControllerendpoint underapi/openXDA/AssetType. - Added a shared
AssetTypeControllerclient in TS and wiredgetEnumto fetch Asset Types from the new endpoint. - Updated the default Asset search definition so the AssetType field is treated as an enum and can be populated.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| SEBrowser/Scripts/TSX/Store/ControllerFunctions.ts | Adds AssetType API path and shared read-only controller wrapper. |
| SEBrowser/Scripts/TSX/Components/TrendData/NavBar/TrendDataNavbar.tsx | Reuses the shared getEnum implementation instead of maintaining a local copy. |
| SEBrowser/Scripts/TSX/Components/EventSearch/Navbar/EventSearchNavbar.tsx | Exports a generic getEnum and adds special handling to populate AssetType options via the new controller. |
| SEBrowser/Scripts/TSX/Components/Common/DefaultSearch.tsx | Configures the AssetType field as an enum so the dropdown can be populated. |
| SEBrowser/Controllers/OpenXDA/ModelControlers.cs | Exposes a new read-only AssetTypeController route. |
| Libraries/openXDA.Model/TransmissionElements/AssetTypes.cs | Introduces the AssetType table model (and enum). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
SEBrowser/Scripts/TSX/Components/EventSearch/Navbar/EventSearchNavbar.tsx:476
getEnumis now exported from (and imported from)EventSearchNavbar.tsx, which is a heavy UI module with many unrelated dependencies. Using it as a shared helper couples TrendData to EventSearch and can increase bundle size / risk of unintended side effects from module initialization.
Consider moving getEnum (and its helper types like ValueListItemResponse / getValueListGroup) into a small shared utility module (e.g., Components/Common/SearchEnumUtils.ts) and importing it from both navbars.
export const getEnum = <T,>(setOptions: (options: Gemstone.TSX.Interfaces.ILabelValue<string>[]) => void, field: Search.IField<T>) => {
if (field.type != 'enum' || field.enum == undefined || field.enum.length != 1)
return () => {/*Do Nothing*/ };
Summary