From e1d0857fd76aa693e14bffcf0ca2423518d892d1 Mon Sep 17 00:00:00 2001 From: Hari Krishna Date: Tue, 11 Jun 2024 16:38:28 +0000 Subject: [PATCH] made the ui to look good --- frontend/src/App.jsx | 6 ++ frontend/src/views/Detection.jsx | 148 +++++++++++++++++++++++++------ 2 files changed, 126 insertions(+), 28 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 639b80bd..27517625 100755 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -15,6 +15,7 @@ import HealthPage from "./components/HealthPage.jsx"; import theme from "./theme"; import Apps from "./views/Apps"; import AppCreator from "./views/AppCreator"; +import Dectection from "./views/Detection.jsx"; import Welcome from "./views/Welcome.jsx"; import Dashboard from "./views/Dashboard.jsx"; @@ -414,6 +415,11 @@ const App = (message, props) => { /> } /> + } + /> ( +const disableRule = (fileId) => { + +} + + +const RuleCard = ({ ruleName, description, ...otherProps }) => { + const [additionalProps, setAdditionalProps] = React.useState(otherProps); + return ( -
- {ruleName} -
- +
+ {ruleName} +
+ - +
-
- {description} - - +
+ + {description} + + + {/* we need icons here ??? */} - -); + ) +} -const Detection = () => { +const Detection = (props) => { + const {globalUrl} = props; + const [ruleInfo, setRuleInfo] = React.useState([]); + + const getSigmaInfo = () => { + const url = globalUrl + "/api/v1/files/detection/sigma_rules" + + fetch(url, { + method: "GET", + credentials: "include", + headers: { + "Content-Type": "application/json", + }, + }) .then((response) => + response.json().then((responseJson) => { + if (responseJson["success"] === false) { + toast("Failed to get sigma rules"); + } else { + setRuleInfo(responseJson); + } + + }), + ) + .catch((error) => { + console.log("Error in geting sigma files: ", error); + }); + } + + React.useEffect(() => { + getSigmaInfo() +}, []); + return ( - - + + Group 1 Title - Not Connected to SIEM + + Not Connected to SIEM + - + - - Global disable/enable + + + Global disable/enable + - - - + {ruleInfo.length > 0 && + ruleInfo.map((card) => ( + + ))} );