opencti icon indicating copy to clipboard operation
opencti copied to clipboard

[frontend] Allow Users to Add an Entity as Context When Uploading File

Open VerboseCat opened this issue 1 year ago • 1 comments

Proposed changes

  • Allow user to select a related entity when uploading a file from global context
  • Add noMultiSelect prop to filter to allow only one value per filter

Checklist

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

Further comments

No frontend tests exist for the file upload process.

VerboseCat avatar May 30 '24 19:05 VerboseCat

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.70%. Comparing base (6f26528) to head (d606a45). Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7195      +/-   ##
==========================================
+ Coverage   67.57%   67.70%   +0.12%     
==========================================
  Files         570      570              
  Lines       70534    70579      +45     
  Branches     5981     6011      +30     
==========================================
+ Hits        47665    47786     +121     
+ Misses      22869    22793      -76     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 30 '24 19:05 codecov[bot]

Thanks for you PR on this interesting functionnality ! I recommend a modification on the way we select the related entity :

When you upoload a file from Data/import, a pop-up opens. Instead of having a boolean switch button ('add related entity') and a filter icon button to select an entity (screenshot 1), we should rather have just a dropdown that enables to select entities (like in screenshot 2). This dropdown would not be mandatory to fill. This way the selection is easier, requires less clicks and is more consistant with what is done elsewhere in the platform. We can even imagine that the user can select several entities (The file will be uploaded in the context of each of the selected entities and the user will be redirected to the first selected entity).

  • What has been done (screenshot 1): image

  • Recommended solution (screenshot 2): image

image

  • Entities dropdown precisions: The dropdown contains all the entities, grouped by entity type. You can also add a palette to select the entity type (and thus prefilter the entities list), like it is done in the 'target type' filter : image

Archidoit avatar Jul 10 '24 07:07 Archidoit

@Archidoit after discussion with Craig and others, here what we will do: image No palette, no sorting by entity type.

MVP vibe.

Jipegien avatar Jul 10 '24 09:07 Jipegien

@Archidoit Where was this screenshot of the AutoCompleteField taken in the platform? I am familiar with the component, but this screenshot is the first time I have seen it with multiple entity types in the dropdown. Thank you!

VerboseCat avatar Jul 15 '24 21:07 VerboseCat

@VerboseCat Here is how to find the screenshot:

  • Go to the observables list
  • Select some observables
  • Click on 'add in container' in the bottom toolbar
  • A pop-up opens with the dropdown we're talking about

image

image

Archidoit avatar Jul 16 '24 08:07 Archidoit

I believe I have updated the component according to the requested changes. Please let me know when you have had a chance to re-review. Thank you!

VerboseCat avatar Jul 29 '24 16:07 VerboseCat

@VerboseCat Behavior tested and everything is OK I'm just gonna push some little changes in the code before approving (remove the unused 'noMultiSelect' option for FilterIconButton)

Archidoit avatar Jul 30 '24 13:07 Archidoit

Great, thank you!

VerboseCat avatar Jul 30 '24 13:07 VerboseCat