Skip to content

Commit

Permalink
fix(apis/web/resource/view): 修复资源绑定插件未修改但触发更新问题
Browse files Browse the repository at this point in the history
  • Loading branch information
F-cq committed Nov 11, 2024
1 parent 10ada76 commit 61ee92e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
8 changes: 1 addition & 7 deletions src/dashboard/apigateway/apigateway/apis/web/plugin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,17 +334,11 @@ def _check_if_changed(self, input_data: Dict[str, Any], instance: PluginConfig)
input_yaml = yaml_loads(input_data["yaml"])
current_yaml = yaml_loads(instance.yaml)

if input_yaml != current_yaml:
if input_yaml != current_yaml or input_data["type_id"].id != instance.type.id:
return True
except Exception:
return True

if input_data["name"] != instance.name:
return True

if input_data["type_id"].id != instance.type.id:
return True

return False

def get_queryset(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,6 @@ def test_check_if_changed(
}
assert view._check_if_changed(fake_input_data1, fake_plugin_bk_header_rewrite)

# update name
fake_input_data2 = {
"name": "bk-header-rewrite-2",
"type_id": fake_plugin_check_changed_binding[0],
"yaml": yaml,
}
assert view._check_if_changed(fake_input_data2, fake_plugin_bk_header_rewrite)

# update type_id
fake_input_data3 = {
"name": fake_plugin_bk_header_rewrite.name,
Expand Down

0 comments on commit 61ee92e

Please sign in to comment.