Skip to content

feat: The custom parameters can set a default value#5224

Open
wangliang181230 wants to merge 1 commit into1Panel-dev:v2from
wangliang181230:PR/feat-1-tool
Open

feat: The custom parameters can set a default value#5224
wangliang181230 wants to merge 1 commit into1Panel-dev:v2from
wangliang181230:PR/feat-1-tool

Conversation

@wangliang181230
Copy link
Copy Markdown
Contributor

@wangliang181230 wangliang181230 commented May 7, 2026

What this PR does / why we need it?

feat: The custom parameters can set a default value

Summary of your change

新特性:自定义参数,可以设置一个默认值。

界面效果截图
图片

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented May 7, 2026

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link
Copy Markdown

f2c-ci-robot Bot commented May 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

return json.dumps(data, default=default_serializer, ensure_ascii=False)
else:
# 直接输出数组(list)对象
return data
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 May 7, 2026

Choose a reason for hiding this comment

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

其他优化1. MySQL 查询 工具,添加 to_json_str 参数,用于控制查询结果是否转为JSON字符串(默认值:1=会转为JSON字符串)

在部分情况下,可设置该参数为0,输出结果不转为JSON字符串,可通过其他工具来处理数据。

同时,input_field_list 字段中添加了 , {"name": "to_json_str", "desc": "结果是否转换为JSON字符串:1=是 | 0=否", "type": "boolean", "source": "custom", "is_required": false, "default_value": "1"}。默认值为 1

return json_data

# 关闭数据库连接
db.close()
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 May 7, 2026

Choose a reason for hiding this comment

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

其他优化2:代码 db.close()return 之后了,成了无效代码,根本就不会执行该代码。所以 db.close() 放到 finally: 中执行

@wangliang181230 wangliang181230 force-pushed the PR/feat-1-tool branch 2 times, most recently from 0bd6c1c to 2268f2f Compare May 7, 2026 08:12
{{ item.desc }}
</template>
<AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon>
</el-tooltip>
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 May 7, 2026

Choose a reason for hiding this comment

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

其他优化3:工具调试界面,展示 desc 参数提示说明

图片

@wangliang181230 wangliang181230 force-pushed the PR/feat-1-tool branch 5 times, most recently from 7a20d11 to f60d4a2 Compare May 8, 2026 02:45
@wangliang181230 wangliang181230 changed the title feat: The custom parameters of the tool can set a default value feat: The custom parameters can set a default value May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant