fixing bugs in rule editing

This commit is contained in:
Hari Krishna
2024-06-13 09:54:50 +00:00
committed by satti-hari-krishna-reddy
parent 809fc2c202
commit e90b698f84
3 changed files with 35 additions and 21 deletions
+9 -2
View File
@@ -39,6 +39,12 @@ const DetectionDashBoard = (props) => {
getSigmaInfo(globalUrl, setRuleInfo);
}, [globalUrl]);
useEffect(() => {
if (ruleInfo.length > 0) {
openEditBar(ruleInfo[0]);
}
}, [ruleInfo]);
const openEditBar = (rule) => {
setSelectedRule(rule);
getFileContent(rule.file_id)
@@ -50,6 +56,7 @@ const DetectionDashBoard = (props) => {
};
const getFileContent = (file_id) => {
setFileData("");
fetch(globalUrl + "/api/v1/files/" + file_id + "/content", {
method: "GET",
headers: {
@@ -82,10 +89,10 @@ const DetectionDashBoard = (props) => {
};
return (
<Container style={{display: "flex", width: "100%"}}>
<Container style={{display: "flex"}}>
{selectedRule ? (
<EditComponent
ruleName={selectedRule.ruleName}
ruleName={selectedRule.title}
description={selectedRule.description}
content={fileData}
setContent={setFileData}