mirror of
https://github.com/Unleash/unleash.git
synced 2025-10-04 11:17:02 +02:00
## About the changes This PR improves our queries to Prometheus (instead of making multiple queries do only one) and improves the UI and the code. The reports aggregate all HTTP methods (GET, POST, PUT, DELETE, OPTIONS, HEAD and PATCH) without distinction under the same "endpoint" (a relative path inside unleash up to a certain depth) Co-authored-by: Nuno Góis <nuno@getunleash.ai>
41 lines
954 B
TypeScript
41 lines
954 B
TypeScript
import { styled } from '@mui/material';
|
|
import mermaid from 'mermaid';
|
|
import { useRef, useEffect } from 'react';
|
|
|
|
const StyledMermaid = styled('div')(({ theme }) => ({
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
'#mermaid .edgeLabel': {
|
|
backgroundColor: theme.palette.background.paper,
|
|
},
|
|
}));
|
|
|
|
mermaid.initialize({
|
|
startOnLoad: false,
|
|
theme: 'default',
|
|
themeCSS: `
|
|
.clusters #_ rect {
|
|
fill: transparent;
|
|
stroke: transparent;
|
|
}
|
|
`,
|
|
});
|
|
|
|
interface IMermaidProps {
|
|
children: string;
|
|
}
|
|
|
|
export const Mermaid = ({ children, ...props }: IMermaidProps) => {
|
|
const mermaidRef = useRef<HTMLDivElement>(null);
|
|
|
|
useEffect(() => {
|
|
mermaid.render('mermaid', children, svgCode => {
|
|
if (mermaidRef.current) {
|
|
mermaidRef.current.innerHTML = svgCode;
|
|
}
|
|
});
|
|
}, [children]);
|
|
|
|
return <StyledMermaid ref={mermaidRef} {...props} />;
|
|
};
|