Skip to content

Commit 6c9aefe

Browse files
committed
front+editoast: remove route starting direction parameter
1 parent ce3730b commit 6c9aefe

File tree

5 files changed

+9
-54
lines changed

5 files changed

+9
-54
lines changed

editoast/openapi.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -4144,12 +4144,7 @@ paths:
41444144
ending:
41454145
$ref: '#/components/schemas/TrackLocation'
41464146
starting:
4147-
allOf:
4148-
- $ref: '#/components/schemas/TrackLocation'
4149-
- properties:
4150-
direction:
4151-
$ref: '#/components/schemas/Direction'
4152-
type: object
4147+
$ref: '#/components/schemas/TrackLocation'
41534148
type: object
41544149
description: Starting and ending track location
41554150
responses:

editoast/openapi_legacy.yaml

+1-6
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,7 @@ paths:
642642
type: object
643643
properties:
644644
starting:
645-
allOf:
646-
- $ref: "#/components/schemas/TrackLocation"
647-
- type: object
648-
properties:
649-
direction:
650-
$ref: "#/components/schemas/Direction"
645+
$ref: "#/components/schemas/TrackLocation"
651646
ending:
652647
$ref: "#/components/schemas/TrackLocation"
653648
responses:

editoast/src/views/infra/pathfinding.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ enum PathfindingViewErrors {
4545
struct PathfindingTrackLocationDirInput {
4646
track: Identifier,
4747
position: f64,
48-
direction: Direction,
4948
}
5049

5150
#[derive(Debug, Clone, Deserialize)]
@@ -128,11 +127,11 @@ struct PathfindingStep {
128127
}
129128

130129
impl PathfindingStep {
131-
fn new_init(track: String, position: f64, direction: Direction) -> Self {
130+
fn new_init(track: String, position: f64) -> Self {
132131
Self {
133132
track,
134133
position,
135-
direction,
134+
direction: Direction::StartToStop, // Ignored for initial node
136135
switch_direction: None,
137136
found: false,
138137
starting_step: true,
@@ -185,7 +184,7 @@ fn compute_path(
185184
k: u8,
186185
) -> Vec<PathfindingOutput> {
187186
let start = &input.starting;
188-
let start = PathfindingStep::new_init(start.track.0.clone(), start.position, start.direction);
187+
let start = PathfindingStep::new_init(start.track.0.clone(), start.position);
189188

190189
let track_sections = infra_cache.track_sections();
191190
// Transform a length (in m) into a cost (in mm). This provide the Ord implementation for our cost using u64.
@@ -403,7 +402,6 @@ mod tests {
403402
starting: PathfindingTrackLocationDirInput {
404403
track: "A".into(),
405404
position: 30.0,
406-
direction: Direction::StartToStop,
407405
},
408406
ending: PathfindingTrackLocationInput {
409407
track: "C".into(),
@@ -427,7 +425,6 @@ mod tests {
427425
starting: PathfindingTrackLocationDirInput {
428426
track: "A".into(),
429427
position: 30.0,
430-
direction: Direction::StopToStart,
431428
},
432429
ending: PathfindingTrackLocationInput {
433430
track: "C".into(),

front/src/applications/editor/tools/routeEdition/components/Endpoints.tsx

+3-33
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import Select from 'react-select';
2-
import React, { FC, useContext, useMemo } from 'react';
1+
import React, { FC, useContext } from 'react';
32
import { BsArrowBarRight, BsBoxArrowInRight } from 'react-icons/bs';
43
import { HiSwitchVertical } from 'react-icons/hi';
54
import { FaFlagCheckered } from 'react-icons/fa';
65
import { useTranslation } from 'react-i18next';
76
import { useDispatch, useSelector } from 'react-redux';
87

98
import { getInfraID } from 'reducers/osrdconf/selectors';
10-
import { BufferStopEntity, DetectorEntity, DIRECTIONS, WayPoint, WayPointEntity } from 'types';
9+
import { BufferStopEntity, DetectorEntity, WayPoint, WayPointEntity } from 'types';
1110
import EditorContext from 'applications/editor/context';
1211
import { getEntity } from 'applications/editor/data/api';
1312
import EntitySumUp from 'applications/editor/components/EntitySumUp';
@@ -20,20 +19,7 @@ export const EditEndpoints: FC<{ state: RouteState; onChange: (newState: RouteSt
2019
onChange,
2120
}) => {
2221
const { t } = useTranslation();
23-
const { entryPoint, exitPoint, entryPointDirection } = state;
24-
25-
const options = useMemo(
26-
() =>
27-
DIRECTIONS.map((s) => ({
28-
value: s,
29-
label: t(`Editor.tools.routes-edition.directions.${s}`),
30-
})),
31-
[t]
32-
);
33-
const option = useMemo(
34-
() => options.find((o) => o.value === entryPointDirection) || options[0],
35-
[options, entryPointDirection]
36-
);
22+
const { entryPoint, exitPoint } = state;
3723

3824
return (
3925
<>
@@ -45,22 +31,6 @@ export const EditEndpoints: FC<{ state: RouteState; onChange: (newState: RouteSt
4531
wayPoint={entryPoint}
4632
onChange={(wayPoint) => onChange({ ...state, entryPoint: wayPoint })}
4733
/>
48-
{entryPoint && (
49-
<div className="d-flex flex-row align-items-baseline justify-content-center mb-2">
50-
<span className="mr-2">{t('Editor.tools.routes-edition.start_direction')}</span>
51-
<Select
52-
value={option}
53-
options={options}
54-
onChange={(o) => {
55-
if (o)
56-
onChange({
57-
...state,
58-
entryPointDirection: o.value,
59-
});
60-
}}
61-
/>
62-
</div>
63-
)}
6434
<div className="text-center">
6535
<button
6636
type="button"

front/src/common/api/osrdEditoastApi.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -905,9 +905,7 @@ export type PostInfraByIdPathfindingApiArg = {
905905
/** Starting and ending track location */
906906
body: {
907907
ending?: TrackLocation;
908-
starting?: TrackLocation & {
909-
direction?: Direction;
910-
};
908+
starting?: TrackLocation;
911909
};
912910
};
913911
export type GetInfraByIdRailjsonApiResponse =

0 commit comments

Comments
 (0)