diff --git a/editoast/openapi.yaml b/editoast/openapi.yaml index 7964e836f30..f48e8cccd12 100644 --- a/editoast/openapi.yaml +++ b/editoast/openapi.yaml @@ -1297,6 +1297,9 @@ components: type: object PathWaypoint: properties: + ch: + nullable: true + type: string duration: format: double type: number @@ -1317,6 +1320,10 @@ components: $ref: '#/components/schemas/GeoJsonPoint' suggestion: type: boolean + uic: + format: int64 + nullable: true + type: integer required: - id - name @@ -1326,6 +1333,8 @@ components: - suggestion - geo - sch + - uic + - ch type: object PathfindingPayload: description: |- @@ -1748,6 +1757,9 @@ components: type: object ResultStops: properties: + ch: + nullable: true + type: string duration: format: double type: number @@ -1761,6 +1773,7 @@ components: - time - position - duration + - ch type: object RjsPowerRestrictionRange: description: A range along the train path where a power restriction is applied. diff --git a/editoast/src/fixtures.rs b/editoast/src/fixtures.rs index 80dab111fb8..c5a4bff142f 100644 --- a/editoast/src/fixtures.rs +++ b/editoast/src/fixtures.rs @@ -478,11 +478,13 @@ pub mod tests { time: 0.0, duration: 0.0, position: 0.0, + ch: None, }, ResultStops { time: 110.90135448736316, duration: 1.0, position: 2417.6350658673214, + ch: None, }, ], head_positions: vec![ResultPosition { diff --git a/editoast/src/models/pathfinding.rs b/editoast/src/models/pathfinding.rs index 1f5aa681846..e265373aec9 100644 --- a/editoast/src/models/pathfinding.rs +++ b/editoast/src/models/pathfinding.rs @@ -185,6 +185,10 @@ pub struct PathWaypoint { ))] #[schema(value_type = GeoJsonPoint)] pub sch: geojson::Geometry, + #[schema(required)] + pub uic: Option, + #[schema(required)] + pub ch: Option, } impl Pathfinding { diff --git a/editoast/src/models/train_schedule.rs b/editoast/src/models/train_schedule.rs index 27cded2ea38..1d05448c45a 100644 --- a/editoast/src/models/train_schedule.rs +++ b/editoast/src/models/train_schedule.rs @@ -239,6 +239,8 @@ pub struct ResultStops { pub time: f64, pub position: f64, pub duration: f64, + #[schema(required)] + pub ch: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default, ToSchema)] diff --git a/editoast/src/views/pathfinding/mod.rs b/editoast/src/views/pathfinding/mod.rs index aa2cf1b4622..fb8f8b162ce 100644 --- a/editoast/src/views/pathfinding/mod.rs +++ b/editoast/src/views/pathfinding/mod.rs @@ -375,12 +375,18 @@ impl Pathfinding { } else { steps_duration.next().unwrap() }; - let op_name = waypoint - .id - .as_ref() - .map(|op_id| op_map.get(op_id).expect("unexpected OP id")) - .and_then(|op| op.extensions.identifier.as_ref()) - .map(|ident| ident.name.as_ref().to_owned()); + let op_info = waypoint.id.as_ref().map(|op_id| { + let op = op_map.get(op_id).expect("unexpected OP id"); + let name = op + .extensions + .identifier + .as_ref() + .map(|ident| ident.name.as_ref().to_owned()); + let uic = op.extensions.identifier.as_ref().map(|ident| ident.uic); + let ch = op.extensions.sncf.as_ref().map(|sncf| sncf.ch.to_owned()); + (name, uic, ch) + }); + let (name, uic, ch) = op_info.unwrap_or_default(); let track = track_map .get(&waypoint.location.track_section.0) .expect("unexpected track id"); @@ -397,13 +403,15 @@ impl Pathfinding { let sch = geos::geojson::Geometry::try_from(sch).unwrap(); PathWaypoint { id: waypoint.id.clone(), - name: op_name, + name, location: waypoint.location.clone(), duration, path_offset: waypoint.path_offset, suggestion: waypoint.suggestion, geo, sch, + uic, + ch, } }) .collect(); diff --git a/editoast/src/views/train_schedule/simulation_report.rs b/editoast/src/views/train_schedule/simulation_report.rs index d350faaa646..12c5d0fcdd7 100644 --- a/editoast/src/views/train_schedule/simulation_report.rs +++ b/editoast/src/views/train_schedule/simulation_report.rs @@ -273,6 +273,7 @@ async fn add_stops_additional_information( time: s.time, position: s.position, duration: s.duration, + ch: pw.ch.clone(), }, id: pw.id.clone(), name: pw.name.clone(), @@ -286,6 +287,7 @@ async fn add_stops_additional_information( time: s.time, position: s.position, duration: s.duration, + ch: pw.ch.clone(), }, ..Default::default() }, diff --git a/front/src/applications/operationalStudies/consts.ts b/front/src/applications/operationalStudies/consts.ts index a33ad71406a..0380885c67d 100644 --- a/front/src/applications/operationalStudies/consts.ts +++ b/front/src/applications/operationalStudies/consts.ts @@ -113,6 +113,8 @@ export interface PointOnMap { track?: string; position?: number; path_offset?: number; + uic?: number | null; + ch?: string | null; location?: { track_section?: string; offset?: number; diff --git a/front/src/common/StationCard.tsx b/front/src/common/StationCard.tsx index c7825ec7f17..b86f0e9c995 100644 --- a/front/src/common/StationCard.tsx +++ b/front/src/common/StationCard.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import { formatUicToCi } from 'utils/strings'; export interface ImportStation { trigram?: string; @@ -33,17 +34,15 @@ export default function StationCard({ station, onClick, fixedHeight = false }: P >
{trigram} - {name} - {yardname && !yardNamesToExclude.includes(yardname) && ( - {yardname} - )} + {name}  + {yardname && !yardNamesToExclude.includes(yardname) && {yardname}} + {uic && {formatUicToCi(uic)}}
{town} {department} {department && region &&
/
} {region} - {uic}
{linename && (
diff --git a/front/src/common/api/osrdEditoastApi.ts b/front/src/common/api/osrdEditoastApi.ts index dc2a80f7bd4..5bf0f5b1941 100644 --- a/front/src/common/api/osrdEditoastApi.ts +++ b/front/src/common/api/osrdEditoastApi.ts @@ -1642,6 +1642,7 @@ export type GeoJsonPoint = { type: 'Point'; }; export type PathWaypoint = { + ch: string | null; duration: number; geo: GeoJsonPoint; id: string | null; @@ -1650,6 +1651,7 @@ export type PathWaypoint = { path_offset: number; sch: GeoJsonPoint; suggestion: boolean; + uic: number | null; }; export type PathResponse = { created: string; @@ -2200,6 +2202,7 @@ export type ResultSpeed = { time: number; }; export type ResultStops = { + ch: string | null; duration: number; position: number; time: number; diff --git a/front/src/modules/trainschedule/components/DriverTrainSchedule/DriverTrainScheduleStop.tsx b/front/src/modules/trainschedule/components/DriverTrainSchedule/DriverTrainScheduleStop.tsx index 3939dcc5333..a9019f0c28c 100644 --- a/front/src/modules/trainschedule/components/DriverTrainSchedule/DriverTrainScheduleStop.tsx +++ b/front/src/modules/trainschedule/components/DriverTrainSchedule/DriverTrainScheduleStop.tsx @@ -52,7 +52,10 @@ export default function DriverTrainScheduleStop({ stop, idx, train }: Props) {
{Number.isInteger(pk) ? `${pk}.0` : pk}
- {stop.name || 'Unknown'} + + {stop.name || 'Unknown'}  + {stop.ch} +
diff --git a/front/src/modules/trainschedule/components/ImportTrainSchedule/generateTrainSchedulesPayload.ts b/front/src/modules/trainschedule/components/ImportTrainSchedule/generateTrainSchedulesPayload.ts index c1b285b958e..6845243ca76 100644 --- a/front/src/modules/trainschedule/components/ImportTrainSchedule/generateTrainSchedulesPayload.ts +++ b/front/src/modules/trainschedule/components/ImportTrainSchedule/generateTrainSchedulesPayload.ts @@ -3,7 +3,7 @@ import { PathWaypoint, TrainScheduleBatchItem } from 'common/api/osrdEditoastApi import { time2sec } from 'utils/timeManipulation'; // Hope for indexes are the same ! -// Synchronisation is done with indexes between pathfinding not suggered positions, and required steps from importation +// Synchronisation is done with indexes between pathfinding not suggested positions, and required steps from importation function mixPathPositionsAndTimes(requiredSteps: Step[], pathFindingWaypoints: PathWaypoint[]) { const startTime = new Date(requiredSteps[0].departureTime); const pathFindingStepsFiltered = pathFindingWaypoints.filter((waypoint) => !waypoint.suggestion); diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/Allowances/AllowancesModalOP.tsx b/front/src/modules/trainschedule/components/ManageTrainSchedule/Allowances/AllowancesModalOP.tsx index f83cecd4099..5f1703ead94 100644 --- a/front/src/modules/trainschedule/components/ManageTrainSchedule/Allowances/AllowancesModalOP.tsx +++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/Allowances/AllowancesModalOP.tsx @@ -27,7 +27,10 @@ export default function AllowancesModalOP({ key={waypoint.path_offset} >
{waypoint.path_offset}
-
{waypoint.name}
+
+ {waypoint.name}  + {waypoint.ch === '00' || !waypoint.ch ? 'BV' : `${waypoint.ch}`} +
))}
diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayVias.tsx b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayVias.tsx index f27551348bf..44bea1b869f 100644 --- a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayVias.tsx +++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayVias.tsx @@ -9,6 +9,7 @@ import cx from 'classnames'; import { AnyAction, ThunkAction } from '@reduxjs/toolkit'; import { Position } from 'geojson'; import { RootState } from 'reducers'; +import { formatUicToCi } from 'utils/strings'; type InputStopTimeProps = { index: number; @@ -99,6 +100,10 @@ export default function DisplayVias({ zoomToFeaturePoint }: DisplayViasProps) { `KM ${place.position && Math.round(place.position) / 1000}` }`} + {place.ch} + {place.uic && ( + {formatUicToCi(place.uic)} + )}
{index !== indexSelected && (
diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/ModalSuggeredVias.tsx b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/ModalSuggeredVias.tsx index 169e340d0ca..6626e377eeb 100644 --- a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/ModalSuggeredVias.tsx +++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/ModalSuggeredVias.tsx @@ -11,6 +11,8 @@ import { ModalContext } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider'; import { Spinner } from 'common/Loader'; import type { ArrayElement } from 'utils/types'; import type { PathResponse, PathWaypoint } from 'common/api/osrdEditoastApi'; +import { formatUicToCi } from 'utils/strings'; +import cx from 'classnames'; type Props = { removeAllVias: () => void; @@ -65,32 +67,37 @@ export default function ModalSugerredVias({ removeAllVias, pathfindingInProgress const formatVia = (via: ArrayElement, idx: number, idxTrueVia: number) => (
{!via.suggestion && {idxTrueVia}} - {via.name || ''} - - {via.path_offset && `KM ${Math.round(via.path_offset) / 1000}`} - - {via.suggestion && via.id && !selectedViasTracks.includes(via.id) ? ( - - ) : ( - - )} + {via.name || ''}  + {via.ch} + {via.uic && {formatUicToCi(via.uic)}} +
+ {via.path_offset && ( + {`KM ${Math.round(via.path_offset) / 1000}`} + )} + {via.suggestion && via.id && !selectedViasTracks.includes(via.id) ? ( + + ) : ( + + )} +
); @@ -104,7 +111,7 @@ export default function ModalSugerredVias({ removeAllVias, pathfindingInProgress -
+
{pathfindingInProgress && } {suggeredVias && suggeredVias.map((via, idx) => { diff --git a/front/src/modules/trainschedule/styles/ManageTrainSchedule/_itinerary.scss b/front/src/modules/trainschedule/styles/ManageTrainSchedule/_itinerary.scss index 75e65d3d5d8..87247313c04 100644 --- a/front/src/modules/trainschedule/styles/ManageTrainSchedule/_itinerary.scss +++ b/front/src/modules/trainschedule/styles/ManageTrainSchedule/_itinerary.scss @@ -34,7 +34,7 @@ } .manage-vias-modal { - .suggered-vias { + .suggested-vias { max-height: 30vh; overflow-y: auto; .loaderPathfindingInProgress { @@ -48,11 +48,20 @@ border-radius: 0 0 4px 4px; background-color: rgba(242, 242, 242, 0.75); } - .suggerred-via-clickable { - cursor: pointer; - border-radius: 4px; - &:hover { - background-color: var(--coolgray1); + .suggested-via { + &-clickable { + cursor: pointer; + border-radius: 4px; + &:hover { + background-color: var(--coolgray1); + } + } + + &-name { + max-width: 47%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } } } diff --git a/front/src/reducers/osrdconf2/common/tests/commonConfBuilder.ts b/front/src/reducers/osrdconf2/common/tests/commonConfBuilder.ts index 600efe9e20e..cf2d8db9380 100644 --- a/front/src/reducers/osrdconf2/common/tests/commonConfBuilder.ts +++ b/front/src/reducers/osrdconf2/common/tests/commonConfBuilder.ts @@ -107,6 +107,8 @@ export default function commonConfBuilder() { type: 'Point', }, suggestion: true, + ch: null, + uic: null, }, ], }), diff --git a/front/src/reducers/osrdsimulation/types.ts b/front/src/reducers/osrdsimulation/types.ts index 6685cb8d65c..179ffcd8cca 100644 --- a/front/src/reducers/osrdsimulation/types.ts +++ b/front/src/reducers/osrdsimulation/types.ts @@ -80,6 +80,7 @@ export interface Stop { track_number: number | null; line_name: string | null; track_name: string | null; + ch?: string | null; } export interface RouteAspect