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

[frontend/backend]Adding the ability to import/export mappers #1263

Merged
merged 9 commits into from
Aug 9, 2024

Conversation

Dimfacion
Copy link
Member

@Dimfacion Dimfacion commented Jul 29, 2024

Proposed changes

  • Adding the ability to import/export mappers

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@Dimfacion Dimfacion changed the title Issue/1260 [frontend/backend]Adding the ability to import/export mappers Jul 29, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 21.56863% with 40 lines in your changes missing coverage. Please review.

Project coverage is 28.51%. Comparing base (8d4b644) to head (3acd8d1).
Report is 5 commits behind head on master.

Files Patch % Lines
...rc/main/java/io/openbas/rest/mapper/MapperApi.java 0.00% 18 Missing ⚠️
...main/java/io/openbas/rest/helper/RestBehavior.java 0.00% 7 Missing ⚠️
...rc/main/java/io/openbas/service/MapperService.java 60.00% 6 Missing ⚠️
...ava/io/openbas/rest/exception/ImportException.java 0.00% 4 Missing ⚠️
...openbas/rest/mapper/export/MapperExportMixins.java 0.00% 3 Missing ⚠️
...io/openbas/rest/mapper/form/ExportMapperInput.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1263      +/-   ##
============================================
- Coverage     29.05%   28.51%   -0.55%     
+ Complexity     1300     1289      -11     
============================================
  Files           507      510       +3     
  Lines         13056    13114      +58     
  Branches        747      748       +1     
============================================
- Hits           3794     3740      -54     
- Misses         9094     9214     +120     
+ Partials        168      160       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Dimfacion Dimfacion marked this pull request as ready for review July 31, 2024 09:28
openbas-front/src/actions/mapper/mapper-actions.ts Outdated Show resolved Hide resolved
@@ -176,4 +177,34 @@ private void updateInjectImporter(List<InjectImporterUpdateInput> injectImporter
});
}

public List<ImportMapperAddInput> exportMappers(List<String> idsToExport) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand why we need to recreate an object here

Copy link
Member Author

Choose a reason for hiding this comment

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

It's kind of a shortcut : instead of exporting objects that match what is in the database, we export the object that would allow us to recreate the same mapper (which is why the import code is so small). This is why we're converting it into ImportMapperAddInput.
It result in a smaller file but to be honest, I'm kind of unsure if that's the best way to do it as it assumes that the export is made so that it can be imported. What do you think of it ?

Copy link
Member

Choose a reason for hiding this comment

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

We need to talk about it.
We have an existing mechanism to export based on Json annotation. We can challenge this too to check if there are a modern way to do it.

@Dimfacion Dimfacion requested a review from RomuDeuxfois July 31, 2024 15:17
@RomuDeuxfois RomuDeuxfois marked this pull request as draft August 2, 2024 06:55
@RomuDeuxfois RomuDeuxfois force-pushed the issue/1260 branch 2 times, most recently from 4359308 to 68115ee Compare August 2, 2024 07:19
@RomuDeuxfois RomuDeuxfois marked this pull request as ready for review August 2, 2024 07:32
@RomuDeuxfois
Copy link
Member

@Dimfacion I used Mixin to homogenise the export mechanism.
I let you give your opinion about the new code.

@savacano28
Copy link
Contributor

Code: ok, Tested: ok

@Dimfacion Dimfacion merged commit 706e248 into master Aug 9, 2024
6 checks passed
@Dimfacion Dimfacion deleted the issue/1260 branch September 18, 2024 14:23
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.

3 participants