Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Enhance import process #2728

Merged
merged 67 commits into from
Feb 5, 2025
Merged

Feat: Enhance import process #2728

merged 67 commits into from
Feb 5, 2025

Conversation

PhilippMa
Copy link
Contributor

Summary of changes

Added an import dialog for importing non-.opossum files into OpossumUI. The import dialog is accessible through a new "Import file" menu item with submenus for all supported file types. In the dialog, users select the file to import and the location where the newly created .opossum file should be saved, either through native file select dialogs or through text field input. The file paths are validated, invalid file paths cause error messages to show and the import button only works when the file paths are valid. Clicking the import button uses the existing functions for loading files into OpossumUI, but the loading log information is displayed directly in the import dialog instead of the ProcessPopup used when opening files. As non-.opossum files are now handled through this import workflow, the open file action now only allows selection of .opossum files.

Context and reason for change

We want OpossumUI to be able to import files with multiple different formats. For this purpose, separating importing from just plainly opening files creates more clarity for the user. Also, it was deemed confusing that the existing workflow for opening legacy opossum files displayed a warning over having to create a new .opossum file, and that it would be better to allow the user to select the location of this new .opossum file instead.

In future issues, the import dialog will be extended with supporting more file types and handling errors during file conversion.

How can the changes be tested

For viewing that the loading logs are displayed correctly, either a large file should be imported or some manual delays put into the loadInputAndOutputFromFilePath function in importFromFile.ts, as small files are loaded so quickly that the loading logs are only visible for a very short time before the dialog closes.

closes #2714

@PhilippMa PhilippMa linked an issue Jan 29, 2025 that may be closed by this pull request
4 tasks
@PhilippMa
Copy link
Contributor Author

Questions to reviewer:

  • Should I change it so all display text I added is defined in src/shared/text.ts instead of the components themselves? The usage of text constants seemed a little inconsistent in some existing files.
  • When I add style to a component using the sx property, is it always best practice to define this styled component in a separate .style.ts file or is it fine to just style with the sx property inside of a component definition?

Copy link
Member

@mstykow mstykow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

general comments:

  1. great first PR! it's clear you've thought deeply about the problem and addressed many edge cases.
  2. this PR is too large. it's intimidating to review it, you are getting feedback only after days of work, and it will take a long time to get it to a mergable state because it changes so many things. next time, please think about how to chop your changes into smaller chunks.

@PhilippMa PhilippMa force-pushed the feat/enhance-import-process branch from 93fa729 to 778fa5e Compare January 31, 2025 12:28
@PhilippMa PhilippMa requested a review from mstykow January 31, 2025 12:34
* Other input file formats will be handled through a separate import workflow
* this function will be needed by the "Import File" menu
* click behavior for menu item is still WIP
* WIP: handling of this channel in the frontend still needs to be implemented
* triggered by menu action
* allows selection of input file
* selection of output file, verification of file paths and the actual file import will follow in future commits
* needed to separate void and non-void callbacks so that non-void callbacks can return null on error
* had to change popup handling to allow for passing props to popups
* can be used for both selecting the input file and the location of the created opossum file
* second line is autofilled based on the selected input path
* give more specific error messages for empty path or invalid file extension
* delete FileSupportPopup
* delete import logic from open handlers
* delete some unused IPC channels including handlers/send functions
* this check is performed on edit for the paths, as it should not be an expensive operation
* more precise typing gives earlier/better feedback when listeners don't fit the type expected by the ipc handler
… to log display

* not using form helper texts is more consistent with other forms in OpossumUI
* only validating on import drastically reduces the state variables necessary in import dialog
* to still get file overwrite warnings, force users to select file paths through system dialogs
@PhilippMa PhilippMa force-pushed the feat/enhance-import-process branch from 778fa5e to 10076cb Compare January 31, 2025 13:07
@mstykow mstykow self-assigned this Jan 31, 2025
@PhilippMa PhilippMa merged commit e68b285 into main Feb 5, 2025
5 checks passed
@PhilippMa PhilippMa deleted the feat/enhance-import-process branch February 5, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance import process for non-.opossum files
2 participants