import React, {useEffect, useState} from 'react'; import './App.sass'; import logo from './components/assets/Mizu-logo.svg'; import {Button, Snackbar} from "@material-ui/core"; import {HarPage} from "./components/HarPage"; import Tooltip from "./components/Tooltip"; import {makeStyles} from "@material-ui/core/styles"; import MuiAlert from '@material-ui/lab/Alert'; import Api from "./helpers/api"; const useStyles = makeStyles(() => ({ tooltip: { backgroundColor: "#3868dc", color: "white", fontSize: 13, }, })); const api = new Api(); const App = () => { const classes = useStyles(); const [analyzeStatus, setAnalyzeStatus] = useState(null); const [showTLSWarning, setShowTLSWarning] = useState(false); const [userDismissedTLSWarning, setUserDismissedTLSWarning] = useState(false); const [addressesWithTLS, setAddressesWithTLS] = useState(new Set()); useEffect(() => { (async () => { const recentTLSLinks = await api.getRecentTLSLinks(); if (recentTLSLinks?.length > 0) { setAddressesWithTLS(new Set([...addressesWithTLS, ...recentTLSLinks])); setShowTLSWarning(true); } })(); }, []); const onTLSDetected = (destAddress: string) => { addressesWithTLS.add(destAddress); setAddressesWithTLS(new Set(addressesWithTLS)); if (!userDismissedTLSWarning) { setShowTLSWarning(true); } }; const analysisMessage = analyzeStatus?.isRemoteReady ?
Status Available
Messages {analyzeStatus?.sentCount}
: analyzeStatus?.sentCount > 0 ?
Status Processing
Messages {analyzeStatus?.sentCount}
Please allow a few minutes for the analysis to complete
:
Status Waiting for traffic
Messages {analyzeStatus?.sentCount}
return (
logo
Traffic viewer for Kubernetes
{analyzeStatus?.isAnalyzing &&
}
setUserDismissedTLSWarning(true)} severity="warning"> Mizu is detecting TLS traffic{addressesWithTLS.size ? ` (directed to ${Array.from(addressesWithTLS).join(", ")})` : ''}, this type of traffic will not be displayed.
); } export default App;