Skip to content

Commit

Permalink
front: fix nge update after importing or deleting multiple trains
Browse files Browse the repository at this point in the history
Signed-off-by: romainvalls <[email protected]>
  • Loading branch information
RomainValls committed Jan 15, 2025
1 parent 28c157d commit 271dbed
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const ScenarioContent = ({
<ImportTrainSchedule
timetableId={scenario.timetable_id}
upsertTrainSchedules={upsertTrainSchedules}
dtoImport={dtoImport}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import { useAppDispatch } from 'store';
const ImportTrainSchedule = ({
timetableId,
upsertTrainSchedules,
dtoImport,
}: {
timetableId: number;
upsertTrainSchedules: (trainSchedules: TrainScheduleResult[]) => void;
dtoImport: () => void;
}) => {
const dispatch = useAppDispatch();
const { t } = useTranslation(['rollingstock']);
Expand Down Expand Up @@ -57,6 +59,7 @@ const ImportTrainSchedule = ({
trainsJsonData={trainsJsonData}
trainsXmlData={trainsXmlData}
upsertTrainSchedules={upsertTrainSchedules}
dtoImport={dtoImport}
/>
</main>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type ImportTrainScheduleTrainsListProps = {
trainsJsonData: TrainScheduleBase[];
trainsXmlData: ImportedTrainSchedule[];
upsertTrainSchedules: (trainSchedules: TrainScheduleResult[]) => void;
dtoImport: () => void;
};

const ImportTrainScheduleTrainsList = ({
Expand All @@ -48,6 +49,7 @@ const ImportTrainScheduleTrainsList = ({
trainsJsonData,
trainsXmlData,
upsertTrainSchedules,
dtoImport,
}: ImportTrainScheduleTrainsListProps) => {
const { t } = useTranslation(['operationalStudies/importTrainSchedule']);
const rollingStockDict = useMemo(
Expand Down Expand Up @@ -91,6 +93,7 @@ const ImportTrainScheduleTrainsList = ({

const trainSchedules = await postTrainSchedule({ id: timetableId, body: payloads }).unwrap();
upsertTrainSchedules(trainSchedules);
dtoImport();
dispatch(
setSuccess({
title: t('success'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Timetable = ({
const removeAndUnselectTrains = (trainIds: number[]) => {
removeTrains(trainIds);
setSelectedTrainIds([]);
dtoImport();
};

const toggleConflictsListExpanded = () => {
Expand Down

0 comments on commit 271dbed

Please sign in to comment.