-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[frontend] view user's confidence level (#4304)
- Loading branch information
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
opencti-platform/opencti-front/src/private/components/settings/users/UserConfidenceLevel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { User_user$data } from '@components/settings/users/__generated__/User_user.graphql'; | ||
import { InfoOutlined } from '@mui/icons-material'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import { useFormatter } from '../../../../components/i18n'; | ||
|
||
type UserConfidenceLevelFieldProps = { | ||
userConfidenceLevel: User_user$data['user_confidence_level'] | ||
}; | ||
|
||
const UserConfidenceLevel: React.FC<UserConfidenceLevelFieldProps> = ({ userConfidenceLevel }) => { | ||
const { t } = useFormatter(); | ||
|
||
const overrides = userConfidenceLevel.overrides | ||
.map(({ entity_type, max_confidence }) => `${t(`entity_${entity_type}`)}: ${max_confidence}`) | ||
.join('\n'); | ||
|
||
return ( | ||
<> | ||
<div style={{ float: 'left', marginRight: 5 }}> | ||
{`${userConfidenceLevel.max_confidence ?? '-'}`} | ||
</div> | ||
<div> | ||
{ | ||
userConfidenceLevel.overrides.length > 0 && ( | ||
<Tooltip title={ | ||
<div style={{ whiteSpace: 'pre-line' }}> | ||
{`${t('This value is overridden for the following entity types')}\n\n${overrides}`} | ||
</div> | ||
} | ||
> | ||
<InfoOutlined | ||
fontSize="small" | ||
color="warning" | ||
/> | ||
</Tooltip> | ||
) | ||
} | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default UserConfidenceLevel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters