diff --git a/front/public/locales/en/operationalStudies/manageTrainSchedule.json b/front/public/locales/en/operationalStudies/manageTrainSchedule.json
index 4bc748554f8..32c8a6b25b8 100644
--- a/front/public/locales/en/operationalStudies/manageTrainSchedule.json
+++ b/front/public/locales/en/operationalStudies/manageTrainSchedule.json
@@ -1,13 +1,11 @@
{
"addVias": "Add waypoints",
"addTrainSchedule": "Add one or several trains",
- "apply": "Apply",
"blocktype": "Signalling block type",
"BoundsAreLinked": "Both bounds are linked",
"BoundsAreNotLinked": "Both bounds are not linked",
"returnToSimulationResults": "Go back to simulation results",
"cancelPathfinding": "Cancel",
- "cancelRequest": "Cancel request",
"chooseOnMap": "Choose on the map",
"composition": "Composition",
"deleteVias": "Delete steps",
@@ -33,8 +31,6 @@
"noTrainStep": "The increment step of the train must be greater than zero",
"noTrainStepInput": "Must be > 0",
"softErrorInfra": "The application is unavailable, a server error has occurred, please try again later.",
- "stdcmError": "Calculation error for last minute train path.",
- "stdcmErrorNoPaths": "Incompatibility with other train paths.",
"The requested train couldn't reach its destination": "The train cannot reach its destination",
"trainScheduleTitle": "An error has occurred",
"unableToDeleteTrain": "Impossible to delete the train",
@@ -79,19 +75,13 @@
"pathfindingMissingParamsSimple": "Missing information for the search",
"pathfindingNoState": "No route search.",
"pathfindingStatus": "Pathfinding state",
- "pleaseWait": "Please wait…",
"powerRestriction": "Power restriction code",
"powerRestrictionExplanationText": "By default, the simulation will use the nominal power.",
"powerRestrictionEmptyExplanationText": "The selected rolling stock does not have any power restrictions. You can edit it in the rolling stock editor.",
"restartPathfinding": "Restart search",
"rollingstock": "Rolling stock",
"simulation": "Simulation",
- "spaceSpeedGraphic": "Space-Velocity graph",
- "spaceTimeGraphic": "Space-Time graph",
"speedLimitByTag": "Composition code",
- "stdcmComputation": "Search for a train path",
- "stdcmNoResults": "No path found",
- "stdcmResults": "Results",
"stopSimulation": "Stop",
"tabs": {
"rollingStock": "Rolling stock",
diff --git a/front/public/locales/en/stdcm.json b/front/public/locales/en/stdcm.json
new file mode 100644
index 00000000000..4312789a21b
--- /dev/null
+++ b/front/public/locales/en/stdcm.json
@@ -0,0 +1,12 @@
+{
+ "apply": "Apply",
+ "cancelRequest": "Cancel request",
+ "pleaseWait": "Please wait…",
+ "spaceSpeedGraphic": "Space-Velocity graph",
+ "spaceTimeGraphic": "Space-Time graph",
+ "stdcmComputation": "Search for a train path",
+ "stdcmError": "Calculation error for last minute train path.",
+ "stdcmErrorNoPaths": "Incompatibility with other train paths.",
+ "stdcmNoResults": "No path found",
+ "stdcmResults": "Results"
+}
diff --git a/front/public/locales/fr/operationalStudies/manageTrainSchedule.json b/front/public/locales/fr/operationalStudies/manageTrainSchedule.json
index 21cc4957e15..5e290176e70 100644
--- a/front/public/locales/fr/operationalStudies/manageTrainSchedule.json
+++ b/front/public/locales/fr/operationalStudies/manageTrainSchedule.json
@@ -1,13 +1,10 @@
{
"addVias": "Ajout de vias",
"addTrainSchedule": "Ajouter un ou plusieurs trains",
- "apply": "Appliquer",
"blocktype": "Type de block",
"BoundsAreLinked": "Les deux bornes sont liées",
"BoundsAreNotLinked": "Les deux bornes ne sont pas liées",
"returnToSimulationResults": "Retourner aux résultats de simulation",
- "cancelPathfinding": "Annuler",
- "cancelRequest": "Annuler la requête",
"chooseOnMap": "Choisir sur la carte",
"composition": "Composition",
"deleteRoute": "Supprimer l'itinéraire",
@@ -33,8 +30,6 @@
"noTrainStep": "Le pas d'incrément du nom du train doit être supérieur à zéro",
"noTrainStepInput": "Doit être > 0",
"softErrorInfra": "L'application est indisponible, une erreur serveur est survenue, veuillez réessayer ultérieurement.",
- "stdcmError": "Erreur de calcul Sillon de dernière minute",
- "stdcmErrorNoPaths": "Incompatibilité avec d'autres sillons.",
"The requested train couldn't reach its destination": "Le train ne peut pas atteindre sa destination",
"trainScheduleTitle": "Une erreur est survenue",
"unableToDeleteTrain": "Impossible de supprimer le train",
@@ -86,12 +81,7 @@
"restartPathfinding": "Relancer la recherche",
"rollingstock": "Matériel",
"simulation": "Simulation",
- "spaceSpeedGraphic": "Graphique Espace-Vitesse",
- "spaceTimeGraphic": "Graphique Espace-Temps",
"speedLimitByTag": "Code de composition",
- "stdcmComputation": "Recherche de sillon",
- "stdcmNoResults": "Aucun sillon trouvé",
- "stdcmResults": "Résultats",
"stopSimulation": "Stopper",
"tabs": {
"rollingStock": "Matériel",
diff --git a/front/public/locales/fr/stdcm.json b/front/public/locales/fr/stdcm.json
new file mode 100644
index 00000000000..d7de5e2657b
--- /dev/null
+++ b/front/public/locales/fr/stdcm.json
@@ -0,0 +1,12 @@
+{
+ "apply": "Appliquer",
+ "cancelRequest": "Annuler la requête",
+ "pleaseWait": "Veuillez patientez…",
+ "spaceSpeedGraphic": "Graphique Espace-Vitesse",
+ "spaceTimeGraphic": "Graphique Espace-Temps",
+ "stdcmComputation": "Recherche de sillon",
+ "stdcmError": "Erreur de calcul Sillon de dernière minute",
+ "stdcmErrorNoPaths": "Incompatibilité avec d'autres sillons.",
+ "stdcmNoResults": "Aucun sillon trouvé",
+ "stdcmResults": "Résultats"
+}
diff --git a/front/src/applications/operationalStudies/consts.ts b/front/src/applications/operationalStudies/consts.ts
index 00ffd81c1f8..8f373661115 100644
--- a/front/src/applications/operationalStudies/consts.ts
+++ b/front/src/applications/operationalStudies/consts.ts
@@ -1,17 +1,12 @@
import i18n from 'i18n';
-import { Position, Feature } from 'geojson';
+import { Position } from 'geojson';
import {
- AllowanceValue,
- RollingStockComfortType,
ElectrificationRange,
ElectrificationUsage,
- PathResponse,
PowerRestrictionRangeItem,
} from 'common/api/osrdEditoastApi';
import { LinearMetadataItem } from 'common/IntervalsDataViz/types';
import { HeightPosition } from 'reducers/osrdsimulation/types';
-import { AllowanceForm } from 'modules/trainschedule/components/ManageTrainSchedule/Allowances/types';
-import { InfraState } from 'reducers/infra';
export const BLOCKTYPES = [
{
@@ -80,24 +75,6 @@ export const MANAGE_TRAIN_SCHEDULE_TYPES = Object.freeze({
import: 'IMPORT',
});
-interface MODES_Types {
- [n: string]: string;
-}
-
-export const MODES: MODES_Types = Object.freeze({
- simulation: 'SIMULATION',
- stdcm: 'STDCM',
- editor: 'EDITOR',
- mapViewer: 'MAP_VIEWER',
-});
-
-export const DEFAULT_MODE = MODES.simulation;
-
-export interface StandardAllowance {
- type: AllowanceValue['value_type'];
- value: number;
-}
-
export interface PointOnMap {
id?: string;
name?: string;
@@ -150,51 +127,6 @@ export const studyTypes = Object.keys(STUDY_TYPES) as StudyType[];
export type PowerRestrictionRange = LinearMetadataItem<{ value: string }>;
-export interface OsrdConfState extends InfraState {
- rollingStockComfort: RollingStockComfortType;
- name: string;
- trainCount: number;
- trainStep: number;
- trainDelta: number;
- allowances: AllowanceForm[];
- usingElectricalProfiles: boolean;
- labels: string[];
- projectID?: number;
- studyID?: number;
- scenarioID?: number;
- pathfindingID?: number;
- timetableID?: number;
- rollingStockID?: number;
- speedLimitByTag?: string;
- // TODO: update the call to the api, to rename the fields begin & end -> begin_position & end_position
- powerRestrictionRanges: PowerRestrictionRange[];
- origin?: PointOnMap;
- initialSpeed?: number;
- departureTime: string;
- destination?: PointOnMap;
- vias: PointOnMap[];
- suggeredVias: PathResponse['steps'] | PointOnMap[];
- geojson?: PathResponse;
- originDate?: string;
- originTime?: string;
- originUpperBoundDate?: string;
- originUpperBoundTime?: string;
- originLinkedBounds: boolean;
- destinationDate?: string;
- destinationTime?: string;
- gridMarginBefore?: number;
- gridMarginAfter?: number;
- trainScheduleIDsToModify: number[];
- featureInfoClick: { displayPopup: boolean; feature?: Feature; coordinates?: number[] };
-}
-
-export interface OsrdStdcmConfState extends OsrdConfState {
- maximumRunTime: number;
- standardStdcmAllowance?: StandardAllowance;
-}
-
-export const RUNTIME_CAP = 43200;
-
// electrical profiles
interface Profile {
mode: string;
diff --git a/front/src/applications/stdcm/components/RunningTime.tsx b/front/src/applications/stdcm/components/RunningTime.tsx
index 2e2de9d95fe..55f15d45343 100644
--- a/front/src/applications/stdcm/components/RunningTime.tsx
+++ b/front/src/applications/stdcm/components/RunningTime.tsx
@@ -8,13 +8,12 @@ import { noop } from 'lodash';
import { sec2time, time2sec } from 'utils/timeManipulation';
-import { RUNTIME_CAP } from 'applications/operationalStudies/consts';
-
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import { useOsrdConfActions, useOsrdConfSelectors } from 'common/osrdContext';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
+import { RUNTIME_CAP } from 'applications/stdcm/consts';
interface RunningTimeProps {
dispatch?: Dispatch;
diff --git a/front/src/applications/stdcm/consts.ts b/front/src/applications/stdcm/consts.ts
index 26a61db93ec..77b32cd73b8 100644
--- a/front/src/applications/stdcm/consts.ts
+++ b/front/src/applications/stdcm/consts.ts
@@ -8,3 +8,5 @@ const STDCM_REQUEST_STATUS = Object.freeze({
});
export default STDCM_REQUEST_STATUS;
+
+export const RUNTIME_CAP = 43200;
diff --git a/front/src/applications/stdcm/formatStcmConf.ts b/front/src/applications/stdcm/formatStdcmConf.ts
similarity index 95%
rename from front/src/applications/stdcm/formatStcmConf.ts
rename to front/src/applications/stdcm/formatStdcmConf.ts
index acf55258513..e47d920538d 100644
--- a/front/src/applications/stdcm/formatStcmConf.ts
+++ b/front/src/applications/stdcm/formatStdcmConf.ts
@@ -4,14 +4,13 @@ import { PathfindingRequest } from 'common/api/osrdEditoastApi';
import { time2sec } from 'utils/timeManipulation';
-import { createAllowanceValue } from 'applications/stdcm/components/allowancesConsts';
-import type { OsrdStdcmConfState } from 'applications/operationalStudies/consts';
-
import { getPathfindingQuery } from 'common/Pathfinding/Pathfinding';
import type { PostStdcmApiArg } from 'common/api/osrdEditoastApi';
import { setFailure } from 'reducers/main';
import type { InfraState } from 'reducers/infra';
+import type { OsrdStdcmConfState } from 'reducers/osrdconf/consts';
+import { createAllowanceValue } from 'modules/stdcmAllowances/allowancesConsts';
export default function formatStdcmConf(
dispatch: Dispatch,
diff --git a/front/src/applications/stdcm/views/OSRDStdcmConfig.tsx b/front/src/applications/stdcm/views/OSRDStdcmConfig.tsx
index 97de37aaaa6..bccaa8fa2d1 100644
--- a/front/src/applications/stdcm/views/OSRDStdcmConfig.tsx
+++ b/front/src/applications/stdcm/views/OSRDStdcmConfig.tsx
@@ -6,7 +6,6 @@ import STDCM_REQUEST_STATUS from 'applications/stdcm/consts';
import type { StdcmRequestStatus } from 'applications/stdcm/types';
import RunningTime from 'applications/stdcm/components/RunningTime';
import OSRDStdcmResults from 'applications/stdcm/views/OSRDStdcmResults';
-import type { OsrdStdcmConfState } from 'applications/operationalStudies/consts';
import StdcmAllowances from 'modules/stdcmAllowances/components/StdcmAllowances';
import { Itinerary, Map } from 'modules/trainschedule/components/ManageTrainSchedule';
@@ -18,6 +17,7 @@ import ScenarioExplorer from 'modules/scenario/components/ScenarioExplorer';
import SpeedLimitByTagSelector from 'common/SpeedLimitByTagSelector/SpeedLimitByTagSelector';
import { getSelectedTrain } from 'reducers/osrdsimulation/selectors';
+import type { OsrdStdcmConfState } from 'reducers/osrdconf/consts';
type OSRDStdcmConfigProps = {
currentStdcmRequestStatus: string;
@@ -41,11 +41,7 @@ export default function OSRDConfig({
const osrdconf: OsrdStdcmConfState = useSelector(getConf) as OsrdStdcmConfState;
- const { t } = useTranslation([
- 'translation',
- 'operationalStudies/manageTrainSchedule',
- 'simulation',
- ]);
+ const { t } = useTranslation(['translation', 'stdcm', 'simulation']);
const { data: infra } = osrdEditoastApi.useGetInfraByIdQuery(
{ id: infraID as number },
@@ -111,9 +107,9 @@ export default function OSRDConfig({
setCurrentStdcmRequestStatus(STDCM_REQUEST_STATUS.pending);
}}
>
- {t('operationalStudies/manageTrainSchedule:apply')}
+ {t('stdcm:apply')}
- {t('operationalStudies/manageTrainSchedule:apply')}
+ {t('stdcm:apply')}
diff --git a/front/src/applications/stdcm/views/OSRDStdcmResults.tsx b/front/src/applications/stdcm/views/OSRDStdcmResults.tsx
index af759795f96..1a92261ebd7 100644
--- a/front/src/applications/stdcm/views/OSRDStdcmResults.tsx
+++ b/front/src/applications/stdcm/views/OSRDStdcmResults.tsx
@@ -8,7 +8,7 @@ import { AllowancesSettings } from 'reducers/osrdsimulation/types';
import { SimulationReport } from 'common/api/osrdEditoastApi';
const OSRDStcdmResults = () => {
- const { t } = useTranslation(['translation', 'operationalStudies/manageTrainSchedule']);
+ const { t } = useTranslation(['translation', 'stdcm']);
const selectedTrain = useSelector(getSelectedTrain);
const simulation = useSelector(getPresentSimulation);
@@ -44,9 +44,7 @@ const OSRDStcdmResults = () => {
-
- {t('operationalStudies/manageTrainSchedule:spaceTimeGraphic')}
-
+
{t('stdcm:spaceTimeGraphic')}
{
className="btn d-flex align-items-center mb-1 font-weight-bold"
onClick={() => setShowSpeedSpaceChart(!showSpeedSpaceChart)}
>
- {t('operationalStudies/manageTrainSchedule:spaceSpeedGraphic')}
+ {t('stdcm:spaceSpeedGraphic')}
void;
@@ -36,11 +36,7 @@ type StdcmRequestModalProps = {
};
export default function StdcmRequestModal(props: StdcmRequestModalProps) {
- const { t } = useTranslation([
- 'translation',
- 'operationalStudies/manageTrainSchedule',
- 'translation',
- ]);
+ const { t } = useTranslation(['translation', 'stdcm']);
const { getConf } = useOsrdConfSelectors();
const osrdconf = useSelector(getConf);
const dispatch = useDispatch();
@@ -103,7 +99,7 @@ export default function StdcmRequestModal(props: StdcmRequestModalProps) {
.catch(() => {
dispatch(
setFailure({
- name: t('operationalStudies/manageTrainSchedule:errorMessages.stdcmError'),
+ name: t('stdcm:stdcmError'),
message: t('translation:common.error'),
})
);
@@ -115,10 +111,10 @@ export default function StdcmRequestModal(props: StdcmRequestModalProps) {
setCurrentStdcmRequestStatus(STDCM_REQUEST_STATUS.rejected);
dispatch(
setFailure({
- name: t('operationalStudies/manageTrainSchedule:errorMessages.stdcmError'),
+ name: t('stdcm:stdcmError'),
message:
extractStatusFromError(e) === 400 && errorMessage === 'No path could be found'
- ? t('operationalStudies/manageTrainSchedule:errorMessages.stdcmErrorNoPaths')
+ ? t('stdcm:stdcmErrorNoPaths')
: errorMessage,
})
);
@@ -154,15 +150,13 @@ export default function StdcmRequestModal(props: StdcmRequestModalProps) {
- {t('operationalStudies/manageTrainSchedule:stdcmComputation')}
+ {t('stdcm:stdcmComputation')}
{currentStdcmRequestStatus === STDCM_REQUEST_STATUS.pending && (
-
- {t('operationalStudies/manageTrainSchedule:pleaseWait')}
-
+ {t('stdcm:pleaseWait')}
)}
@@ -173,9 +167,9 @@ export default function StdcmRequestModal(props: StdcmRequestModalProps) {
type="button"
onClick={cancelStdcmRequest}
>
- {t('operationalStudies/manageTrainSchedule:cancelRequest')}
+ {t('stdcm:cancelRequest')}
- {t('operationalStudies/manageTrainSchedule:cancelRequest')}
+ {t('stdcm:cancelRequest')}
diff --git a/front/src/common/osrdContext.tsx b/front/src/common/osrdContext.tsx
index cb1f807d9a6..e4f67bff676 100644
--- a/front/src/common/osrdContext.tsx
+++ b/front/src/common/osrdContext.tsx
@@ -2,8 +2,6 @@ import React, { createContext, useContext, useMemo } from 'react';
import type { ObjectFieldsTypes } from 'utils/types';
-import { MODES } from 'applications/operationalStudies/consts';
-
import { ModalProvider } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider';
import type { OsrdSlice } from 'reducers';
@@ -11,6 +9,7 @@ import type { EditorSelectors } from 'reducers/editor/selectors';
import type { MapViewerSelectors } from 'reducers/mapViewer/selectors';
import { useSelector } from 'react-redux';
import { ConfSelectors, ConfSliceActions } from 'reducers/osrdconf/osrdConfCommon';
+import { MODES } from 'main/consts';
export type OsrdSelectors = ConfSelectors | MapViewerSelectors | EditorSelectors;
diff --git a/front/src/main/app.jsx b/front/src/main/app.jsx
index 3b72e9ded2d..9ecbcdbcc13 100644
--- a/front/src/main/app.jsx
+++ b/front/src/main/app.jsx
@@ -13,7 +13,7 @@ import NotificationsState from 'common/Notifications';
import HomeStdcm from 'applications/stdcm/Home';
import HomeEditor from 'applications/editor/Home';
import HomeMap from 'applications/referenceMap/Home';
-import { MODES } from 'applications/operationalStudies/consts';
+import { MODES } from 'main/consts';
import Study from 'applications/operationalStudies/views/Study';
import Project from 'applications/operationalStudies/views/Project';
import Scenario from 'applications/operationalStudies/views/Scenario';
diff --git a/front/src/main/consts.ts b/front/src/main/consts.ts
new file mode 100644
index 00000000000..b92b71b36f1
--- /dev/null
+++ b/front/src/main/consts.ts
@@ -0,0 +1,12 @@
+interface MODES_Types {
+ [n: string]: string;
+}
+
+export const MODES: MODES_Types = Object.freeze({
+ simulation: 'SIMULATION',
+ stdcm: 'STDCM',
+ editor: 'EDITOR',
+ mapViewer: 'MAP_VIEWER',
+});
+
+export const DEFAULT_MODE = MODES.simulation;
diff --git a/front/src/modules/infra/components/InfraSelector/InfraSelectorModalBodyStandard.tsx b/front/src/modules/infra/components/InfraSelector/InfraSelectorModalBodyStandard.tsx
index bfb94f85580..5850cdc17d0 100644
--- a/front/src/modules/infra/components/InfraSelector/InfraSelectorModalBodyStandard.tsx
+++ b/front/src/modules/infra/components/InfraSelector/InfraSelectorModalBodyStandard.tsx
@@ -5,8 +5,6 @@ import { useDispatch } from 'react-redux';
import nextId from 'react-id-generator';
import { GoLock } from 'react-icons/go';
-import { MODES } from 'applications/operationalStudies/consts';
-
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import type { Infra } from 'common/api/osrdEditoastApi';
import { ModalContext } from 'common/BootstrapSNCF/ModalSNCF/ModalProvider';
@@ -16,6 +14,7 @@ import {
useOsrdContext,
useUpdateInfraID,
} from 'common/osrdContext';
+import { MODES } from 'main/consts';
type InfraSelectorModalBodyStandardProps = {
filter: string;
diff --git a/front/src/applications/stdcm/components/allowancesConsts.tsx b/front/src/modules/stdcmAllowances/allowancesConsts.ts
similarity index 100%
rename from front/src/applications/stdcm/components/allowancesConsts.tsx
rename to front/src/modules/stdcmAllowances/allowancesConsts.ts
diff --git a/front/src/modules/stdcmAllowances/components/StdcmAllowances.tsx b/front/src/modules/stdcmAllowances/components/StdcmAllowances.tsx
index ead1b306191..d66932dcbea 100644
--- a/front/src/modules/stdcmAllowances/components/StdcmAllowances.tsx
+++ b/front/src/modules/stdcmAllowances/components/StdcmAllowances.tsx
@@ -4,8 +4,7 @@ import { useTranslation } from 'react-i18next';
import { convertInputStringToNumber } from 'utils/strings';
-import type { StandardAllowance } from 'applications/operationalStudies/consts';
-import { ALLOWANCE_UNITS_KEYS } from 'applications/stdcm/components/allowancesConsts';
+import { ALLOWANCE_UNITS_KEYS } from 'modules/stdcmAllowances/allowancesConsts';
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import InputGroupSNCF from 'common/BootstrapSNCF/InputGroupSNCF';
@@ -15,6 +14,7 @@ import type { InputGroupSNCFValue } from 'common/BootstrapSNCF/InputGroupSNCF';
import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
+import type { StandardAllowance } from 'reducers/osrdconf/consts';
const StdcmAllowances = () => {
const { t } = useTranslation('allowances');
diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayItinerary/Origin.tsx b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayItinerary/Origin.tsx
index bccd43b8e6c..14f2fe97ed8 100644
--- a/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayItinerary/Origin.tsx
+++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/Itinerary/DisplayItinerary/Origin.tsx
@@ -7,10 +7,9 @@ import type { Position } from 'geojson';
import { makeEnumBooleans } from 'utils/constants';
-import { MODES } from 'applications/operationalStudies/consts';
-
import InputSNCF from 'common/BootstrapSNCF/InputSNCF';
import { useOsrdConfActions, useOsrdContext, useOsrdConfSelectors } from 'common/osrdContext';
+import { MODES } from 'main/consts';
interface OriginProps {
zoomToFeaturePoint: (lngLat?: Position, id?: string) => void;
diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/formatConf.ts b/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/formatConf.ts
index 4e64c3d7257..6f9be950262 100644
--- a/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/formatConf.ts
+++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/helpers/formatConf.ts
@@ -1,11 +1,12 @@
import { isEmpty } from 'lodash';
import { Dispatch } from 'redux';
-import { OsrdConfState, PowerRestrictionRange } from 'applications/operationalStudies/consts';
import { formatAllowances } from 'modules/trainschedule/components/ManageTrainSchedule/Allowances/helpers';
import { NO_POWER_RESTRICTION } from 'modules/trainschedule/components/ManageTrainSchedule/PowerRestrictionsSelector';
import { setFailure } from 'reducers/main';
import { time2sec } from 'utils/timeManipulation';
import { kmh2ms } from 'utils/physics';
+import type { PowerRestrictionRange } from 'applications/operationalStudies/consts';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
const formatPowerRestrictionRanges = (powerRestrictionRanges: PowerRestrictionRange[]) => {
if (isEmpty(powerRestrictionRanges) || powerRestrictionRanges[0].value === NO_POWER_RESTRICTION) {
diff --git a/front/src/reducers/index.ts b/front/src/reducers/index.ts
index 11b88c815b8..9cee2213447 100644
--- a/front/src/reducers/index.ts
+++ b/front/src/reducers/index.ts
@@ -4,9 +4,7 @@ import { persistCombineReducers, persistReducer } from 'redux-persist';
import storage from 'redux-persist/lib/storage'; // defaults to localStorage
import createCompressor from 'redux-persist-transform-compress';
import { createFilter } from 'redux-persist-transform-filter';
-
-import type { OsrdConfState, OsrdStdcmConfState } from 'applications/operationalStudies/consts';
-
+import type { OsrdConfState, OsrdStdcmConfState } from 'reducers/osrdconf/consts';
import { osrdEditoastApi } from 'common/api/osrdEditoastApi';
import { osrdGatewayApi } from 'common/api/osrdGatewayApi';
diff --git a/front/src/reducers/osrdconf/consts.ts b/front/src/reducers/osrdconf/consts.ts
new file mode 100644
index 00000000000..08dfb98fa60
--- /dev/null
+++ b/front/src/reducers/osrdconf/consts.ts
@@ -0,0 +1,56 @@
+import type { PowerRestrictionRange, PointOnMap } from 'applications/operationalStudies/consts';
+import type {
+ RollingStockComfortType,
+ PathResponse,
+ AllowanceValue,
+} from 'common/api/osrdEditoastApi';
+import type { Feature } from 'geojson';
+import type { AllowanceForm } from 'modules/trainschedule/components/ManageTrainSchedule/Allowances/types';
+import type { InfraState } from 'reducers/infra';
+
+export interface OsrdConfState extends InfraState {
+ rollingStockComfort: RollingStockComfortType;
+ name: string;
+ trainCount: number;
+ trainStep: number;
+ trainDelta: number;
+ allowances: AllowanceForm[];
+ usingElectricalProfiles: boolean;
+ labels: string[];
+ projectID?: number;
+ studyID?: number;
+ scenarioID?: number;
+ pathfindingID?: number;
+ timetableID?: number;
+ rollingStockID?: number;
+ speedLimitByTag?: string;
+ // TODO: update the call to the api, to rename the fields begin & end -> begin_position & end_position
+ powerRestrictionRanges: PowerRestrictionRange[];
+ origin?: PointOnMap;
+ initialSpeed?: number;
+ departureTime: string;
+ destination?: PointOnMap;
+ vias: PointOnMap[];
+ suggeredVias: PathResponse['steps'] | PointOnMap[];
+ geojson?: PathResponse;
+ originDate?: string;
+ originTime?: string;
+ originUpperBoundDate?: string;
+ originUpperBoundTime?: string;
+ originLinkedBounds: boolean;
+ destinationDate?: string;
+ destinationTime?: string;
+ gridMarginBefore?: number;
+ gridMarginAfter?: number;
+ trainScheduleIDsToModify: number[];
+ featureInfoClick: { displayPopup: boolean; feature?: Feature; coordinates?: number[] };
+}
+
+export interface StandardAllowance {
+ type: AllowanceValue['value_type'];
+ value: number;
+}
+export interface OsrdStdcmConfState extends OsrdConfState {
+ maximumRunTime: number;
+ standardStdcmAllowance?: StandardAllowance;
+}
diff --git a/front/src/reducers/osrdconf/operationalStudiesConf/index.ts b/front/src/reducers/osrdconf/operationalStudiesConf/index.ts
index 9373070b708..cb4463b1847 100644
--- a/front/src/reducers/osrdconf/operationalStudiesConf/index.ts
+++ b/front/src/reducers/osrdconf/operationalStudiesConf/index.ts
@@ -1,6 +1,6 @@
import { createSlice } from '@reduxjs/toolkit';
-import type { OsrdConfState } from 'applications/operationalStudies/consts';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
import { defaultCommonConf, buildCommonConfReducers } from 'reducers/osrdconf/osrdConfCommon';
diff --git a/front/src/reducers/osrdconf/operationalStudiesConf/selectors.ts b/front/src/reducers/osrdconf/operationalStudiesConf/selectors.ts
index 77fc3c18602..254cabd8fa8 100644
--- a/front/src/reducers/osrdconf/operationalStudiesConf/selectors.ts
+++ b/front/src/reducers/osrdconf/operationalStudiesConf/selectors.ts
@@ -1,7 +1,6 @@
-import type { OsrdConfState } from 'applications/operationalStudies/consts';
-
import buildCommonConfSelectors from 'reducers/osrdconf/osrdConfCommon/selectors';
import { operationalStudiesConfSlice } from 'reducers/osrdconf/operationalStudiesConf';
+import type { OsrdConfState } from '../consts';
const buildOperationalStudiesConfSelectors = () => {
const commonConfSelectors = buildCommonConfSelectors(operationalStudiesConfSlice);
diff --git a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/commonConfBuilder.ts b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/commonConfBuilder.ts
index 309a7386f69..4f3c4cd5c43 100644
--- a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/commonConfBuilder.ts
+++ b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/commonConfBuilder.ts
@@ -1,13 +1,9 @@
import type { SwitchType } from 'types';
-import type {
- OsrdConfState,
- PointOnMap,
- PowerRestrictionRange,
-} from 'applications/operationalStudies/consts';
-
+import type { PointOnMap, PowerRestrictionRange } from 'applications/operationalStudies/consts';
import type { Allowance, PathResponse } from 'common/api/osrdEditoastApi';
import { Feature } from 'geojson';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
export default function commonConfBuilder() {
return {
diff --git a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
index 4fa7bb1fb97..efd39937678 100644
--- a/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
+++ b/front/src/reducers/osrdconf/osrdConfCommon/__tests__/utils.ts
@@ -1,13 +1,12 @@
import { omit } from 'lodash';
import { createStoreWithoutMiddleware } from 'store';
-import type { OsrdConfState, PointOnMap } from 'applications/operationalStudies/consts';
-
+import type { PointOnMap } from 'applications/operationalStudies/consts';
import type { Allowance } from 'common/api/osrdEditoastApi';
-
import { defaultCommonConf } from 'reducers/osrdconf/osrdConfCommon';
import type { StdcmConfSlice } from 'reducers/osrdconf/stdcmConf';
import type { OperationalStudiesConfSlice } from 'reducers/osrdconf/operationalStudiesConf';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
import commonConfBuilder from 'reducers/osrdconf/osrdConfCommon/__tests__/commonConfBuilder';
function createStore(
diff --git a/front/src/reducers/osrdconf/osrdConfCommon/index.ts b/front/src/reducers/osrdconf/osrdConfCommon/index.ts
index a111b7b1dd8..19394aa764a 100644
--- a/front/src/reducers/osrdconf/osrdConfCommon/index.ts
+++ b/front/src/reducers/osrdconf/osrdConfCommon/index.ts
@@ -4,10 +4,9 @@ import { omit } from 'lodash';
import { formatIsoDate } from 'utils/date';
-import type { OsrdConfState, PointOnMap } from 'applications/operationalStudies/consts';
-
import { computeLinkedOriginTimes } from 'reducers/osrdconf/helpers';
import { InfraStateReducers, buildInfraStateReducers, infraState } from 'reducers/infra';
+import type { PointOnMap } from 'applications/operationalStudies/consts';
import type {
OperationalStudiesConfSlice,
OperationalStudiesConfSliceActions,
@@ -15,6 +14,7 @@ import type {
import type { StdcmConfSlice, StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf';
import type { StdcmConfSelectors } from 'reducers/osrdconf/stdcmConf/selectors';
import type { OperationalStudiesConfSelectors } from 'reducers/osrdconf/operationalStudiesConf/selectors';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
export const defaultCommonConf: OsrdConfState = {
name: '',
diff --git a/front/src/reducers/osrdconf/osrdConfCommon/selectors.ts b/front/src/reducers/osrdconf/osrdConfCommon/selectors.ts
index 409bb25f3e3..720cedb42b8 100644
--- a/front/src/reducers/osrdconf/osrdConfCommon/selectors.ts
+++ b/front/src/reducers/osrdconf/osrdConfCommon/selectors.ts
@@ -1,8 +1,7 @@
import { makeSubSelector } from 'utils/selectors';
-import type { OsrdConfState } from 'applications/operationalStudies/consts';
-
import type { RootState } from 'reducers';
+import type { OsrdConfState } from 'reducers/osrdconf/consts';
import type { StdcmConfSlice } from 'reducers/osrdconf/stdcmConf';
import type { OperationalStudiesConfSlice } from 'reducers/osrdconf/operationalStudiesConf';
import buildInfraStateSelectors from 'reducers/infra/selectors';
diff --git a/front/src/reducers/osrdconf/stdcmConf/index.ts b/front/src/reducers/osrdconf/stdcmConf/index.ts
index 7a8b8fc1b10..3798e7259e2 100644
--- a/front/src/reducers/osrdconf/stdcmConf/index.ts
+++ b/front/src/reducers/osrdconf/stdcmConf/index.ts
@@ -1,7 +1,7 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
-import { OsrdStdcmConfState } from 'applications/operationalStudies/consts';
import { Draft } from 'immer';
import { defaultCommonConf, buildCommonConfReducers } from 'reducers/osrdconf/osrdConfCommon';
+import type { OsrdStdcmConfState } from 'reducers/osrdconf/consts';
export const stdcmConfInitialState: OsrdStdcmConfState = {
maximumRunTime: 43200,
diff --git a/front/src/reducers/osrdconf/stdcmConf/selectors.ts b/front/src/reducers/osrdconf/stdcmConf/selectors.ts
index 5b2c093f7b9..34e0adb3032 100644
--- a/front/src/reducers/osrdconf/stdcmConf/selectors.ts
+++ b/front/src/reducers/osrdconf/stdcmConf/selectors.ts
@@ -1,6 +1,6 @@
import { makeSubSelector } from 'utils/selectors';
-import type { OsrdStdcmConfState } from 'applications/operationalStudies/consts';
+import type { OsrdStdcmConfState } from 'reducers/osrdconf/consts';
import { stdcmConfSlice } from 'reducers/osrdconf/stdcmConf';
import buildCommonConfSelectors from 'reducers/osrdconf/osrdConfCommon/selectors';
diff --git a/front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts b/front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
index 9b1fb4e2afd..97102b65d70 100644
--- a/front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
+++ b/front/src/reducers/osrdconf/stdcmConf/stdcmConfReducers.spec.ts
@@ -1,12 +1,11 @@
-import type { OsrdStdcmConfState, StandardAllowance } from 'applications/operationalStudies/consts';
import { createStoreWithoutMiddleware } from 'store';
-
import { describe, expect } from 'vitest';
import {
stdcmConfInitialState,
stdcmConfSlice,
stdcmConfSliceActions,
} from 'reducers/osrdconf/stdcmConf';
+import type { OsrdStdcmConfState, StandardAllowance } from 'reducers/osrdconf/consts';
import testCommonConfReducers from '../osrdConfCommon/__tests__/utils';
const createStore = (initialStateExtra?: Partial) =>