diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx
index f3acbf27..f4604e15 100755
--- a/frontend/src/views/AngularWorkflow.jsx
+++ b/frontend/src/views/AngularWorkflow.jsx
@@ -535,6 +535,7 @@ const AngularWorkflow = (defaultprops) => {
const [selectedOption, setSelectedOption] = React.useState("");
const [tenzirConfigModalOpen, setTenzirConfigModalOpen] = React.useState(false);
const [rules, setRules] = React.useState([]);
+ const [sigmaFilesNames, setSigmaFileNames] = React.useState("")
const [distributedFromParent, setDistributedFromParent] = React.useState("")
const [suborgWorkflows, setSuborgWorkflows] = React.useState([])
@@ -993,12 +994,6 @@ const releaseToConnectLabel = "Release to Connect"
}
}, [authenticationModalOpen])
- useEffect(() =>{
- if (tenzirConfigModalOpen === false) return;
-
- getSigmaInfo();
- },[tenzirConfigModalOpen])
-
const listOrgCache = (orgId) => {
fetch(`${globalUrl}/api/v1/orgs/${orgId}/list_cache`, {
method: "GET",
@@ -1473,6 +1468,59 @@ const releaseToConnectLabel = "Release to Connect"
setTenzirConfigModalOpen(false);
};
+
+ const handleSubmit = (trigger) => {
+ if (trigger.trigger_type !== "PIPELINE") {
+ toast("Unable to save the configuration");
+ return;
+ }
+ if (selectedOption == "kafka Queue") {
+ trigger.parameters = []
+
+ const topic = document.getElementById('topic')?.value
+ const bootstrapServers = document.getElementById('bootstrap_servers')?.value
+ const groupId = document.getElementById('group_id')?.value
+ const autoOffsetReset = document.getElementById('auto_offset_reset')?.value;
+
+ if(topic) {
+ trigger.parameters.push({
+ name: "topic",
+ value: topic
+ })
+ } else {
+ toast("Please enter the topic name");
+ return;
+ }
+
+ if (bootstrapServers) {
+ trigger.parameters.push({
+ name: "bootstrap_servers",
+ value: bootstrapServers
+ });
+ } else {
+ toast("please enter bootstrap server details");
+ return;
+ }
+
+ if (groupId) {
+ trigger.parameters.push({
+ name: "group_id",
+ value: groupId
+ });
+ }
+
+ if (autoOffsetReset) {
+ trigger.parameters.push({
+ name: "auto_offset_reset",
+ value: autoOffsetReset
+ });
+ }
+
+ setTenzirConfigModalOpen(false);
+ }
+
+ };
+
const handleColoring = (actionId, status, label) => {
if (cy === undefined) {
@@ -15417,7 +15465,18 @@ const releaseToConnectLabel = "Release to Connect"
return;
} else {
setSelectedOption("SigmaRule");
- setTenzirConfigModalOpen(true);
+ const command = `export | sigma /var/lib/tenzir/sigma_rules | to ${globalUrl}/api/v1/pipelines/pipeline_${selectedTrigger.id}`
+ const pipelineConfig = {
+ command: command,
+ name: selectedTrigger.label,
+ type: "create",
+ environment: selectedTrigger.environment,
+ workflow_id: workflow.id,
+ trigger_id: selectedTrigger.id,
+ start_node: "",
+ };
+ submitPipeline(selectedTrigger, selectedTriggerIndex, pipelineConfig);
+
}}}
style={{
border: "1px solid rgba(255,255,255,0.3)",
@@ -21194,90 +21253,6 @@ const releaseToConnectLabel = "Release to Connect"
) : null;
const TenzirConfigModal = () => {
- const [loading, setLoading] = useState(true);
- const [selectedRules, setSelectedRules] = useState([]);
-
- useEffect(() => {
- if (tenzirConfigModalOpen) {
- try {
- const url = globalUrl + "/api/v1/detection/" + selectedTrigger.id + "/selected_rules"
- fetch(url, {
- method: "GET",
- credentials: "include",
- headers: {
- "Content-Type": "application/json",
- },
- })
- .then(response => response.json())
- .then(data => {
- const savedRules = data.selected_rules.map(rule => rule.file_id);
- setSelectedRules(savedRules);
- setLoading(false);
- })
- .catch(error => {
- console.error('Error fetching selected rules:', error);
- setLoading(false);
- });
- } catch (error) {
- console.error('Error:', error);
- setLoading(false);
- }
- }
- }, [tenzirConfigModalOpen]);
-
- const handleRuleChange = (event) => {
- setSelectedRules(event.target.value);
- };
-
- const handleSelectAll = () => {
- const allEnabledRules = rules.filter(rule => rule.is_enabled).map(rule => rule.file_id);
- setSelectedRules(allEnabledRules);
- };
-
- const handleClose = () => {
- setTenzirConfigModalOpen(false);
- };
-
- const handleSubmit = () => {
- const selectedRuleFiles = rules.filter(rule => selectedRules.includes(rule.file_id));
-
- const payload = {
- selected_rules: selectedRuleFiles.map(rule => ({
- file_name: rule.file_name,
- title: rule.title,
- description: rule.description,
- file_id: rule.file_id,
- is_enabled: rule.is_enabled,
- }))
- };
-
- try {
- const url = globalUrl + "/api/v1/detection/" + selectedTrigger.id + "/selected_rules/save"
- fetch(url, {
- method: 'POST',
- credentials: "include",
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(payload),
- })
- .then(response => response.json())
- .then(data => {
- console.log('Rules saved successfully:', data);
- setTenzirConfigModalOpen(false);
- })
- .catch(error => {
- console.error('Error saving selected rules:', error);
- toast("Unable to save the configuration");
- });
- } catch (error) {
- console.error('Error:', error);
- toast("Unable to save the configuration");
- }
- };
-
- const enabledSigmaInfo = rules.filter(rule => rule.is_enabled);
-
if (!tenzirConfigModalOpen) return null;
return (
@@ -21302,65 +21277,116 @@ const releaseToConnectLabel = "Release to Connect"
},
}}
>
- {loading ? (
-