Conversation
I think we won't have an open data import for a bit of time and we will probably have a new user interface. So IMO you can drop all of it. Ideally the workflow should be.
No need to have a preview of the imported trains. @maelysLeratRosso Do you agree with this? |
|
I agree (and @thibautsailly too) |
|
Hmm, we had a feature planned to choose on import whether we wanted to import the trains, the nodes and/or the notes. This would require keeping either the preview, or at least some form of interface. Do you know if there's a plan to start work on this feature soon, or is it far off in the backlog? |
|
@Synar Yes, good point. In my opinion, we can ignore this feature because it is not currently included in the development cycle. It will just require a redesign to adapt the form. In the first design phase, we put the buttons there more out of opportunism than UI/UX design. So this will be an occasion to start thinking about it. |
By that, do you mean the browser's file selection dialog, or an OSRD popup? I would argue the browser file selection dialog should be immediately displayed, to reduce the number of unnecessary steps required to import a file. |
I mean the browser's file selection, I think we're on the same page here 😄 |
|
Since this goes quite a bit beyond graou removal, I propose to do this in a follow up pr, as soon as this one is merged |
What we mean is that we should see the browser file selection when clicking on import. No further modifications, it feels like it's part of the Graou removal. |
Yes but this means we should also drop the train preview, which is not strictly linked to graou, as well as unifying/dropping importItemList and importItemConfig, which makes the refacto quite a bit bigger. Although if the reviewers don't mind, I can do it in this one too @SharglutDev since you're reviewing, what would you prefer? |
|
I don't mind, you can do it in another commit if you have the time :) |
|
Hmm, I guess I'll stack prs ^^ (It will take way more than one commit though haha. Indeed we need to extract all the logic from the import components out into helpers in order to drop them.) |
SharglutDev
left a comment
There was a problem hiding this comment.
Lgtm and tested, thank for the PR ! (and sorry for the delay 🙇♂️ )
- Centralize all the dispersed files and code relative to graou to unified helpers - Merge the graou import process with the regular json import - Make the graou import process cleaner, simpler and more consistent See the list of squashed commits below for details : front: move updateTrainSchedules to parseGraou helper file This is a step in centralizing all graou parsing logic, in order to improve code maintainability and enable us to streamline the import process. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: move step filtering logic to parseGraou helper file This is a step in centralizing all graou parsing logic, in order to improve code maintainability and enable us to streamline the import process. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: move format list logic to parseGraou helper file This is a step in centralizing all graou parsing logic, in order to improve code maintainability and enable us to streamline the import process. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: move generateTrainSchedulePayloads to parseGraou helper file This is a step in centralizing all graou parsing logic, in order to improve code maintainability and enable us to streamline the import process. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: move populateUicChecksum to parseGraou helper file This is a step in centralizing all graou parsing logic, in order to improve code maintainability and enable us to streamline the import process. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: fuse trainList and trainJson import The only difference between trainList (used for Graou) and trainJson (used for all other sources) import was that trainList contained train schedules that were only partially parsed, as we performed some processing of Graou trains before filling the list and some after. There is however no good reason not to fully parse Graou trains before filling the list, and fuse trainList into trainJson. This lets us both: - simplify the properties and logic of ImportTimetableItemTrainsList - streamline the process of parsing Graou trains and avoid exposing intermediate results Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: graou import: fills uic checksum in main format loop Transforming the uic by filling the checksum is a parsing/formatting operation, which naturally belongs with other parsing/formatting operations rather than in the api call. Furthermore, it makes sense to do it right before converting the GraouTrainSchedule string uic to a TrainSchedule number uic. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: graou import: match rolling stock in main format loop This reduce the number of functions exposed by parseGraouTrains, making the parsing more streamlined and self contained. The final goal would be to only expose generateTrainSchedulesPayloads as far as parsing/formatting is concerned. Additionally drops an unnecessary loop. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: graou import: compute stopFor in main format loop Conmputing stopFor duration at the same time as arrival and departure times makes sense, and enables us to remove a large loop and function call while streamlining the import process. Also use Duration.subtractDate and .toISOString instead of manual computations for standardization. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: graou import: move all rs match logic to parseGraouTrain Contribute to centralizing all graou parsing logic. Also simplify the rs matching logic, drop a custom type and avoid type casting. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: improve parseGraouTrains readability Finish adding doc strings to functions that were lacking them. Also move populateUicChecksum next to other internal parsing functions. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: move uic validation to graou api While previous commits attempted to centralize parsing logic, this commit goal is to centralize validation logic, which is mostly done in the api call. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: streamline getTrainsFromOpenData Wrapping everything in a single try/catch/finally makes the function more robust (parsing failures can occur) and streamlined. The "if (filteredTrains && !isEmpty(filteredTrains))" condition was unnecessary and was dropped. Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: fix chs missing in trains imported from graou Signed-off-by: Alice K. <alice.khoudli@gmail.com> front: overhaul graou import validation - move all the validation logic inside graouApi - be more resilient to errors by filtering invalid schedules and steps instead of throwing, as graou api erros are frequent - add toast warning for filtered schedules - fix the translation strings for the filtered steps toast warning Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Remove ability to import trains from graou open data as the api will no longer be publicly accessible Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
Signed-off-by: Alice Khoudli <alice.khoudli@polytechnique.org>
flomonster
left a comment
There was a problem hiding this comment.
LGTM, I could not import a file because of a format but I think it's due to another bug
|
If nothing else nge import should already be in the right format (especially if you don't put train schedules in your dto) |
Signed-off-by: Alice K. <alice.khoudli@gmail.com>
Drop graou open data import, as the api will soon no longer be public, see discussion in #14517
Supercedes #14517 , a squashed version is included for 2 reasons:
(I could also fully include that pr history if prefered)
I dropped the interface used by graou, but we could also simply disable it.
Finally, I also added minimal styling to the remaining import button, so that the page remains coherent. The new page is a bit empty and not very pretty, if we're going to remain without an another open data import for a long time, it would be nice to overhaul it.
Edit : #14772 merged into this pr, which fully drops the import item page in favor of directly opening the file import modal, and generally simplifies the import flow
Edit : also fix railway manager interface xml import to only fallback on 415