Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 76674da

Browse files
authored
fix(orchestrator): make WorkflowResult rebust on malformed input (#2488)
FLPATH-1797 Signed-off-by: Marek Libra <mlibra@redhat.com>
1 parent 7b75a96 commit 76674da

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

.changeset/odd-dryers-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@janus-idp/backstage-plugin-orchestrator": patch
3+
---
4+
5+
Fixes issue when WorkflowResult panel fails on malformed provided result.

plugins/orchestrator/src/components/WorkflowResult.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,21 +222,33 @@ const WorkflowOutputs = ({
222222

223223
return (
224224
<>
225-
{nonLinks.map(item => (
226-
<Grid item md={6} key={item.key} className={styles.outputGrid}>
227-
<AboutField
228-
label={item.key}
229-
value={(item.value || VALUE_UNAVAILABLE) as string}
230-
/>
231-
</Grid>
232-
))}
225+
{nonLinks.map(item => {
226+
let value = item.value || VALUE_UNAVAILABLE;
227+
if (typeof value !== 'string') {
228+
// This is a workaround for malformed returned data. It should not happen if the sender does WorkflowResult validation properly.
229+
if (typeof value === 'object') {
230+
value = `Object: ${JSON.stringify(value)}`;
231+
} else {
232+
value = 'Unexpected type';
233+
}
234+
}
235+
236+
return (
237+
<Grid item md={6} key={item.key} className={styles.outputGrid}>
238+
<AboutField label={item.key} value={value as string} />
239+
</Grid>
240+
);
241+
})}
233242

234243
{links?.length > 0 && (
235244
<Grid item md={12} key="__links" className={styles.links}>
236245
<AboutField label="Links">
237246
<List dense disablePadding>
238247
{links
239-
.filter(item => item.value && item.key)
248+
.filter(
249+
item =>
250+
item.value && item.key && typeof item.value === 'string',
251+
)
240252
.map(item => {
241253
return (
242254
<ListItem disableGutters key={item.key}>

0 commit comments

Comments
 (0)