Skip to content

Commit

Permalink
Merge pull request #114 from jgbernalp/allow-buttons-on-alert-detail-…
Browse files Browse the repository at this point in the history
…extension

OU-395: Alert detail page renders buttons and links from the plugin extension
  • Loading branch information
openshift-merge-bot[bot] committed Apr 10, 2024
2 parents 6881e75 + 63ceba1 commit 70d05fa
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/components/alerting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -830,11 +830,29 @@ const AlertsDetailsPage_: React.FC<AlertsDetailsPageProps> = ({ history, match }
<ActionServiceProvider context={{ 'alert-detail-toolbar-actions': { alert } }}>
{({ actions, loaded }) =>
loaded
? actions.filter(isActionWithHref).map((action) => (
<ToolbarItem key={action.id}>
<Link to={action.cta.href}>{action.label}</Link>
</ToolbarItem>
))
? actions.map((action) => {
if (isActionWithHref(action)) {
return (
<ToolbarItem
key={action.id}
spacer={{ default: 'spacerNone' }}
className="pf-u-px-md"
>
<Link to={action.cta.href}>{action.label}</Link>
</ToolbarItem>
);
} else if (isActionWithCallback(action)) {
return (
<ToolbarItem key={action.id} spacer={{ default: 'spacerNone' }}>
<Button variant="link" onClick={action.cta}>
{action.label}
</Button>
</ToolbarItem>
);
}

return null;
})
: null
}
</ActionServiceProvider>
Expand Down

0 comments on commit 70d05fa

Please sign in to comment.