Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 规则审计-策略新增/编辑-后端接口 --story=121513458 #524

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/backend/services/web/analyze/controls/rule_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ def create_or_update_data_source_nodes(self, need_create: bool, flow_id: int) ->
if not need_create:
# 删除已有的数据源节点
data_source_node_ids = self.strategy.backend_data.get("data_source_node_ids", [])
bulk_delete_params = [{"flow_id": flow_id, "node_id": node_id} for node_id in data_source_node_ids]
bulk_delete_params = [
{"flow_id": flow_id, "node_id": node_id, "confirm": "true"} for node_id in data_source_node_ids
]
api.bk_base.delete_flow_node.bulk_request(bulk_delete_params, ignore_exceptions=True)
logger.info("[DeleteDataSourceNodes] FlowID => %s; NodeIDS => %s", flow_id, data_source_node_ids)
data_source_node_ids = []
Expand Down Expand Up @@ -363,7 +365,7 @@ def create_or_update_storage_nodes(self, need_create: bool, flow_id: int, sql_no
self.x += self.x_interval
self.y = self.y_interval
bk_biz_id = int(self.rt_ids[0].split("_", 1)[0])
storage_node_ids = []
storage_node_ids = [] if need_create else self.strategy.backend_data.get("storage_node_ids", [])
storage_nodes = [ESStorageNode, QueueStorageNode, HDFSStorageNode]
for idx, storage_node in enumerate(storage_nodes):
node_config = storage_node(namespace=self.strategy.namespace).build_node_config(
Expand All @@ -382,7 +384,7 @@ def create_or_update_storage_nodes(self, need_create: bool, flow_id: int, sql_no
resp = api.bk_base.create_flow_node(**storage_node_config)
storage_node_ids.append(resp["node_id"])
else:
storage_node_config["node_id"] = self.strategy.backend_data["storage_node_ids"][idx]
storage_node_config["node_id"] = storage_node_ids[idx]
api.bk_base.update_flow_node(**storage_node_config)
self.y += self.y_interval
self.strategy.backend_data["storage_node_ids"] = storage_node_ids
Expand Down
4 changes: 3 additions & 1 deletion src/backend/services/web/strategy_v2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ class Strategy(SoftDeleteModel):
gettext_lazy("Event Field Configs"), default=list, null=True, blank=True
)
event_data_field_configs = models.JSONField(gettext_lazy("Event Data Configs"), default=list, null=True, blank=True)
event_evidence_field_configs = models.JSONField(gettext_lazy("Event Evidence Configs"), default=list, null=True)
event_evidence_field_configs = models.JSONField(
gettext_lazy("Event Evidence Configs"), default=list, null=True, blank=True
)

class Meta:
verbose_name = gettext_lazy("Strategy")
Expand Down
Loading