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: 新增内置赋值节点 #82 #92

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ZC-A
Copy link
Collaborator

@ZC-A ZC-A commented Jan 14, 2025

No description provided.

def plugin_execute(self, data, parent_data):
runtime = BambooDjangoRuntime()
upsert_dict = {}
pipeline_id = self._runtime_attrs["root_pipeline_id"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

尽量不从隐藏属性拿数据,看看 parent_data 有没有

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parent_data没有这部分数据

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看看 self.top_pipeline_id

$.atoms.value_assign = [
{
tag_code: "bk_assignment_list",
type: "datatable",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前端建议定制组件,用表格太不直观

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等前端出组件调试

def plugin_execute(self, data, parent_data):
runtime = BambooDjangoRuntime()
upsert_dict = {}
pipeline_id = self._runtime_attrs["root_pipeline_id"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看看 self.top_pipeline_id

# 处理输入变量与目标变量的类型转换(输入常量时) 如果是相同类型则必然成功
try:
# 尝试将输入转换为目标变量类型
input_val = type(context.value)(input_val)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确认下,如果变量没有默认值,那么这种方案是不是就有问题。

是否可以考虑如果不做类型校验,评估合理性;确认下这样是不是都可以正常赋值,如果是的话在插件说明中体现

bound_service = ValueAssignService
form = settings.STATIC_URL + "components/value_assign/v1_0_0.js"
version = "v1.0.0"
desc = "提供内置赋值功能"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要补充实现机制,比如目标变量必须存在、类型校验或不校验等

pipeline_id = self._runtime_attrs["root_pipeline_id"]
assign_list = data.get_one_of_inputs("bk_assignment_list")
# 构建目标变量集合
target_var_set = {"${{{}}}".format(assign["bk_assgin_target_var"]) for assign in assign_list}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个模板提出来,作为类变量即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants