feat: The custom parameters of the tool can set a default value#5224
feat: The custom parameters of the tool can set a default value#5224wangliang181230 wants to merge 1 commit into1Panel-dev:v2from
Conversation
|
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. DetailsInstructions 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. |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| return json.dumps(data, default=default_serializer, ensure_ascii=False) | ||
| else: | ||
| # 直接输出数组(list)对象 | ||
| return data |
There was a problem hiding this comment.
其他优化2. MySQL 查询 工具,添加 to_json_str 参数,用于控制查询结果是否转为JSON字符串(默认值:1=会转为JSON字符串)
在部分情况下,可设置该参数为0,输出结果不转为JSON字符串,可通过其他工具来处理数据。
|
|
||
| finally: | ||
| if db: | ||
| db.close()', '[{"name": "sql", "type": "string", "source": "reference", "is_required": true}, {"name": "to_json_str", "desc": "结果是否转换为JSON字符串:1=是 | 0=否", "type": "boolean", "source": "custom", "is_required": false, "default_value": "1"}]', '[{"attrs": {"maxlength": 200, "minlength": 1, "show-word-limit": true}, "field": "host", "label": "host", "required": true, "input_type": "TextInput", "props_info": {"rules": [{"message": "host 为必填属性", "required": true}, {"max": 200, "min": 1, "message": "host长度在 1 到 200 个字符", "trigger": "blur"}]}, "default_value": "x", "show_default_value": false}, {"attrs": {"maxlength": 20, "minlength": 1, "show-word-limit": true}, "field": "port", "label": "port", "required": true, "input_type": "TextInput", "props_info": {"rules": [{"message": "port 为必填属性", "required": true}, {"max": 20, "min": 1, "message": "port长度在 1 到 20 个字符", "trigger": "blur"}]}, "default_value": "3306", "show_default_value": false}, {"attrs": {"maxlength": 200, "minlength": 1, "show-word-limit": true}, "field": "user", "label": "user", "required": true, "input_type": "TextInput", "props_info": {"rules": [{"message": "user 为必填属性", "required": true}, {"max": 200, "min": 1, "message": "user长度在 1 到 200 个字符", "trigger": "blur"}]}, "default_value": "root", "show_default_value": false}, {"attrs": {"type": "password", "maxlength": 200, "minlength": 1, "show-password": true, "show-word-limit": true}, "field": "password", "label": "password", "required": true, "input_type": "PasswordInput", "props_info": {"rules": [{"message": "password 为必填属性", "required": true}, {"max": 200, "min": 1, "message": "password长度在 1 到 200 个字符", "trigger": "blur"}]}, "default_value": "x", "show_default_value": false}, {"attrs": {"maxlength": 200, "minlength": 1, "show-word-limit": true}, "field": "database", "label": "database", "required": true, "input_type": "TextInput", "props_info": {"rules": [{"message": "database 为必填属性", "required": true}, {"max": 200, "min": 1, "message": "database长度在 1 到 200 个字符", "trigger": "blur"}]}, "default_value": "x", "show_default_value": false}]', './tool/mysql/icon.png', true, 'INTERNAL', 'INTERNAL', null, 'None', null, 'f0dd8f71-e4ee-11ee-8c84-a8a1595801ab', 'default'); |
There was a problem hiding this comment.
其他优化2:MySQL 查询 工具,db.close() 放到 finally: 中执行
| return json_data | ||
|
|
||
| # 关闭数据库连接 | ||
| db.close() |
There was a problem hiding this comment.
db.close() 在 return 之后,为无效代码,根本就没有关闭掉。
0bd6c1c to
2268f2f
Compare
| {{ item.desc }} | ||
| </template> | ||
| <AppIcon iconName="app-warning" class="app-warning-icon"></AppIcon> | ||
| </el-tooltip> |
There was a problem hiding this comment.
工具调试界面,展示 desc 参数提示说明
4fe8fbf to
855e0ef
Compare
d5bcb3c to
47b777a
Compare
What this PR does / why we need it?
feat: The custom parameters of the tool can set a default value
Summary of your change
新特性:工具的自定义参数,可以设置一个默认值。
界面效果截图:

Please indicate you've done the following: