Skip to content

Commit

Permalink
[frontend] display max markings in group overview by type + translati…
Browse files Browse the repository at this point in the history
…ons (#7006)
  • Loading branch information
Archidoit committed Jun 10, 2024
1 parent 552c232 commit 9df6a07
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 47 deletions.
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "Maximum",
"Maximum marking definition allowed to be shared for public dashboard": "Maximale Markierungsdefinition, die für das öffentliche Dashboard freigegeben werden kann",
"Maximum retention days": "Maximale Aufbewahrungstage",
"Maximum shareable marking definitions": "Maximal teilbare Markierungsdefinitionen",
"Maximum shareable markings": "Maximal gemeinsam nutzbare Markierungen",
"Med": "Mittel",
"MEDIUM": "MITTEL",
"Member": "Mitglied",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "Nicht gleich",
"Not implemented yet": "Noch nicht implementiert",
"Not shareable": "Nicht gemeinsam nutzbar",
"not shareable": "nicht teilbar",
"Not Specified": "Nicht spezifiziert",
"Not starts with": "Nicht beginnt mit",
"not_contains": "enthält nicht",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "Maximum",
"Maximum marking definition allowed to be shared for public dashboard": "Maximum marking definition allowed to be shared for public dashboard",
"Maximum retention days": "Maximum retention days",
"Maximum shareable marking definitions": "Maximum shareable marking definitions",
"Maximum shareable markings": "Maximum shareable markings",
"Med": "Med",
"MEDIUM": "MEDIUM",
"Member": "Member",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "Not equals",
"Not implemented yet": "Not implemented yet",
"Not shareable": "Not shareable",
"not shareable": "not shareable",
"Not Specified": "Not Specified",
"Not starts with": "Not starts with",
"not_contains": "not contains",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "Máximo",
"Maximum marking definition allowed to be shared for public dashboard": "Máxima definición de marcado que se permite compartir para el cuadro de mandos público",
"Maximum retention days": "Días de retención máxima",
"Maximum shareable marking definitions": "Definiciones de marcado máximo compartible",
"Maximum shareable markings": "Marcas máximas compartibles",
"Med": "Mediano",
"MEDIUM": "MEDIO",
"Member": "Miembro",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "No igual",
"Not implemented yet": "Aún no implementado",
"Not shareable": "No compartible",
"not shareable": "no compartibles",
"Not Specified": "No especificado",
"Not starts with": "No comienza con",
"not_contains": "no contiene",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "Maximum",
"Maximum marking definition allowed to be shared for public dashboard": "Définition maximale du marquage autorisée à être partagée pour le tableau de bord public",
"Maximum retention days": "Jours de rétention maximum",
"Maximum shareable marking definitions": "Définitions du marquage maximum partageable",
"Maximum shareable markings": "Marques maximales partageables",
"Med": "Moyen",
"MEDIUM": "MOYEN",
"Member": "Membre",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "Pas égal",
"Not implemented yet": "Pas encore mis en œuvre",
"Not shareable": "Non partageable",
"not shareable": "non partageable",
"Not Specified": "Non spécifié",
"Not starts with": "Ne commence pas par",
"not_contains": "ne contient pas",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "最大値",
"Maximum marking definition allowed to be shared for public dashboard": "公開ダッシュボードで共有できるマーキング定義の最大値",
"Maximum retention days": "最大保持日数",
"Maximum shareable marking definitions": "最大共有マーキング定義",
"Maximum shareable markings": "最大共有可能マーキング",
"Med": "中くらい",
"MEDIUM": "",
"Member": "メンバー",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "等しくない",
"Not implemented yet": "未実装",
"Not shareable": "共有不可",
"not shareable": "共有不可",
"Not Specified": "指定されていない",
"Not starts with": "で始まらない",
"not_contains": "を含まない",
Expand Down
3 changes: 3 additions & 0 deletions opencti-platform/opencti-front/lang/front/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,8 @@
"Maximum": "最大值",
"Maximum marking definition allowed to be shared for public dashboard": "公共仪表板允许共享的最大标记定义",
"Maximum retention days": "最长保留天数",
"Maximum shareable marking definitions": "最大可共享标记定义",
"Maximum shareable markings": "最大可共享标记",
"Med": "中等",
"MEDIUM": "",
"Member": "成员",
Expand Down Expand Up @@ -1625,6 +1627,7 @@
"Not equals": "不等于",
"Not implemented yet": "尚未实施",
"Not shareable": "不可共享",
"not shareable": "不可共享",
"Not Specified": "未指定",
"Not starts with": "不以...开始",
"not_contains": "不包含",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ const Group = ({ groupData }: { groupData: Group_group$key }) => {
const allowedMarkings = markingsSort(group.allowed_marking ?? []);
const markingTypes = uniq(allowedMarkings.map((marking) => marking.definition_type)).filter((type) => !!type) as string[];
const maxShareableMarkings = markingsSort(group.max_shareable_marking ?? []);
const notShareableMarkingTypes = markingTypes
.filter((type) => !maxShareableMarkings.map((shareableMarking) => shareableMarking.definition_type).includes(type))
.sort((a, b) => a.localeCompare(b));
const maxShareableMarkingsByType = new Map(markingTypes.map((type) => {
const sortedMaxMarkingsOfType = maxShareableMarkings.filter((m) => m.definition_type === type)
.sort((a, b) => b.x_opencti_order - a.x_opencti_order);
return [type, sortedMaxMarkingsOfType.length > 0 ? sortedMaxMarkingsOfType[0] : undefined];
}));
// Handle only GLOBAL entity type for now
const globalDefaultMarkings = markingsSort(
(group.default_marking ?? []).find((d) => d.entity_type === 'GLOBAL')
Expand Down Expand Up @@ -361,52 +363,58 @@ const Group = ({ groupData }: { groupData: Group_group$key }) => {
<Typography variant="h3" gutterBottom={true}>
{t_i18n('Maximum shareable markings')}
</Typography>
<FieldOrEmpty source={maxShareableMarkings}>
<FieldOrEmpty source={markingTypes}>
<List>
{maxShareableMarkings.map((marking) => (
<ListItem
key={marking.id}
dense={true}
divider={true}
button={false}
>
<ListItemIcon>
<ItemIcon
type="Marking-Definition"
color={marking.x_opencti_color ?? undefined}
/>
</ListItemIcon>
<ListItemText
primary={truncate(marking.definition, 40)}
/>
{!allowedMarkings.map((m) => m.id).includes(marking.id)
&& <Tooltip
title={t_i18n(
'This marking is not allowed for this group: users of this group can only share their allowed markings that are less restricted than this one.',
)}
>
<WarningOutlined color="warning"/>
</Tooltip>
}
</ListItem>
))}
{notShareableMarkingTypes.map((type) => (
<ListItem
key={type}
dense={true}
divider={true}
button={false}
>
<ListItemIcon>
<ItemIcon
type="Marking-Definition"
{markingTypes.map((type) => {
const marking = maxShareableMarkingsByType.get(type);
if (marking) {
return (
<ListItem
key={marking.id}
dense={true}
divider={true}
button={false}
>
<Typography variant="h3" gutterBottom={true} width={100}>
{truncate(type, 40)}
</Typography>
<ListItemIcon>
<ItemIcon
type="Marking-Definition"
color={marking.x_opencti_color ?? undefined}
/>
</ListItemIcon>
<ListItemText
primary={truncate(marking.definition, 40)}
/>
{!allowedMarkings.map((m) => m.id).includes(marking.id)
&& <Tooltip
title={t_i18n(
'This marking is not allowed for this group: users of this group can only share their allowed markings that are less restricted than this one.',
)}
>
<WarningOutlined color="warning"/>
</Tooltip>
}
</ListItem>
);
}
return (
<ListItem
key={type}
dense={true}
divider={true}
button={false}
>
<Typography variant="h3" gutterBottom={true} width={100}>
{truncate(type, 40)}
</Typography>
<ListItemText
primary={t_i18n('not shareable')}
/>
</ListItemIcon>
<ListItemText
primary={`${type} : ${t_i18n('not shareable')}`}
/>
</ListItem>
))}
</ListItem>
);
})}
</List>
</FieldOrEmpty>
</Grid>
Expand Down

0 comments on commit 9df6a07

Please sign in to comment.