Skip to content

Commit

Permalink
Launching in dev mode without xcore won't crash anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Jul 16, 2024
1 parent 73143be commit a01b908
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/react/next-architecture/ui/AlertProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ export const useAlerts = (filters: FilterLabels) => {

const AlertProvider = ({ children }: { children: React.ReactNode }) => {
const xcoreConfig = useXcoreRuntimeConfig();

let alertManagerUrl = '';
if (xcoreConfig) {
alertManagerUrl = xcoreConfig.spec.selfConfiguration.url_alertmanager;
} else {
console.log('The alert manager is not available.');
}

return (
<window.shellAlerts.AlertsProvider
alertManagerUrl={xcoreConfig.spec.selfConfiguration.url_alertmanager}
>
<window.shellAlerts.AlertsProvider alertManagerUrl={alertManagerUrl}>
{children}
</window.shellAlerts.AlertsProvider>
);
Expand Down

0 comments on commit a01b908

Please sign in to comment.