diff --git a/frontend/src/views/Detection.jsx b/frontend/src/views/Detection.jsx
index 67b6a2ed..63567584 100644
--- a/frontend/src/views/Detection.jsx
+++ b/frontend/src/views/Detection.jsx
@@ -7,7 +7,7 @@ import {
Typography,
Button,
} from "@mui/material";
-import RuleCard from "./RuleCard";
+import RuleCard from "./RuleCard";
import { styled } from "@mui/system";
const ConnectedButton = styled(Button)({
@@ -18,7 +18,7 @@ const ConnectedButton = styled(Button)({
const Detection = ({ globalUrl, ruleInfo, openEditBar }) => {
return (
-
+
{
- {ruleInfo.length > 0 &&
- ruleInfo.map((card) => (
- openEditBar(card)}
- {...card}
- />
- ))}
+
+ {ruleInfo.length > 0 &&
+ ruleInfo.map((card) => (
+ openEditBar(card)}
+ {...card}
+ />
+ ))}
+
);
diff --git a/frontend/src/views/DetectionDashboard.jsx b/frontend/src/views/DetectionDashboard.jsx
index 50771d63..bd8a2813 100644
--- a/frontend/src/views/DetectionDashboard.jsx
+++ b/frontend/src/views/DetectionDashboard.jsx
@@ -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 (
-
+
{selectedRule ? (
+
- {ruleName}
-
-
-
+ {ruleName}
{description}