diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/GearDataOutput.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/GearDataOutput.kt index 257f7dc425..5ee6e428df 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/GearDataOutput.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/GearDataOutput.kt @@ -7,7 +7,7 @@ data class GearDataOutput( val name: String, val category: String? = null, val groupId: Int? = null, - val isMeshRequiredForSegment: Boolean + val isMeshRequiredForSegment: Boolean, ) { companion object { fun fromGear(gear: Gear): GearDataOutput { diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/FleetSegmentEntity.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/FleetSegmentEntity.kt index 715ac15184..cb93601bf1 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/FleetSegmentEntity.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/FleetSegmentEntity.kt @@ -25,7 +25,7 @@ data class FleetSegmentEntity( val minMesh: Double?, @Column(name = "min_share_of_target_species", nullable = true) val minShareOfTargetSpecies: Double?, - @Column(name = "vessel_types", columnDefinition = "varchar(15)[]") + @Column(name = "vessel_types", columnDefinition = "varchar[]") val vesselTypes: List?, @Column(name = "gears", columnDefinition = "varchar(3)[]") val gears: List?, diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt index 6eacc94b8a..4468c7b4c0 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt @@ -7,6 +7,7 @@ import fr.gouv.cnsp.monitorfish.domain.repositories.FleetSegmentRepository import fr.gouv.cnsp.monitorfish.domain.use_cases.dtos.CreateOrUpdateFleetSegmentFields import fr.gouv.cnsp.monitorfish.infrastructure.database.entities.FleetSegmentEntity import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.DBFleetSegmentRepository +import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.utils.toSqlArrayString import jakarta.transaction.Transactional import org.springframework.cache.annotation.Cacheable import org.springframework.stereotype.Repository @@ -115,7 +116,18 @@ class JpaFleetSegmentRepository( @Transactional override fun save(segment: FleetSegment): FleetSegment { - dbFleetSegmentRepository.saveFleetSegment(FleetSegmentEntity.fromFleetSegment(segment)) + val fleetSegmentEntity = FleetSegmentEntity.fromFleetSegment(segment) + + // The list properties needs to be formatted + val escapedFleetSegmentEntity = + fleetSegmentEntity.copy( + vesselTypes = toSqlArrayString(fleetSegmentEntity.vesselTypes)?.let { listOf(it) }, + gears = toSqlArrayString(fleetSegmentEntity.gears)?.let { listOf(it) }, + faoAreas = toSqlArrayString(fleetSegmentEntity.faoAreas)?.let { listOf(it) }, + targetSpecies = toSqlArrayString(fleetSegmentEntity.targetSpecies)?.let { listOf(it) }, + ) + + dbFleetSegmentRepository.saveFleetSegment(escapedFleetSegmentEntity) return dbFleetSegmentRepository.findBySegmentAndYearEquals(segment.segment, segment.year).toFleetSegment() } diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBFleetSegmentRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBFleetSegmentRepository.kt index 43d59af3bd..9690fca4f6 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBFleetSegmentRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBFleetSegmentRepository.kt @@ -32,10 +32,10 @@ interface DBFleetSegmentRepository : CrudRepository { :#{#fleetSegment.maxMesh}, :#{#fleetSegment.minMesh}, :#{#fleetSegment.minShareOfTargetSpecies}, - :#{#fleetSegment.vesselTypes}, - :#{#fleetSegment.gears}, - :#{#fleetSegment.faoAreas}, - :#{#fleetSegment.targetSpecies}, + CAST(:#{#fleetSegment.vesselTypes} AS varchar[]), + CAST(:#{#fleetSegment.gears} AS varchar(3)[]), + CAST(:#{#fleetSegment.faoAreas} AS varchar(15)[]), + CAST(:#{#fleetSegment.targetSpecies} AS varchar(3)[]), :#{#fleetSegment.impactRiskFactor}, :#{#fleetSegment.year} ) diff --git a/backend/src/main/resources/db/testdata/V0.218.1__Insert_dummy_control_objectives.sql b/backend/src/main/resources/db/testdata/V0.218.1__Insert_dummy_control_objectives.sql index 6eef77815b..71b6b0be80 100644 --- a/backend/src/main/resources/db/testdata/V0.218.1__Insert_dummy_control_objectives.sql +++ b/backend/src/main/resources/db/testdata/V0.218.1__Insert_dummy_control_objectives.sql @@ -4,111 +4,130 @@ INSERT INTO control_objectives (facade, segment, year, target_number_of_controls_at_sea, target_number_of_controls_at_port, control_priority_level) VALUES ('MEMN', 'NWW01/02', 2022, 78, 82, 3), - ('MEMN', 'NS01/03', 2022, 12, 11, 3), - ('MEMN', 'PEL03', 2022, 109, 119, 3), - ('SA', 'ATL01', 2022, 4, 3, 3), - ('SA', 'MED06/ATL02', 2022, 8, 12, 3), - ('MED', 'MED06/ATL02', 2022, 152, 317, 4), - ('MED', 'MED01', 2022, 157, 63, 1), - ('MED', 'MED02', 2022, 35, 0, 1), - ('MED', 'MED04', 2022, 20, 50, 1), - ('MED', 'MED05', 2022, 133, 87, 1), - ('MED', 'MED07', 2022, 132, 80, 1), - ('MED', 'FR_ELE', 2022, 90, 60, 1), - ('MED', 'FR_DRB', 2022, 16, 8, 1), - ('MED', 'FR_TMB', 2022, 20, 27, 1), - ('MEMN', 'FR_SCE', 2022, 141, 147, 1), - ('MEMN', 'NS13', 2022, 12, 12, 1), - ('MEMN', 'NS14', 2022, 3, 2, 1), - ('MEMN', 'NWW05', 2022, 15, 15, 1), - ('MEMN', 'NWW06', 2022, 7, 4, 1), - ('MEMN', 'NWW07', 2022, 5, 6, 1), - ('MEMN', 'NWW08', 2022, 36, 38, 1), - ('MEMN', 'NWW09', 2022, 19, 21, 1), - ('MEMN', 'NWW10', 2022, 97, 107, 1), - ('NAMO', 'FR_ELE', 2022, 0, 86, 1), - ('NAMO', 'ATL01', 2022, 20, 0, 1), - ('NAMO', 'FR_SCE', 2022, 51, 126, 1), - ('NAMO', 'MED06/ATL02', 2022, 3, 0, 1), - ('NAMO', 'NWW01/02', 2022, 80, 73, 1), - ('NAMO', 'NWW07', 2022, 24, 15, 1), - ('NAMO', 'NWW08', 2022, 20, 24, 1), - ('NAMO', 'NWW09', 2022, 12, 14, 1), - ('NAMO', 'NWW10', 2022, 36, 27, 1), - ('NAMO', 'PEL01', 2022, 14, 24, 1), - ('NAMO', 'PEL03', 2022, 103, 65, 1), - ('NAMO', 'PEL08', 2022, 24, 24, 1), - ('NAMO', 'PEL13', 2022, 6, 21, 1), - ('NAMO', 'PEL14', 2022, 3, 0, 1), - ('NAMO', 'SWW01/02', 2022, 103, 66, 1), - ('NAMO', 'SWW04', 2022, 13, 24, 1), - ('NAMO', 'SWW06', 2022, 14, 6, 1), - ('NAMO', 'SWW07/03', 2022, 100, 106, 1), - ('NAMO', 'SWW10', 2022, 20, 22, 1), - ('SA', 'FR_SCE', 2022, 51, 42, 1), - ('SA', 'PEL03', 2022, 130, 37, 1), - ('SA', 'PEL05', 2022, 30, 2, 1), - ('SA', 'PEL08', 2022, 23, 12, 1), - ('SA', 'PEL13', 2022, 2, 0, 1), - ('SA', 'SWW01/08', 2022, 139, 43, 1), - ('SA', 'SWW06', 2022, 3, 0, 1), - ('SA', 'SWW07/02', 2022, 53, 51, 1), - ('SA', 'SWW10', 2022, 32, 20, 1), - ('SA', 'PEL14', 2022, 8, 7, 1), - ('SA', 'FR_ELE', 2022, 0, 129, 1), - ('MEMN', 'NWW01/02', 2023, 78, 82, 3), - ('MEMN', 'NS01/03', 2023, 12, 11, 3), - ('MEMN', 'PEL03', 2023, 109, 119, 3), - ('SA', 'ATL01', 2023, 4, 3, 3), - ('SA', 'MED06/ATL02', 2023, 8, 12, 3), - ('MED', 'MED06/ATL02', 2023, 152, 317, 4), - ('MED', 'MED01', 2023, 157, 63, 1), - ('MED', 'MED02', 2023, 35, 0, 1), - ('MED', 'MED04', 2023, 20, 50, 1), - ('MED', 'MED05', 2023, 133, 87, 2), - ('MED', 'MED07', 2023, 232, 80, 2), - ('MED', 'FR_ELE', 2023, 90, 60, 2), - ('MED', 'FR_DRB', 2023, 26, 8, 2), - ('MED', 'FR_TMB', 2023, 20, 27, 2), - ('MEMN', 'FR_SCE', 2023, 242, 247, 2), - ('MEMN', 'NS23', 2023, 12, 12, 1), - ('MEMN', 'NS14', 2023, 3, 2, 1), - ('MEMN', 'NWW05', 2023, 15, 15, 1), - ('MEMN', 'NWW06', 2023, 7, 4, 1), - ('MEMN', 'NWW07', 2023, 5, 6, 1), - ('MEMN', 'NWW08', 2023, 36, 38, 1), - ('MEMN', 'NWW09', 2023, 19, 21, 1), - ('MEMN', 'NWW10', 2023, 97, 107, 1), - ('NAMO', 'FR_ELE', 2023, 0, 86, 1), - ('NAMO', 'ATL01', 2023, 20, 0, 1), - ('NAMO', 'FR_SCE', 2023, 51, 126, 1), - ('NAMO', 'MED06/ATL02', 2023, 3, 0, 1), - ('NAMO', 'NWW01/02', 2023, 80, 73, 1), - ('NAMO', 'NWW07', 2023, 24, 15, 1), - ('NAMO', 'NWW08', 2023, 20, 24, 1), - ('NAMO', 'NWW09', 2023, 12, 14, 1), - ('NAMO', 'NWW10', 2023, 36, 27, 1), - ('NAMO', 'PEL01', 2023, 14, 24, 1), - ('NAMO', 'PEL03', 2023, 103, 65, 1), - ('NAMO', 'PEL08', 2023, 24, 24, 1), - ('NAMO', 'PEL13', 2023, 6, 21, 1), - ('NAMO', 'PEL14', 2023, 3, 0, 1), - ('NAMO', 'SWW01/02', 2023, 103, 66, 1), - ('NAMO', 'SWW04', 2023, 13, 24, 1), - ('NAMO', 'SWW06', 2023, 14, 6, 1), - ('NAMO', 'SWW07/03', 2023, 100, 106, 1), - ('NAMO', 'SWW10', 2023, 20, 22, 1), - ('SA', 'FR_SCE', 2023, 51, 42, 1), - ('SA', 'PEL03', 2023, 130, 37, 1), - ('SA', 'PEL05', 2023, 30, 2, 1), - ('SA', 'PEL08', 2023, 23, 12, 1), - ('SA', 'PEL13', 2023, 2, 0, 1), - ('SA', 'SWW01/08', 2023, 139, 43, 1), - ('SA', 'SWW06', 2023, 3, 0, 1), - ('SA', 'SWW07/02', 2023, 53, 51, 1), - ('SA', 'SWW10', 2023, 32, 20, 1), - ('SA', 'PEL14', 2023, 8, 7, 1), - ('SA', 'FR_ELE', 2023, 0, 129, 1); + ('MEMN', 'NS01/03', 2022, 12, 11, 3), + ('MEMN', 'PEL03', 2022, 109, 119, 3), + ('SA', 'ATL01', 2022, 4, 3, 3), + ('SA', 'MED06/ATL02', 2022, 8, 12, 3), + ('MED', 'MED06/ATL02', 2022, 152, 317, 4), + ('MED', 'MED01', 2022, 157, 63, 1), + ('MED', 'MED02', 2022, 35, 0, 1), + ('MED', 'MED04', 2022, 20, 50, 1), + ('MED', 'MED05', 2022, 133, 87, 1), + ('MED', 'MED07', 2022, 132, 80, 1), + ('MED', 'FR_ELE', 2022, 90, 60, 1), + ('MED', 'FR_DRB', 2022, 16, 8, 1), + ('MED', 'FR_TMB', 2022, 20, 27, 1), + ('MEMN', 'FR_SCE', 2022, 141, 147, 1), + ('MEMN', 'NS13', 2022, 12, 12, 1), + ('MEMN', 'NS14', 2022, 3, 2, 1), + ('MEMN', 'NWW05', 2022, 15, 15, 1), + ('MEMN', 'NWW06', 2022, 7, 4, 1), + ('MEMN', 'NWW07', 2022, 5, 6, 1), + ('MEMN', 'NWW08', 2022, 36, 38, 1), + ('MEMN', 'NWW09', 2022, 19, 21, 1), + ('MEMN', 'NWW10', 2022, 97, 107, 1), + ('NAMO', 'FR_ELE', 2022, 0, 86, 1), + ('NAMO', 'ATL01', 2022, 20, 0, 1), + ('NAMO', 'FR_SCE', 2022, 51, 126, 1), + ('NAMO', 'MED06/ATL02', 2022, 3, 0, 1), + ('NAMO', 'NWW01/02', 2022, 80, 73, 1), + ('NAMO', 'NWW07', 2022, 24, 15, 1), + ('NAMO', 'NWW08', 2022, 20, 24, 1), + ('NAMO', 'NWW09', 2022, 12, 14, 1), + ('NAMO', 'NWW10', 2022, 36, 27, 1), + ('NAMO', 'PEL01', 2022, 14, 24, 1), + ('NAMO', 'PEL03', 2022, 103, 65, 1), + ('NAMO', 'PEL08', 2022, 24, 24, 1), + ('NAMO', 'PEL13', 2022, 6, 21, 1), + ('NAMO', 'PEL14', 2022, 3, 0, 1), + ('NAMO', 'SWW01/02', 2022, 103, 66, 1), + ('NAMO', 'SWW04', 2022, 13, 24, 1), + ('NAMO', 'SWW06', 2022, 14, 6, 1), + ('NAMO', 'SWW07/03', 2022, 100, 106, 1), + ('NAMO', 'SWW10', 2022, 20, 22, 1), + ('SA', 'FR_SCE', 2022, 51, 42, 1), + ('SA', 'PEL03', 2022, 130, 37, 1), + ('SA', 'PEL05', 2022, 30, 2, 1), + ('SA', 'PEL08', 2022, 23, 12, 1), + ('SA', 'PEL13', 2022, 2, 0, 1), + ('SA', 'SWW01/08', 2022, 139, 43, 1), + ('SA', 'SWW06', 2022, 3, 0, 1), + ('SA', 'SWW07/02', 2022, 53, 51, 1), + ('SA', 'SWW10', 2022, 32, 20, 1), + ('SA', 'PEL14', 2022, 8, 7, 1), + ('SA', 'FR_ELE', 2022, 0, 129, 1), + ('SA', 'ATL01', 2023, 78, 82, 3), + ('SA', 'ATL02', 2023, 12, 11, 3), + ('MEMN', 'FR_anguille', 2023, 109, 119, 3), + ('MEMN', 'FR_DRB', 2023, 4, 3, 3), + ('MEMN', 'FR_ELE', 2023, 8, 12, 3), + ('MEMN', 'FR_FOO', 2023, 152, 317, 4), + ('MEMN', 'FR_FPO', 2023, 157, 63, 1), + ('MEMN', 'FR_LOD', 2023, 35, 0, 1), + ('MEMN', 'FR_SCE', 2023, 20, 50, 1), + ('MEMN', 'FR_TMB', 2023, 133, 87, 2), + ('MED', 'MED01', 2023, 232, 80, 2), + ('MED', 'MED02', 2023, 90, 60, 2), + ('MED', 'MED03', 2023, 26, 8, 2), + ('MED', 'MED04', 2023, 20, 27, 2), + ('MED', 'MED05', 2023, 242, 247, 2), + ('MED', 'MED06', 2023, 12, 12, 1), + ('MED', 'MED07', 2023, 3, 2, 1), + ('MED', 'MED09', 2023, 15, 15, 1), + ('MED', 'MED10', 2023, 7, 4, 1), + ('MEMN', 'NS01', 2023, 5, 6, 1), + ('MEMN', 'NS02', 2023, 36, 38, 1), + ('MEMN', 'NS03', 2023, 19, 21, 1), + ('MEMN', 'NS04', 2023, 97, 107, 1), + ('MEMN', 'NS05', 2023, 0, 86, 1), + ('MEMN', 'NWW01', 2023, 103, 65, 1), + ('MEMN', 'NWW02', 2023, 24, 24, 1), + ('MEMN', 'NWW03', 2023, 6, 21, 1), + ('MEMN', 'NWW04', 2023, 3, 0, 1), + ('MEMN', 'NWW05', 2023, 103, 66, 1), + ('MEMN', 'NWW06', 2023, 13, 24, 1), + ('MEMN', 'NWW07', 2023, 14, 6, 1), + ('MEMN', 'NWW08', 2023, 100, 106, 1), + ('MEMN', 'NWW09', 2023, 20, 22, 1), + ('NAMO', 'NS06', 2023, 20, 0, 1), + ('NAMO', 'NS07', 2023, 51, 126, 1), + ('NAMO', 'NS08', 2023, 3, 0, 1), + ('NAMO', 'NS09', 2023, 80, 73, 1), + ('NAMO', 'NS10', 2023, 24, 15, 1), + ('NAMO', 'NS11', 2023, 20, 24, 1), + ('NAMO', 'NS12', 2023, 12, 14, 1), + ('NAMO', 'NS13', 2023, 36, 27, 1), + ('NAMO', 'NS14', 2023, 14, 24, 1), + ('NAMO', 'NWW01', 2023, 103, 65, 1), + ('NAMO', 'NWW02', 2023, 24, 24, 1), + ('NAMO', 'NWW03', 2023, 6, 21, 1), + ('NAMO', 'NWW04', 2023, 3, 0, 1), + ('NAMO', 'NWW05', 2023, 103, 66, 1), + ('NAMO', 'NWW06', 2023, 13, 24, 1), + ('NAMO', 'NWW07', 2023, 14, 6, 1), + ('NAMO', 'NWW08', 2023, 100, 106, 1), + ('NAMO', 'NWW09', 2023, 20, 22, 1), + ('SA', 'NWW10', 2023, 51, 42, 1), + ('SA', 'PEL01', 2023, 130, 37, 1), + ('SA', 'PEL02', 2023, 30, 2, 1), + ('SA', 'PEL03', 2023, 23, 12, 1), + ('SA', 'PEL04', 2023, 2, 0, 1), + ('SA', 'PEL05', 2023, 139, 43, 1), + ('SA', 'PEL06', 2023, 3, 0, 1), + ('SA', 'PEL08', 2023, 53, 51, 1), + ('SA', 'PEL13', 2023, 32, 20, 1), + ('SA', 'PEL14', 2023, 8, 7, 1), + ('SA', 'PEL15', 2023, 0, 129, 1), + ('SA', 'SWW01', 2023, 130, 37, 1), + ('SA', 'SWW02', 2023, 30, 2, 1), + ('SA', 'SWW03', 2023, 23, 12, 1), + ('SA', 'SWW04', 2023, 2, 0, 1), + ('SA', 'SWW05', 2023, 139, 43, 1), + ('SA', 'SWW06', 2023, 3, 0, 1), + ('SA', 'SWW07', 2023, 53, 51, 1), + ('SA', 'SWW08', 2023, 32, 20, 1), + ('SA', 'SWW09', 2023, 8, 7, 1), + ('SA', 'SWW10', 2023, 0, 129, 1); UPDATE control_objectives SET year = date_part('year', CURRENT_DATE) WHERE year = 2023; UPDATE control_objectives SET year = date_part('year', CURRENT_DATE - interval '1 year') WHERE year = 2022; diff --git a/frontend/cypress/e2e/back_office/fleet_segment_table.spec.ts b/frontend/cypress/e2e/back_office/fleet_segment_table.spec.ts index dc9875327a..838382b70e 100644 --- a/frontend/cypress/e2e/back_office/fleet_segment_table.spec.ts +++ b/frontend/cypress/e2e/back_office/fleet_segment_table.spec.ts @@ -19,17 +19,19 @@ context('BackOffice > Fleet Segments Table', () => { cy.log('Should render the fleet segments') // Then - cy.get('.rs-table-row').should('have.length', 44) - cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('1.7') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('ATL01') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('All Trawls 3') + cy.get('.rs-table-row').should('have.length', 68) + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('ATL01') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('3.1') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('ATL01') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('OTM') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('PTM') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('BFT') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('27.7') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('27.8') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('27.9') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('27.10') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('27.7') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('27.8') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('27.9') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('27.10') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('BFT') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="10"]').contains('0') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="12"]').contains('3') // ------------------------------------------------------------------------- cy.log('Should update the segment') @@ -38,12 +40,13 @@ context('BackOffice > Fleet Segments Table', () => { cy.intercept('PUT', `/bff/v1/admin/fleet_segments?year=${currentYear}&segment=ATL01`).as('updateFleetSegment') cy.get('[aria-rowindex="2"]').find('[title="Editer la ligne"]').click() - cy.fill('Nom', 'ATL036') + cy.fill('Nom', 'ATL0036') cy.fill('Note d’impact', 1.2) + cy.fill('Maillage min.', 50) + cy.fill('Maillage max.', 100) cy.fill('Description', 'All Trawls 45') cy.fill('Engins', ['DRM', 'FAG']) cy.fill('Espèces ciblées', ['COD']) - cy.fill('Prises accessoires', ['HKE']) cy.fill('Zones FAO', ['21.0.A']) cy.clickButton('Modifier') @@ -53,41 +56,42 @@ context('BackOffice > Fleet Segments Table', () => { } assert.deepInclude(interception.request.body, { - bycatchSpecies: ['HKE'], - dirm: ['MED', 'SA', 'NAMO', 'MEMN'], faoAreas: ['21.0.A'], gears: ['DRM', 'FAG'], impactRiskFactor: 1.2, - segment: 'ATL036', + minMesh: 50, + maxMesh: 100, + segment: 'ATL0036', segmentName: 'All Trawls 45', targetSpecies: ['COD'], - year: 2024 }) }) - cy.get('.rs-table-row').should('have.length', 44) - cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('1.2') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('ATL036') + cy.get('.rs-table-row').should('have.length', 68) + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('ATL0036') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('1.2') cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('All Trawls 45') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('DRM') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('FAG') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('COD') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('HKE') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.0.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.0.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('50') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('100') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('COD') cy.intercept('GET', `/bff/v1/fleet_segments/${currentYear}`).as('fleetSegments') cy.visit('/backoffice/fleet_segments') cy.wait('@fleetSegments') - cy.get('.rs-table-row').should('have.length', 44) - cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('1.2') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('ATL036') + cy.get('.rs-table-row').should('have.length', 68) + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('ATL0036') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('1.2') cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('All Trawls 45') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('DRM') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('FAG') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('COD') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('HKE') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.0.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.0.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('50') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('100') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('COD') }) it('Should create a new fleet segment and delete it', () => { @@ -100,39 +104,54 @@ context('BackOffice > Fleet Segments Table', () => { cy.fill('Note d’impact', 2.7) cy.fill('Description', 'Malotru’s segment') cy.fill('Engins', ['DHS', 'FCN']) - cy.fill('Espèces ciblées', ['COD', 'SOL']) - cy.fill('Prises accessoires', ['FRF']) cy.fill('Zones FAO', ['21.1.A', '21.1.B']) + cy.fill('Maillage min.', 50) + cy.fill('Maillage max.', 100) + cy.fill('Type espèce SCIP', "DEMERSAL") + cy.fill('Espèces ciblées', ['COD', 'SOL']) + cy.fill('Pourcent. min. espèces', 0.2) + cy.fill('Types de navires', ["Chalutier pêche arrière - congélateur"]) + cy.fill('Priorité', 2) cy.clickButton('Ajouter') cy.wait('@createFleetSegment') // Then - cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('2.7') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('ABC123') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('ABC123') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('2.7') cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('Malotru’s segment') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('DHS') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('FCN') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('COD') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('SOL') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('FRF') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.1.A') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.1.B') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.1.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.1.B') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('50') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('100') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="8"]').contains('DEMERSAL') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('COD') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('SOL') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="10"]').contains('0.2') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="11"]').contains('Chalutier pêche arrière - congélateur') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="12"]').contains('2') // The value is saved in database when I refresh the page cy.intercept('GET', `/bff/v1/fleet_segments/${currentYear}`).as('fleetSegments') cy.visit('/backoffice/fleet_segments') cy.wait('@fleetSegments') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('2.7') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('ABC123') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').contains('ABC123') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').contains('2.7') cy.get('[aria-rowindex="2"]').find('[aria-colindex="3"]').contains('Malotru’s segment') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('DHS') cy.get('[aria-rowindex="2"]').find('[aria-colindex="4"]').contains('FCN') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('COD') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('SOL') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('FRF') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.1.A') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('21.1.B') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.1.A') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="5"]').contains('21.1.B') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="6"]').contains('50') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="7"]').contains('100') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="8"]').contains('DEMERSAL') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('COD') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="9"]').contains('SOL') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="10"]').contains('0.2') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="11"]').contains('Chalutier pêche arrière - congélateur') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="12"]').contains('2') // ------------------------------------------------------------------------- cy.log('Should delete a fleet segment') @@ -141,12 +160,12 @@ context('BackOffice > Fleet Segments Table', () => { cy.get('[aria-rowindex="2"]').find('[title="Supprimer la ligne"]').click() cy.wait('@deleteFleetSegment') - cy.get('[aria-rowindex="2"]').find('[aria-colindex="2"]').should('not.contain', 'ABC123') + cy.get('[aria-rowindex="2"]').find('[aria-colindex="1"]').should('not.contain', 'ABC123') }) it('Should show previous year fleet segments', () => { cy.get('[id="fleet-segments-select-year-describe"]').contains(currentYear) - cy.get('[role="row"]').should('have.length', 44) + cy.get('[role="row"]').should('have.length', 68) cy.intercept('GET', `/bff/v1/fleet_segments/${currentYear - 1}`).as('fleetSegments') // When @@ -154,20 +173,20 @@ context('BackOffice > Fleet Segments Table', () => { // Then cy.get('[id="fleet-segments-select-year-describe"]').contains(currentYear - 1) - cy.get('[role="row"]').should('have.length', 24) + cy.get('[role="row"]').should('have.length', 44) }) it('Should add a new year based on current year', () => { // Given const yearToAdd = currentYear - 9 cy.get('[id="fleet-segments-select-year-describe"]').contains(currentYear) - cy.get('[role="row"]').should('have.length', 44) + cy.get('[role="row"]').should('have.length', 68) // When cy.fill("l'année", `${yearToAdd}`) // Then cy.get('[id="fleet-segments-select-year-describe"]').contains(yearToAdd) - cy.get('[role="row"]').should('have.length', 44) + cy.get('[role="row"]').should('have.length', 68) }) }) diff --git a/frontend/src/features/ControlObjective/components/ControlObjectiveTable/SeafrontControlObjectives.tsx b/frontend/src/features/ControlObjective/components/ControlObjectiveTable/SeafrontControlObjectives.tsx index 3e90af5fc4..2386715075 100644 --- a/frontend/src/features/ControlObjective/components/ControlObjectiveTable/SeafrontControlObjectives.tsx +++ b/frontend/src/features/ControlObjective/components/ControlObjectiveTable/SeafrontControlObjectives.tsx @@ -2,11 +2,9 @@ import { BackOfficeTitle } from '@features/BackOffice/components/BackOfficeTitle import { ControlPriorityCell, DeleteCell, - ExpandCell, ImpactRiskFactorCell, INPUT_TYPE, ModifiableCell, - renderRowExpanded, SegmentCellWithTitle } from '@features/Regulation/components/RegulationTables/tableCells' import { sortArrayByColumn, SortType } from '@features/Vessel/components/VesselList/tableSort' @@ -38,7 +36,6 @@ export type SeafrontControlObjectivesProps = Readonly<{ year: number }> export function SeafrontControlObjectives({ data, facade, title, year }: SeafrontControlObjectivesProps) { - const [expandedRowKeys, setExpandedRowKeys] = useState([]) const [controlObjectivesWithMaybeFleetSegment, setControlObjectivesWithMaybeFleetSegment] = useState< ControlObjectiveWithMaybeFleetSegment[] >([]) @@ -169,29 +166,6 @@ export function SeafrontControlObjectives({ data, facade, title, year }: Seafron [updateControlObjectiveDebounced] ) - // TODO Make that functional programming friendly. - const handleExpanded = useCallback( - (rowData: ControlObjectiveWithMaybeFleetSegment) => { - let open = false - const nextExpandedRowKeys: number[] = [] - - expandedRowKeys.forEach(id => { - if (id === rowData.id) { - open = true - } else { - nextExpandedRowKeys.push(id) - } - }) - - if (!open) { - nextExpandedRowKeys.push(rowData.id) - } - - setExpandedRowKeys(nextExpandedRowKeys) - }, - [expandedRowKeys] - ) - const handleSortColumn = useCallback((nextSortColumn: keyof ControlObjective, nextSortType: SortType) => { setSortColumn(nextSortColumn) setSortType(nextSortType) @@ -235,26 +209,18 @@ export function SeafrontControlObjectives({ data, facade, title, year }: Seafron - - - - - Segment diff --git a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/CreateOrEditFleetSegmentModal.tsx b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/CreateOrEditFleetSegmentModal.tsx index 9a57cc4882..f779d01ad5 100644 --- a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/CreateOrEditFleetSegmentModal.tsx +++ b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/CreateOrEditFleetSegmentModal.tsx @@ -1,12 +1,22 @@ import { FLEET_SEGMENT_FORM_SCHEMA } from '@features/FleetSegment/components/FleetSegmentsBackoffice/schema' +import { FLEET_SEGMENT_VESSEL_TYPES } from '@features/FleetSegment/constants' import { useMainAppSelector } from '@hooks/useMainAppSelector' -import { Button, FormikMultiSelect, FormikNumberInput, FormikTextInput, THEME } from '@mtes-mct/monitor-ui' +import { + Button, + FormikMultiSelect, + FormikNumberInput, + FormikSelect, + FormikTextInput, + THEME +} from '@mtes-mct/monitor-ui' +import { getOptionsFromStrings } from '@utils/getOptionsFromStrings' import { Form, Formik } from 'formik' import { useMemo } from 'react' import { Footer, Modal } from 'rsuite' import styled from 'styled-components' import { StyledModalHeader } from '../../../commonComponents/StyledModalHeader' +import { ScipSpeciesType } from '../../types' import type { FleetSegment, UpdateFleetSegment } from '../../types' @@ -35,13 +45,18 @@ export function CreateOrEditFleetSegmentModal({ } return { - bycatchSpecies: [], faoAreas: [], gears: [], impactRiskFactor: undefined, + mainScipSpeciesType: undefined, + maxMesh: undefined, + minMesh: undefined, + minShareOfTargetSpecies: undefined, + priority: 0, segment: undefined, segmentName: undefined, targetSpecies: [], + vesselTypes: [], year } }, [updatedFleetSegment, year]) @@ -62,7 +77,7 @@ export function CreateOrEditFleetSegmentModal({ } return ( - + {updatedFleetSegment ? 'Modifier' : 'Ajouter'} un segment de flotte @@ -72,42 +87,69 @@ export function CreateOrEditFleetSegmentModal({
- - + + + + + + + + + + ({ label: gear.code, value: gear.code }))} + searchable + virtualized + /> + ({ label: _faoAreas, value: _faoAreas }))} + searchable + virtualized + /> + + + + + + + + + - - + + + + + + + + + + + + - - ({ label: gear.code, value: gear.code }))} - searchable - virtualized - /> - - - ({ label: _faoAreas, value: _faoAreas }))} - searchable - virtualized - />
{updatedFleetSegment ? 'Modifier' : 'Ajouter'} diff --git a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/FleetSegmentsTable.tsx b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/FleetSegmentsTable.tsx index 2b4fbc9c26..e05374a4fe 100644 --- a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/FleetSegmentsTable.tsx +++ b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/FleetSegmentsTable.tsx @@ -8,11 +8,23 @@ import { Table } from 'rsuite' import { getAllGearCodes } from '../../../../domain/use_cases/gearCode/getAllGearCodes' import { getAllSpecies } from '../../../../domain/use_cases/species/getAllSpecies' +import type { FleetSegment, UpdateFleetSegment } from '@features/FleetSegment/types' import type { MainAppAsyncThunk } from '@store' const { Cell, Column, HeaderCell } = Table -export function FleetSegmentsTable({ faoAreas, fleetSegments, onDeleteFleetSegment, openEditFleetSegmentModal }) { +type FleetSegmentsTableProps = Readonly<{ + faoAreas: string[] + fleetSegments: FleetSegment[] + onDeleteFleetSegment: (segment: string, year: number) => void + openEditFleetSegmentModal: (segment: string, year: number, nextFleetSegment: UpdateFleetSegment) => Promise +}> +export function FleetSegmentsTable({ + faoAreas, + fleetSegments, + onDeleteFleetSegment, + openEditFleetSegmentModal +}: FleetSegmentsTableProps) { const dispatch = useMainAppDispatch() const gears = useMainAppSelector(state => state.gear.gears) const species = useMainAppSelector(state => state.species.species) @@ -27,7 +39,7 @@ export function FleetSegmentsTable({ faoAreas, fleetSegments, onDeleteFleetSegme
+ + Segment + + + N. impact - - Segment - - - - + Nom du segment - + Engins ({ label: gear.code, value: gear.code }))} dataKey="gears" id="segment" /> - - Espèces ciblées + + FAO ({ label: gear.code, value: gear.code }))} - dataKey="targetSpecies" + data={faoAreas.map(faoArea => ({ label: faoArea, value: faoArea }))} + dataKey="faoAreas" id="segment" /> - - Prises accessoires - ({ label: _species.code, value: _species.code }))} - dataKey="bycatchSpecies" - id="segment" - /> + + Maill. min. + - - FAO + + Maill. max. + + + + + Espèce SCIP + + + + + Espèces ciblées ({ label: faoArea, value: faoArea }))} - dataKey="faoAreas" + data={species.map(gear => ({ label: gear.code, value: gear.code }))} + dataKey="targetSpecies" id="segment" /> - + + Pourcent. min. + + + + + Types de navires + + + + + Priorité + + + + (/\s/.test(originalValue) ? undefined : value)), segmentName: string(), targetSpecies: array(string()), + vesselTypes: array(string()), year: number().required() }) diff --git a/frontend/src/features/FleetSegment/constants.ts b/frontend/src/features/FleetSegment/constants.ts new file mode 100644 index 0000000000..d72cbb374e --- /dev/null +++ b/frontend/src/features/FleetSegment/constants.ts @@ -0,0 +1,5 @@ +export const FLEET_SEGMENT_VESSEL_TYPES = [ + 'Chalutier pêche arrière - congélateur', + 'Chalutier pêche arr. congélateur rampe port. fixe', + 'Chalutiers pêche arrière congélateurs' +] diff --git a/frontend/src/features/FleetSegment/types.ts b/frontend/src/features/FleetSegment/types.ts index fe33cea9fc..0bf63f240c 100644 --- a/frontend/src/features/FleetSegment/types.ts +++ b/frontend/src/features/FleetSegment/types.ts @@ -1,24 +1,27 @@ +import type { Undefine } from '@mtes-mct/monitor-ui' import type { Float } from 'type-fest' +export enum ScipSpeciesType { + DEMERSAL = 'DEMERSAL', + OTHER = 'OTHER', + PELAGIC = 'PELAGIC', + TUNA = 'TUNA' +} + export type FleetSegment = { - bycatchSpecies: string[] | undefined faoAreas: string[] | undefined gears: string[] | undefined impactRiskFactor: Float | undefined + mainScipSpeciesType: ScipSpeciesType | undefined + maxMesh: number | undefined + minMesh: number | undefined + minShareOfTargetSpecies: number | undefined + priority: number segment: string - // TODO Can this be undefined? segmentName: string | undefined targetSpecies: string[] | undefined + vesselTypes: string[] year: number } -export type UpdateFleetSegment = { - bycatchSpecies: string[] | undefined - faoAreas: string[] | undefined - gears: string[] | undefined - impactRiskFactor: Float | undefined - segment: string | undefined - segmentName: string | undefined - targetSpecies: string[] | undefined - year: number | undefined -} +export type UpdateFleetSegment = Undefine diff --git a/frontend/src/features/Regulation/components/RegulationTables/tableCells.tsx b/frontend/src/features/Regulation/components/RegulationTables/tableCells.tsx index b2eef9e455..c82cfa2286 100644 --- a/frontend/src/features/Regulation/components/RegulationTables/tableCells.tsx +++ b/frontend/src/features/Regulation/components/RegulationTables/tableCells.tsx @@ -133,7 +133,8 @@ export function FleetSegmentInput({ marginRight: 0, marginTop: withinCell ? -8 : 5, paddingLeft: 5, - paddingRight: 10 + paddingRight: 10, + width: 100 }} type="text" value={value} @@ -188,34 +189,6 @@ export function SegmentCellWithTitle({ dataKey, rowData, ...props }: SegmentCell ) } -type ExpandCellProps = Readonly< - Omit, 'onChange' | 'rowData'> & - React.RefAttributes & { - expandedRowKeys: (number | string)[] - onChange: (rowData: any) => void - rowData?: any - } -> -export function ExpandCell({ dataKey, expandedRowKeys, onChange, rowData, ...props }: ExpandCellProps) { - return ( - { - onChange(rowData) - }} - style={{ - background: THEME.color.gainsboro, - cursor: 'pointer', - fontSize: 19, - lineHeight: '13px', - width: 35 - }} - > - {expandedRowKeys.some(key => key === rowData[rowKey]) ? '-' : '+'} - - ) -} - type RiskFactorCellProps = Readonly< Omit, 'rowData'> & { expandedRowKeys?: (number | string)[] @@ -226,7 +199,7 @@ type RiskFactorCellProps = Readonly< export function ImpactRiskFactorCell({ expandedRowKeys, onChange, rowData, ...props }: RiskFactorCellProps) { return ( - + {rowData.impactRiskFactor} @@ -258,47 +231,13 @@ const Wrapper = styled.div` } ` -export function renderTagPickerValue(items) { - return items.filter(tag => tag).map(tag => {tag?.label}) -} - const TagOnly = styled.div` - margin: -3px 0px 0px 0px; + margin-top: 7px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; ` -export const renderRowExpanded = rowData => ( -
- - -
- Engins - {rowData.gears?.join(', ') || -} - - - Zones FAO - {rowData.faoAreas?.join(', ') || -} - - - Espèces cibles - {rowData.targetSpecies?.join(', ') || -} - - - Prises accessoires - {rowData.bycatchSpecies?.join(', ') || -} - - - - -) - export function EditAndDeleteCell({ dataKey, id, onDelete, onEdit, ...props }) { const { rowData } = props @@ -308,7 +247,7 @@ export function EditAndDeleteCell({ dataKey, id, onDelete, onEdit, ...props }) { accent={Accent.TERTIARY} data-cy={`edit-row-${rowData[id]}`} Icon={Icon.EditUnbordered} - iconSize={17} + iconSize={20} onClick={() => onEdit(rowData)} title="Editer la ligne" /> @@ -316,7 +255,8 @@ export function EditAndDeleteCell({ dataKey, id, onDelete, onEdit, ...props }) { accent={Accent.TERTIARY} data-cy={`delete-row-${rowData[id]}`} Icon={Icon.Delete} - iconSize={17} + iconSize={20} + style={{ marginLeft: 7 }} onClick={() => onDelete(rowData[id])} title="Supprimer la ligne" /> @@ -336,32 +276,10 @@ export function DeleteCell({ dataKey, id, onClick, ...props }) { iconSize={17} onClick={() => onClick(rowData[id], rowData[dataKey])} title="Supprimer la ligne" + style={{ + margin: 8 + }} /> ) } - -const TableBody = styled.tbody`` - -const Fields = styled.table` - text-align: left; -` - -const Key = styled.th` - color: ${p => p.theme.color.slateGray}; - font-size: 13px; - font-weight: normal; - line-height: 1.5; - width: 140px; -` - -const Value = styled.td` - color: ${p => p.theme.color.gunMetal}; - font-size: 13px; - font-weight: 500; -` - -const NoValue = styled.span` - color: ${p => p.theme.color.slateGray}; - font-weight: 300; -`