Skip to content

Commit 62c0932

Browse files
[frontend] Adapt ref and E2E (#8237)
1 parent 1ace137 commit 62c0932

File tree

5 files changed

+61
-61
lines changed

5 files changed

+61
-61
lines changed

opencti-platform/opencti-front/src/private/components/common/stix_core_objects/StixCoreObjectLatestHistory.tsx

Lines changed: 55 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -53,64 +53,63 @@ const StixCoreObjectLatestHistory = ({ stixCoreObjectId }: StixCoreObjectLatestH
5353

5454
return (
5555
<>
56-
<Typography variant="h4">
56+
<Typography variant="h4" gutterBottom={true}>
5757
{t_i18n('Most recent history')}
5858
</Typography>
59-
{queryRef
60-
&& (
61-
<React.Suspense
62-
fallback={(
63-
<Paper
64-
sx={{
65-
marginTop: theme.spacing(1),
66-
padding: 0,
67-
borderRadius: 4,
68-
}}
69-
variant="outlined"
70-
className="paper-for-grid"
71-
>
72-
<List>
73-
{Array.from(Array(5), (e, i) => (
74-
<ListItem
75-
key={`latest_history_skel_${i}`}
76-
dense
77-
divider
78-
>
79-
<ListItemIcon>
80-
<Avatar>{i}</Avatar>
81-
</ListItemIcon>
82-
<ListItemText
83-
primary={(
84-
<Skeleton
85-
animation="wave"
86-
variant="rectangular"
87-
width="90%"
88-
height={15}
89-
style={{ marginBottom: 10 }}
90-
/>
91-
)}
92-
secondary={(
93-
<Skeleton
94-
animation="wave"
95-
variant="rectangular"
96-
width="90%"
97-
height={15}
98-
/>
99-
)}
100-
/>
101-
</ListItem>
102-
))}
103-
</List>
104-
</Paper>
105-
)}
106-
>
107-
<StixCoreObjectHistoryLines
108-
queryRef={queryRef}
109-
isRelationLog={false}
110-
paginationOptions={paginationOptions}
111-
/>
112-
</React.Suspense>
113-
)
59+
{queryRef && (
60+
<React.Suspense
61+
fallback={(
62+
<Paper
63+
sx={{
64+
marginTop: theme.spacing(1),
65+
padding: 0,
66+
borderRadius: 4,
67+
}}
68+
variant="outlined"
69+
className="paper-for-grid"
70+
>
71+
<List>
72+
{Array.from(Array(5), (e, i) => (
73+
<ListItem
74+
key={`latest_history_skel_${i}`}
75+
dense
76+
divider
77+
>
78+
<ListItemIcon>
79+
<Avatar>{i}</Avatar>
80+
</ListItemIcon>
81+
<ListItemText
82+
primary={(
83+
<Skeleton
84+
animation="wave"
85+
variant="rectangular"
86+
width="90%"
87+
height={15}
88+
style={{ marginBottom: 10 }}
89+
/>
90+
)}
91+
secondary={(
92+
<Skeleton
93+
animation="wave"
94+
variant="rectangular"
95+
width="90%"
96+
height={15}
97+
/>
98+
)}
99+
/>
100+
</ListItem>
101+
))}
102+
</List>
103+
</Paper>
104+
)}
105+
>
106+
<StixCoreObjectHistoryLines
107+
queryRef={queryRef}
108+
isRelationLog={false}
109+
paginationOptions={paginationOptions}
110+
/>
111+
</React.Suspense>
112+
)
114113
}
115114
</>
116115
);

opencti-platform/opencti-front/tests_e2e/incidentResponse/incidentResponse.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ test('Incident Response Creation', { tag: ['@ce'] }, async ({ page }) => {
170170
const updateDate = incidentResponseDetailsPage.getTextForHeading('Modification date', now);
171171
await expect(updateDate).toBeVisible();
172172

173-
const historyDescription = incidentResponseDetailsPage.getTextForHeading('Most recent history', `creates a Case-Incident ${incidentResponseName}`);
173+
const historyDescription = incidentResponseDetailsPage.getTextForHeading('Most recent history', `creates a Case-Incident \`${incidentResponseName}\``);
174174
await expect(historyDescription).toBeVisible();
175175
const historyDate = incidentResponseDetailsPage.getTextForHeading('Most recent history', format(new Date(), 'MMM d, yyyy'));
176176
await expect(historyDate).toBeVisible();

opencti-platform/opencti-front/tests_e2e/report/report.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ test('Report CRUD', { tag: ['@report', '@knowledge', '@mutation', '@ce'] }, asyn
178178
const updateDate = reportDetailsPage.getTextForHeading('Modification date', now);
179179
await expect(updateDate).toBeVisible();
180180

181-
const historyDescription = reportDetailsPage.getTextForHeading('Most recent history', `creates a Report ${reportName}`);
181+
const historyDescription = reportDetailsPage.getTextForHeading('Most recent history', `creates a Report \`${reportName}\``);
182182
await expect(historyDescription).toBeVisible();
183183
const historyDate = reportDetailsPage.getTextForHeading('Most recent history', format(new Date(), 'MMM d, yyyy'));
184184
await expect(historyDate).toBeVisible();

opencti-platform/opencti-graphql/src/database/generate-message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const humanizeRawValue = (attribute: AttributeDefinition, v: ChangeValue, format
9595
return isEmptyField(v.raw) ? EMPTY_VALUE : v.raw; // vocab / enum
9696
}
9797
if (attribute?.type === 'boolean') {
98-
return v.raw === 'true' ? 'yes' : 'no';
98+
return v.raw === 'true' ? 'Yes' : 'No';
9999
}
100100
if (attribute?.type === 'numeric') {
101101
return v.raw;

opencti-platform/opencti-graphql/src/database/middleware.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,15 +2064,16 @@ const buildAttribute = async (context, entityType, key, values) => {
20642064
return Promise.all(cleanedValues.map(async (item) => {
20652065
// Complex object
20662066
if (attribute.type === 'ref') {
2067-
return { raw: item.internal_id, translated: extractEntityRepresentativeName(item) };
2067+
const translated = { [item.internal_id]: extractEntityRepresentativeName(item) };
2068+
return { raw: item.internal_id, translated: JSON.stringify(translated) };
20682069
}
20692070
if (attribute.type === 'object') {
20702071
const translated = await attribute.translate?.(item, translater);
20712072
return { raw: JSON.stringify(item), translated: translated ? JSON.stringify(translated) : undefined };
20722073
}
20732074
if (attribute.type === 'string' && attribute.format === 'json') {
20742075
const translated = await attribute.translate?.(item, translater);
2075-
return { raw: item, translated: JSON.stringify(translated) };
2076+
return { raw: item, translated: translated ? JSON.stringify(translated) : undefined };
20762077
}
20772078
// Native type
20782079
if (attribute.type === 'string') {

0 commit comments

Comments
 (0)