fix : code review — correct 15 issues across UX overhaul (phases 1-4)

Critical fixes:
- Make MigrateConstructeurLinks migration no-op (legacy tables already dropped)
- Add explicit ON CONFLICT (id) target in RestoreConstructeurLinks migration
- Replace N+1 queries with 4 bulk GROUP BY in ConstructeurStatsController
- Declare missing versionListRef template ref in machine detail page
- Add missing await on removeMachineDocument, cast activeTab as string

Important fixes:
- Add lang="ts" to ToastContainer and constructeurs page
- Type entityType as union in UsedInSection/useUsedIn
- Remove dead duration param from showError
- Update back-link props to new /catalogues/* URLs (3 pages)
- Replace raw error blocks with EmptyState in component/piece detail pages
- Type handleFillEntity params and machineInfoCardRef

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 18:26:05 +02:00
parent 8a841832b2
commit 244bfdc3e4
12 changed files with 92 additions and 136 deletions

View File

@@ -21,69 +21,13 @@ final class Version20260405_MigrateConstructeurLinks extends AbstractMigration
public function up(Schema $schema): void
{
// Composant links (a = composantId, b = constructeurId)
$this->addSql("
INSERT INTO composant_constructeur_links (id, composantid, constructeurid, supplierreference, createdat, updatedat)
SELECT
'clmig_cc_' || ROW_NUMBER() OVER (ORDER BY a, b),
a, b, NULL, NOW(), NOW()
FROM _composantconstructeurs
WHERE NOT EXISTS (
SELECT 1 FROM composant_constructeur_links
WHERE composantid = _composantconstructeurs.a
AND constructeurid = _composantconstructeurs.b
)
");
// Piece links
$this->addSql("
INSERT INTO piece_constructeur_links (id, pieceid, constructeurid, supplierreference, createdat, updatedat)
SELECT
'clmig_pc_' || ROW_NUMBER() OVER (ORDER BY a, b),
a, b, NULL, NOW(), NOW()
FROM _piececonstructeurs
WHERE NOT EXISTS (
SELECT 1 FROM piece_constructeur_links
WHERE pieceid = _piececonstructeurs.a
AND constructeurid = _piececonstructeurs.b
)
");
// Machine links
$this->addSql("
INSERT INTO machine_constructeur_links (id, machineid, constructeurid, supplierreference, createdat, updatedat)
SELECT
'clmig_mc_' || ROW_NUMBER() OVER (ORDER BY a, b),
a, b, NULL, NOW(), NOW()
FROM _machineconstructeurs
WHERE NOT EXISTS (
SELECT 1 FROM machine_constructeur_links
WHERE machineid = _machineconstructeurs.a
AND constructeurid = _machineconstructeurs.b
)
");
// Product links
$this->addSql("
INSERT INTO product_constructeur_links (id, productid, constructeurid, supplierreference, createdat, updatedat)
SELECT
'clmig_prc_' || ROW_NUMBER() OVER (ORDER BY a, b),
a, b, NULL, NOW(), NOW()
FROM _productconstructeurs
WHERE NOT EXISTS (
SELECT 1 FROM product_constructeur_links
WHERE productid = _productconstructeurs.a
AND constructeurid = _productconstructeurs.b
)
");
// No-op: legacy M2M tables (_composantconstructeurs, _piececonstructeurs, etc.)
// were already dropped by Version20260331121257.
// The actual data restoration is handled by Version20260405_RestoreConstructeurLinksFromBackup.
}
public function down(Schema $schema): void
{
// Remove only the migrated rows (identifiable by 'clmig_' prefix)
$this->addSql("DELETE FROM composant_constructeur_links WHERE id LIKE 'clmig_cc_%'");
$this->addSql("DELETE FROM piece_constructeur_links WHERE id LIKE 'clmig_pc_%'");
$this->addSql("DELETE FROM machine_constructeur_links WHERE id LIKE 'clmig_mc_%'");
$this->addSql("DELETE FROM product_constructeur_links WHERE id LIKE 'clmig_prc_%'");
// No-op
}
}

View File

@@ -38,7 +38,7 @@ final class Version20260405_RestoreConstructeurLinksFromBackup extends AbstractM
('clbkp3_cc_003', 'cmh0d59v5000347s561ahbept', 'cmhnaaoam000847s85wfwi2wm', NULL, NOW(), NOW()),
('clbkp3_cc_004', 'cmh0d59v5000347s561ahbept', 'cmg93n9sk000047uuwm6u20mj', NULL, NOW(), NOW()),
('clbkp3_cc_005', 'cmkr0nq1a004e1eq6v6ubxlfl', 'cmkqpnznr001p1eq6hdh2ept8', NULL, NOW(), NOW())
ON CONFLICT DO NOTHING
ON CONFLICT (id) DO NOTHING
");
// === PIECE-CONSTRUCTEUR LINKS (25 from backup 3) ===
@@ -70,7 +70,7 @@ final class Version20260405_RestoreConstructeurLinksFromBackup extends AbstractM
('clbkp3_pc_023', 'cl6480b97f6516fba22ce86434', 'cmg93n9sk000047uuwm6u20mj', NULL, NOW(), NOW()),
('clbkp3_pc_024', 'cl9579b05774d92096117841b0', 'cmizv4lm500071e2w6xymi2p6', NULL, NOW(), NOW()),
('clbkp3_pc_025', 'cl5b02c64fcc5ae8a3bfb6e5e6', 'cmizv4lm500071e2w6xymi2p6', NULL, NOW(), NOW())
ON CONFLICT DO NOTHING
ON CONFLICT (id) DO NOTHING
");
// Note: 6 additional Limatech piece links from backup (3) used old Limatech ID 'cla14aa4a50a799c2e54391be7'.
@@ -83,7 +83,7 @@ final class Version20260405_RestoreConstructeurLinksFromBackup extends AbstractM
('clbkp3_pc_027', 'clfd3cb41a407ab5a3f9d5baae', 'cmizv4lm500071e2w6xymi2p6', NULL, NOW(), NOW()),
('clbkp3_pc_028', 'cld08dae22796b5855152580d9', 'cmizv4lm500071e2w6xymi2p6', NULL, NOW(), NOW()),
('clbkp3_pc_029', 'clf6012fca41994c1e81ce2dba', 'cmizv4lm500071e2w6xymi2p6', NULL, NOW(), NOW())
ON CONFLICT DO NOTHING
ON CONFLICT (id) DO NOTHING
");
// Re-enable FK checks