Skip to content

Commit

Permalink
Checking validity of the messsage
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradPietocha committed Jan 7, 2025
1 parent 04e9fbc commit acea500
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/Extensibility/components/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export function Badge({
arrayItems,
});

const extractMessageAndCheckValidity = text => {
const messageArray = `${text}`.split('message');
const message = messageArray[messageArray.length - 1];
return message.includes('null') || message.includes('undefined')
? ''
: text;
};

const [tooltip, tooltipError] = jsonata(structure?.description);

let type = null;
Expand Down Expand Up @@ -78,7 +86,9 @@ export function Badge({
autoResolveType={!type}
type={type}
tooltipContent={
tooltip && !tooltipError ? tooltip : structure.description
tooltip && !tooltipError
? tooltip
: extractMessageAndCheckValidity(structure.description)
}
>
{tExt(value)}
Expand Down

0 comments on commit acea500

Please sign in to comment.