feat: add error resolution ui
resolves #13015
related https://github.com/shopware/shopware/pull/13587
Summary
Introduces the new ui to resolve user-fixable migration errors grouped by code/entity/field.
==> screen design ==> cloud version: settings > migration (please do not confirm "continue" 😄)
What changed
[!NOTE] Tests will follow in a seperate pr to make this not bigger as it already is (pr: #90)
Backend
src/Controller/HistoryController
New Endpoints:
-
GET
api/_action/migration/get-log-groups: Main endpoint to fetch grouped logs of the current migration run to resolve errors. It groups the logs by error code, entity name and field name. Also it gives the option to paginate, sort (by & direction) and filter the results by error code, status (resolved / unresolved), entity, and field name. Uses the newLogGroupingServicefor fetching the logs. -
POST
api/_action/migration/get-all-log-ids: For the error resolution modal I need a endpoint that gives me all Ids of logs groups by code, entity name and field name to select all logs of this group for bulck editing.
src/Migration/History/LogGroupingService
New Service:
- groups logs by code, entity name, field name for given runId and level
- supports filters: error code, entity name, field name, status (resolved / unresolved)
- supports sorting: by count, code, entity name, field name, profile name, gateway name createdAt
- supports pagination, respecting filters and sorting
- computes the
fixCountfor the ui where we display how many of the grouped errors have been resolved (e.g.12 / 500) - computes the
levelCountsfor error type error/warning/info (e.g.Errors (12), Warning (30) ...)
Administration
New components
-
swag-migration-error-resolution-step: Entry point for resolving migration issues. Lists grouped log items, offers filters and sorting, opens the resolution modal -
swag-migration-error-resolution-modal: Bulk resolution modal for selected group of errors. Lets the user choose a target log, input a fix value and create a fix -
swag-migration-error-resolution-details-modal: Shows the user the raw data of the logs convertedData and sourceData if available -
swag-migration-error-resolution-log-filter: Filter panel for the main table. Provides code, enity, field and status select. -
swag-migration-error-resolution-field: Field wrapper that inspects the entity medadata to render the correct input type (subcomponents)-
swag-migration-error-resolution-field-relation: input for relation fields (to-one / to-many). User can either select one entity (id) or multiple -
swag-migration-error-resolution-field-scalar: input for scalar field (stirng / number / boolean / dates / json) -
swag-migration-error-resolution-field-unhandeled: fallback for unsuppoorted or unknown field types (e.g. if an unexpexted field got recognized and we have no metadata in the definitions for the field or the type of field is unsupported)
-
New Service:
src/module/swag-migration/service/swag-migration-error-resolution.service.ts:
Business logic for the error resolution with following responsibilities:
- resolves admin route for an entity (getEntityLink) to create option for a fix
- analyses the entity definitions to extract:
- type of scalar values
- type and entity of associations
- required fields
- extraction of id fields (to-one and to-many ids)
- entity field validation
- field utilities:
- finds corresponding association fields in the definition
- picks "highest priority" property of an entity for displaying meaningful information
- table generation: builds columns for the error resolution modal by following schema: 1. status, 2. field that has error, ... followed by prioritized scalar fields
feedback todos:
- [x] make detail modal rows clickable (if possible): #13587
- [x] remove support call to action in unfixable error banner
- [x] refactor continue modal
- [x] add log table empty state
- [x] preselction of table pages does not work for select all
- [x] fix filter log popover outside click (no fix as it seems)
- [x] step indicator: increase margin between items & add horizontal divider (small viewports)
- [x] truncate log text in detail modal
- [x] add filter count badge to log filter button
- [x] fix banner darkmode
- [x] fix stepper tokens
- [x] stepper should not be sticky (no easy fix)
- [x] fix fixed/total query
- [x] code column refactor: add name column, hide code column, use code as fallback for name column