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] switch translation key when relationship (#5142) #5180

Merged
merged 2 commits into from
Dec 15, 2023

Conversation

lndrtrbn
Copy link
Member

Proposed changes

  • Condition to display entity or relationship translation

The way of checking it (hard coded array of relation names) is not very elegant but I don't see how to do it otherwise. Making a query just to determine if the name is from an entity or a relationship seemed not a good solution neither, maybe I'm wrong?

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

Comment on lines 351 to 352
// Uses to determine which key of translation to use below.
const relNames = ['Part-Of', 'Located-At', 'Indicates', 'Mitigates', 'Targets', 'Uses', 'Related-To', 'Attributed-To'];
Copy link
Member Author

Choose a reason for hiding this comment

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

Open to suggestions if you have better idea to check in mind

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure to understand how we can see relationships in the targets list.
The dialog displays targets on the left and relationships on the right, how can we have relationships on the left part ? @lndrtrbn

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we can have relations targeting other relations

Copy link
Member

Choose a reason for hiding this comment

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

is this list complete ? I can see we have a lot more in STIX_CORE_RELATIONSHIPS

Copy link
Member

Choose a reason for hiding this comment

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

could you get it from the schema ?

const { schema } = useAuth();
// ...
const relationshipsNames = schema.sros.map(({id, label }) => label)

Something like that I believe

Copy link
Member

Choose a reason for hiding this comment

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

see how it's done is useSearchEntities, we use the schema to get generate all possible options in the filter autocomplete

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I'll have a look thanks @labo-flg

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, seems way better now

@Kedae Kedae added the filigran team use to identify PR from the Filigran team label Dec 12, 2023
@SouadHadjiat SouadHadjiat linked an issue Dec 13, 2023 that may be closed by this pull request
@lndrtrbn lndrtrbn merged commit bb86705 into master Dec 15, 2023
6 checks passed
@lndrtrbn lndrtrbn deleted the issue/5142 branch December 15, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing translations in investigation screen in expand dialog
4 participants