Skip to content

Comments

Angular update#781

Draft
jma wants to merge 31 commits intorero:stagingfrom
jma:angular-update
Draft

Angular update#781
jma wants to merge 31 commits intorero:stagingfrom
jma:angular-update

Conversation

@jma
Copy link
Contributor

@jma jma commented Feb 16, 2026

No description provided.

Garfield-fr and others added 29 commits December 2, 2025 12:47
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Signed-off-by: Github Copilot
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
…d results features

- Install @ngrx/signals@^20.0.0
- Create directory structure: model/, store/features/
- Extract interfaces: AggregationsFilter, SearchParams
- Implement withSearchQuery feature (q, currentType)
- Implement withResults feature (esResult, total, isLoading, error)
- Compose RecordSearchStore with both features
- Add comprehensive unit tests for all features
- Use strict typing (EsResult, Error) - no 'any' types
- Rename 'records' to 'hits' to avoid DB records confusion

Part of plan step 1-2: Setup infrastructure and basic search features
- Add RecordSearchStore to providers array
- Inject store with inject(RecordSearchStore)
- Create effect observing store.q() and store.currentType() that triggers search
- Migrate all _q() and _currentType() references to store.q() and store.currentType()
- Update searchByQuery() to call store.updateQuery()
- Update changeType() to call store.updateType()
- Sync inputs with store in ngOnChanges (inputs → store → local signals)
- Update template to use store.q() instead of q()
- Remove redundant sets from effect to avoid change detection cycles

Step 3/10 completed: Basic store integration with query and type management.
- Create withPagination() feature with page, size, total state
- Add computed showPagination and totalPages
- Add methods: updatePage(), updateSize(), updateTotal(), resetPagination()
- Use patchState() for proper signal store updates
- Add comprehensive unit tests (16 scenarios)
- Integrate withPagination() into RecordSearchStore composition

Step 4/10 in progress: Pagination feature created and tested.
- Create withAggregations() feature with aggregationsFilters and aggregations state
- Add methods: updateFilters(), updateFilter(), removeFilter(), removeFilterValue(), clearFilters()
- Add methods for aggregations: updateAggregations(), clearAggregations()
- Auto-sort filter values alphabetically for consistency
- Add comprehensive unit tests (21 test scenarios)
- Integrate withAggregations() into RecordSearchStore composition

Step 5/10 completed: Aggregations feature created and tested.
- Create withSort() feature with sort state
- Add methods: updateSort(), clearSort()
- Add comprehensive unit tests (10 test scenarios)
- Integrate withSort() into RecordSearchStore composition

Step 6/10 completed: Sort feature created and tested.
- Create withSearchFields() for managing search field selection
  - State: searchFields array with selected state
  - Methods: updateSearchFields, toggleSearchField, selectAll/deselectAll, clear
  - Computed: selectedSearchFields, hasSelectedFields
  - 20 comprehensive unit tests

- Create withSearchFilters() for managing search filter configuration
  - State: searchFilters array (SearchFilter | SearchFilterSection)
  - Methods: updateSearchFilters, clearSearchFilters
  - Computed: flatSearchFilters (extracts from sections), hasSearchFilters
  - 18 comprehensive unit tests

- Integrate both features into RecordSearchStore composition

Step 7/10 completed: SearchFields and SearchFilters features created and tested.
- Create withConfig() for managing RecordType configuration
  - State: config (RecordType | null)
  - Methods: updateConfig, clearConfig
  - Computed: hasConfig, exportFormats, sortOptions, preFilters, defaultSearchInputFilters,
    showSearchInput, showLabel, allowEmptySearch, showFacetsIfNoResults,
    aggregationsOrder, aggregationsExpand, aggregationsHide, aggregationsBucketSize,
    aggregationsName, listHeaders, component
  - 24 comprehensive unit tests covering all computed properties and workflows

- Integrate withConfig() into RecordSearchStore composition

Step 8/10 completed: Configuration feature created and tested.
BREAKING CHANGE: RecordSearchService has been removed and replaced with RecordSearchStore

Migration completed:
- Created withSearchParams feature with 3 computed properties:
  * queryString() - builds query from q and searchFields
  * currentIndex() - determines index from config
  * facetsParameter() - builds facets list from aggregations
- Added 18 unit tests for withSearchParams feature
- Migrated all child components to use store:
  * BucketsComponent: uses toObservable(store.aggregationsFilters())
  * DateRangeComponent: uses store.updateFilter()
  * SliderComponent: uses store.updateFilter()
  * RecordSearchPageComponent: uses @ViewChild to access store
- Removed 3 component methods replaced by store computeds:
  * _buildQueryString() → store.queryString()
  * _currentIndex() → store.currentIndex()
  * _getFacetsParameter() → store.facetsParameter()
- Made RecordSearchComponent.store public (readonly)
- Deleted RecordSearchService (198 lines) and its tests
- Updated all component tests to use RecordSearchStore
- Exported RecordSearchStore and AggregationsFilter in public API

Architecture improvements:
- 9 SignalStore features with 127+ tests
- No BehaviorSubject dependencies
- Centralized state management
- Reactive computed properties
- Better type safety and testability
…tures

Complete the SignalStore refactoring by activating commented features and adding comprehensive tests:

Phase 1 - Bug Fixes:
- Fix circular dependency in withSearchFields feature (store.config().searchFields() → store.searchFields())
- Update all withSearchFields feature tests to use correct state access

Phase 2 - Tests (60+ new tests):
- Create record-search-page.component.spec.ts with 25+ tests covering URL↔Store sync
- Add 30+ tests to record-search.store.spec.ts (fetchRecords, hooks, computed properties, error handling)

Phase 3 - Feature Activation:
- Activate withSearchFilters feature with initialization effect
- Activate withSearchFields feature with initialization effect
- Both features now load from config when type changes

Phase 4 - Cleanup:
- Remove dead RecordSearchService import from aggregation.component.spec.ts
- Remove debug console.log statements from store and components
- Update store JSDoc to reflect all active features

All features are now functional with proper initialization and comprehensive test coverage.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jma jma force-pushed the angular-update branch 3 times, most recently from 873ce8b to 5556453 Compare February 16, 2026 15:54
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Signed-off-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
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.

2 participants