showing the tenzir active status in the UI
This commit is contained in:
committed by
satti-hari-krishna-reddy
parent
ab3c755ad3
commit
ecfb78e82d
@@ -11,14 +11,13 @@ import { toast } from "react-toastify";
|
|||||||
import RuleCard from "./RuleCard";
|
import RuleCard from "./RuleCard";
|
||||||
import { styled } from "@mui/system";
|
import { styled } from "@mui/system";
|
||||||
|
|
||||||
const ConnectedButton = styled(Button)({
|
const ConnectedButton = styled(Button)(({ theme, isConnected }) => ({
|
||||||
backgroundColor: "red",
|
backgroundColor: isConnected ? "green" : "red",
|
||||||
color: "white",
|
color: "white",
|
||||||
});
|
}));
|
||||||
|
|
||||||
const handleDirectoryChange = (folderDisabled, setFolderDisabled, globalUrl) => {
|
const handleDirectoryChange = (folderDisabled, setFolderDisabled, globalUrl) => {
|
||||||
|
const action = folderDisabled ? "enable_folder" : "disable_folder";
|
||||||
const action = folderDisabled ? "enable_folder" : "disable_folder"
|
|
||||||
const url = `${globalUrl}/api/v1/files/detection/${action}`;
|
const url = `${globalUrl}/api/v1/files/detection/${action}`;
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
@@ -42,10 +41,16 @@ const handleDirectoryChange = ( folderDisabled, setFolderDisabled, globalUrl) =>
|
|||||||
console.log(`Error in ${action} the rule: `, error);
|
console.log(`Error in ${action} the rule: `, error);
|
||||||
toast(`An error occurred while ${action} the rule`);
|
toast(`An error occurred while ${action} the rule`);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
}
|
const Detection = ({
|
||||||
|
globalUrl,
|
||||||
const Detection = ({ globalUrl, ruleInfo, folderDisabled, setFolderDisabled, openEditBar }) => {
|
ruleInfo,
|
||||||
|
folderDisabled,
|
||||||
|
setFolderDisabled,
|
||||||
|
openEditBar,
|
||||||
|
isTenzirActive,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<Container sx={{ mt: 4 }}>
|
<Container sx={{ mt: 4 }}>
|
||||||
<Box sx={{ border: "1px solid #ccc", borderRadius: 2, p: 3 }}>
|
<Box sx={{ border: "1px solid #ccc", borderRadius: 2, p: 3 }}>
|
||||||
@@ -60,8 +65,11 @@ const Detection = ({ globalUrl, ruleInfo, folderDisabled, setFolderDisabled, ope
|
|||||||
<Typography variant="h6" component="div">
|
<Typography variant="h6" component="div">
|
||||||
Sigma Detection Rules
|
Sigma Detection Rules
|
||||||
</Typography>
|
</Typography>
|
||||||
<ConnectedButton variant="contained">
|
<ConnectedButton
|
||||||
Not Connected to SIEM
|
variant="contained"
|
||||||
|
isConnected={isTenzirActive}
|
||||||
|
>
|
||||||
|
{isTenzirActive ? "Connected to SIEM" : "Not Connected to SIEM"}
|
||||||
</ConnectedButton>
|
</ConnectedButton>
|
||||||
</Box>
|
</Box>
|
||||||
<Box
|
<Box
|
||||||
@@ -79,7 +87,9 @@ const Detection = ({ globalUrl, ruleInfo, folderDisabled, setFolderDisabled, ope
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Switch
|
<Switch
|
||||||
checked={!folderDisabled}
|
checked={!folderDisabled}
|
||||||
onChange={() => handleDirectoryChange(folderDisabled, setFolderDisabled, globalUrl)}
|
onChange={() =>
|
||||||
|
handleDirectoryChange(folderDisabled, setFolderDisabled, globalUrl)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user