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

Asset Import via. CSV (or Excel Format) leaves Asset Library empty #552

Open
PureFallen opened this issue Jan 30, 2025 · 3 comments
Open
Labels

Comments

@PureFallen
Copy link

PureFallen commented Jan 30, 2025

Describe the bug
After importing a CSV/XLSV file for assets following the file schema provided by MONARC itself, the website imports the assets "successfully", but leaves the asset library blank.
A deep dive into the database suggests that the description column was not filled (but is not NULL either). Manually updating the database to contain descriptions does not cause the assets to appear in the library, even after a restart.

To Reproduce
Steps to reproduce the behavior:

  1. Open any risk analysis
  2. Click on 'Add an asset' (Blue Plus)
  3. Click on 'Asset Import Center'
  4. Click on 'CSV file'
  5. Upload a CSV, XLSV or other supported file type following the file schema provided by MONARC
  6. Click 'Import File'
  7. MONARC will tell that the Import was successful ("x Assets library have been created successfully")
  8. The asset library is still empty/not contains more entries than before.

Image

A look at the test CSV/XLSV file used:

Image

Below the look into the MYSQL Database (for reference: This test was done on a risiko analysis set to "German" hence looking at label3/description3, but was also reproduced for other languages):

MariaDB [monarc_cli]> SELECT uuid, label3, description3 FROM assets;
+--------------------------------------+-------------------------------------------------------+-----------------------------------------------------------------------+
| uuid                                 | label3                                                | description3                                                          |
+--------------------------------------+-------------------------------------------------------+-----------------------------------------------------------------------+
| 2098f3cc-cf9d-46e5-9d24-cacd6e0ff3f5 | Hauptprozess                                          |                                                                       |
| 2d9d8aae-5230-4500-a473-f10b2273698b | Büro                                                  |                                                                       |
| 67528585-c8b3-472a-96a9-54519c393984 | Treppe                                                |                                                                       |
| 6f312c39-8590-4ce9-addf-1cf60f4a30d9 | Nebenprozess                                          |                                                                       |
| 87ffd031-b665-4993-8134-25bbc6e46893 | Virtualisierung                                       |                                                                       |
| a8961a10-5b5a-485c-8e32-e5e9a4fe87f3 | Parkplatz                                             |                                                                       |

Desktop (please complete the following information):

Questions Answers
Type of issue Bug
OS version (server) Ubuntu 24.04 LTS (VM)
OS version (client) Windows 11
PHP version 8.1.2 (VM)
MONARC version / git hash 2.13.1-p2
Browser Firefox, Edge

Additional context
The issue was first observed in an instance provided at my.monarc.lu and was then reproduced on local installations of MONARC via. the VM and another time in WSL.

@ruslanbaidan
Copy link
Contributor

We will validate and provide with a fix within the next release.
There is another import option available - from a json file.

@PureFallen
Copy link
Author

There is another import option available - from a json file.

Thanks for the quick response! I did take a look into it.

When using the MONARC Export File approach it seems it can only be used to import assets one by one. The User Guide mentions an option to export an entire asset library, but the instructions offered do not actually tell how to export the asset library but how to export a list of all risks instead.

https://www.monarc.lu/documentation/user-guide/#exporting-an-asset

I would assume that importing an entire asset library like that wouldn't work either since the MONARC Export File approach goes over the Object Import Service (There might be room for error at my end here).

What does work for me however is that I can apparently import an asset library by importing an entire risk analysis... Perhaps I will be able to do something that way by synthesizing a JSON file that only contains the bare minimum and then merging it.

@ruslanbaidan
Copy link
Contributor

Indeed, the import of assets from a JSON file is only for a single asset and the new feature added since v2.13.1 allows to export/import the whole analysis with the Assets Library or only the Assets Library.
The format of the json data is pretty much similar to the data representation in the Asserts Library tree structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review approved
Development

No branches or pull requests

2 participants