Not required The following attributes are supported: alpha: English characters only, Boolean, true/false numeric: Only numeric, Boolean, true/false is allowed alpha_dash: The value can contain English, digits, underscores (_), hyphens (-), Boolean, true, or false alpha_num: Can contain English and numeric, Boolean, true/false max: indicates the maximum length of a string, int min: The minimum length of a string, int regex: a string of regular expressions
You can view the visual result of the example task.json in the R&D Store, Console, and Debugging task.json. For convenience, the following example only shows the input field. Other fields, such as atomCode, need to be completed before the plug-in is packaged.
vuex-input
vuex-input is the most common one-line input text box used to obtain user text input.
Examples:
{"input": {"username": {"label":"username","default":"","placeholder":"please enter username","type":"vuex-input","desc":"username","required":true } }}
Plugin gets input:
import python_atom_sdk as sdkusername = sdk.get_input().get("username")
Component visualization:
vuex-textarea
vuex-textarea allows you to enter multiple lines of text in a multi-line text box. The multi-line text box supports drag and stretch in the lower right corner. Example:
{"input": {"message": {"label":"message","default":"","placeholder":"please enter message","type":"vuex-textarea","desc":"message","required":true } }}
Plugin gets input:
import python_atom_sdk as sdkmessage = sdk.get_input().get("message")
Component visualization:
atom-ace-editor
atom-ace-editor is a code editing box that can highlight user input code. Currently, it supports json, python, sh, text, powershell, and batchfile. Example:
{"input": {"script": {"label":"script","default":"","placeholder":"please enter script","type":"atom-ace-editor","desc":"script","required":true,"lang":"python" } }}
Plugin gets input:
import python_atom_sdk as sdkusername = sdk.get_input().get("script")
Component visualization:
selector
selector is a drop-down selector. The user cannot enter a selector, but can only select a selector. The selector can be a fixed list or can be obtained through an interface. demo 1:
{"input": {"credential": {"label":"ticket","default":"","placeholder":"please select ticket","type":"selector","desc":"user ticket","required":true,"optionsConf": {"searchable":true,"multiple":false, "url": "/ticket/api/user/credentials/{projectId}/hasPermissionList?permission=USE&page=1&pageSize=10000&&credentialTypes=SSH_PRIVATEKEY",
"paramId":"credentialId","paramName":"credentialId","itemTargetUrl":"/ticket/{projectId}/","itemText":"add a new ticket","hasAddItem":true } } }}
Plugin gets input:
import python_atom_sdk as sdk# multiple set to falsecredential = sdk.get_input().get("credential")# multiple set to true,Need to parse the input into a python listimport jsoncredentials = sdk.get_input().get("credential")credential_list = json.loads(credentials)
import python_atom_sdk as sdk# options defines a fixed list, the user selection the plugin gets is the option id# multiple set to falsecity = sdk.get_input().get("city")# get is id# multiple set to true, need to parse input into python listimport jsoncitys = sdk.get_input().get("citys")city_list = json.loads(citys)# Get a list of ids: ["sz", "sh"]
Component visualization:
select-input
select-input is a drop-down selector for user, the input value can be a value that is not in the drop-down list, you can input variables, such as the built-in variable ${{BK_CI_START_USER_NAME}}, if the selected option is in the list, the id that is seen in the box after selection
import python_atom_sdk as sdkcity = sdk.get_input().get("city")
Component visualization:
devops-select
devops-select is an enterable drop-down box that only allows variables to be entered, and if an option is selected, the name of the option is displayed
import python_atom_sdk as sdkcity = sdk.get_input().get("city")
Component visualization:
atom-checkbox-list
atom-checkbox-list is a list of checkboxes, the options are arranged horizontally allowing the user to check multiple options and allowing default checkbox values demo:
atom-checkbox is a checkbox with only true and false states, true and false represent checked and unchecked respectively
demo:
{"input": {"isEnabled": {"label":"enabled or not","default":true,"type":"atom-checkbox","text":"enabled or not","desc":"enabled or not","required":true } }}
Plugin gets input:
import python_atom_sdk as sdkimport jsonisEnabled = sdk.get_input().get("isEnabled")# string'true'is_enabled =Trueif isEnabled =='true'elseFalse# to True
import python_atom_sdk as sdkimport jsonruntime = sdk.get_input().get("runtime")# The string is obtained and needs to be parsed into a listruntime_list = json.loads(runtime)# ['0 0 9 ? * 2', '0 30 15 ? * 2']
import python_atom_sdk as sdkimport jsonuptime = sdk.get_input().get("uptime")# The string is obtained and needs to be parsed into a intuptime_int=int(uptime)# 1658509200000 unix timestamp in milliseconds
Component visualization:
user-input
user-input allows user input to be displayed as a label
demo:
{"input": {"receiver": {"label":"receiver","type":"user-input","inputType":"all","desc":"You can fill in any user of the company, including mail groups" } }}
Plugin gets input:
import python_atom_sdk as sdkimport jsonreceiver = sdk.get_input().get("receiver")# stringreceiver_list= json.loads(receiver)# convert to list [ "ponyma", "jackma" ]
Component visualization:
tips
tips to the user to provide hints, support reference to the built-in variables of the plug-in, support dynamic preview of user input parameters, support hyperlinks
demo:
{"input": {"username": {"label":" username","default":"","placeholder":"please enter username","type":"vuex-input","desc":" username","required":true },"tiptext": {"label":"tips","type":"tips","tipStr":"Welcome {username} to the {projectId} project experience. [click to view](http://www.qq.com)","desc":"tips" } }}
Component visualization:
Public Properties
inputType
vuex-inputdemo:
{"input": {"password": {"label":" password ","placeholder":"please enter password ","inputType":"password","type":"vuex-input","desc":"please enter password ","required":true } }}
Component visualization:
groupName
Use inputGroup to group input components, and use the groupName field in the component to indicate which group the current component belongs to.
inputGroup
Input field grouping, optional, after setting, input fields can be displayed by group, support expand by group put away
The value format is array.
Multiple groups can be set, each group is described using an object, including the following properties.
Attribute Name
Attribute Description
Format
Remarks
name
groupName
string
required, configured in the groupName of the input field, identifies the group to which the field belongs
label
groupName
string
Required, the name of the group that the user sees directly
isExpanded
Whether to expand
boolean
Required, whether to expand the group by default
demo:
{"inputGroups": [ {"name":"fetch","label":"fetch","isExpanded":true }, {"name":"submodule","label":"submodule","isExpanded":true } ],"input": {"fetchDepth": {"label":"git fetch's depth parameter value","default":"","placeholder":"","type":"vuex-input","desc":"","required":false,"disabled":false,"hidden":false,"isSensitive":false,"groupName":"fetch" },"enableSubmodule": {"label":"","default":true,"placeholder":"","type":"atom-checkbox","text":"enable Submodule","desc":"Check to enable external links, uncheck to not enable","required":false,"disabled":false,"hidden":false,"isSensitive":false,"groupName":"submodule" },"submodulePath": {"label":"","default":"", "placeholder": "Please fill in the Submodule path you want to pull, separate multiple paths with commas, or pull all Submodule by default.",
"type":"vuex-input","desc":"","required":false,"disabled":false,"hidden":false,"isSensitive":false,"groupName":"submodule","rely": {"operation":"AND","expression": [ {"key":"enableSubmodule","value":true } ] } } }}
Component visualization:
isSensitive
If the user needs to enter sensitive information, using the isSensitive property, by default the plaintext will not be output in the log unless the user actively prints the input fields using sdk.log.info
demo:
{"input": {"password": {"label":" password ","placeholder":"please enter password ","inputType":"password","isSensitive":true,"type":"vuex-input","desc":"please enter password ","required":true } }}
Component visualization:
rely
The dependency allows the user to show/hide the current component based on a condition, and is usually used for item dependencies between components. Dependencies are divided into AND and OR, representing logical AND and logical OR respectively. Logical AND indicates that all conditions must be satisfied to display, while logical OR indicates that any condition is satisfied.
Examples of using AND:
{"input": {"repositoryType": {"label":" code base ","default":"ID","desc":"value is ID/NAME/URL","type":"enum-input","required":true,"disabled":false,"hidden":false,"isSensitive":false,"list": [ {"label":"select by code base","value":"ID" }, {"label":"select by name","value":"NAME" }, {"label":"select by url","value":"URL" } ] },"repositoryUrl": {"label":" code base URL","default":"","placeholder":"please enter code base URL","type":"vuex-input","desc":"","required":false,"disabled":false,"hidden":false,"isSensitive":false,"rely": {"operation":"AND","expression": [ {"key":"repositoryType","value":"URL" } ] } },"authType": {"label":"Authorization Type","default":"TICKET","type":"selector","required":false,"disabled":false,"hidden":false,"isSensitive":false,"options": [ {"name":"null","id":"EMPTY" }, {"name":"ticket","id":"TICKET" }, {"name":"access token","id":"ACCESS_TOKEN" }, {"name":"username/password","id":"USERNAME_PASSWORD" }, {"name":"start user token","id":"START_USER_TOKEN" }, {"name":"tgit personal_access_token","id":"PERSONAL_ACCESS_TOKEN" } ],"rely": {"operation":"AND","expression": [ {"key":"repositoryType","value":"URL" } ] } },"ticketId": {"label":" code base ticket","placeholder":"please select ticket","type":"select-input","desc":"","required":false,"disabled":false,"hidden":false,"isSensitive":false,"rely": {"operation":"AND","expression": [ {"key":"repositoryType","value":"URL" }, {"key":"authType","value":"TICKET" } ] },"optionsConf": {"searchable":true,"multiple":false,"url":"/ticket/api/user/credentials/{projectId}/hasPermissionList?permission=USE&page=1&pageSize=10000","paramId":"credentialId","paramName":"credentialId","itemTargetUrl":"/ticket/{projectId}/","itemText":"add a new ticket","hasAddItem":true } } }}
Component visualization:
Example of using OR:
{ "input": {"send_by": {"label":"Message Sending Method","type":"atom-checkbox-list","list": [ {"id":"weixin","name":"enterprise weixin","disable":false, "desc": "Message will be sent to Enterprise Weixin app number, need to configure Enterprise Weixin app number information in ESB first"
}, {"id":"mail","name":"mail","disable":false,"desc":"Send to mail, supports BK users as well as non-BK users " }, {"id":"dingtalk","name":"pinned","disable":false, "desc": "Send a single chat message to the nail number corresponding to the BK user, you need to configure the nail notification properly first, refer to: https://github.com/wenchao-h/ding-blueking"
} ] },"send_to": {"label":"Send to","default":"","placeholder":"The BK username that receives enterprise WeChat/Pin messages","type":"user-input","inputType":"all","desc":"Enter a carriage return to separate multiple usernames","required":true,"rely":{"operation":"OR","expression":[ {"key":"send_by","value": ["weixin","dingtalk"] } ] } } }}
Component visualization:
rule
The rule attribute restricts user input and supports the following attributes.
Attribute Name
Attribute Description
Configuration Format
Remarks
alpha
Only English characters are allowed
Boolean
demo:
// Only letters are allowed, and the string length is 3-7
"rule": {
"min": 3,
"max": 7,
"alpha": true
}
numeric
Only Number characters are allowed
Boolean
alpha_dash
Can contain English, numbers, underscores, and underscores
Boolean
alpha_num
Can contain English and numbers
Boolean
max
string max length
int
min
string min length
int
regex
Regular expressions
string
Example:
// Regular matches string starting with a number
"rule": { "regex": "^[0-9]" }
demo:
{"input": {"username": {"label":" username","placeholder":"please enter username","type":"vuex-input","desc":"please enter username","required":true,"rule": {"alpha_num":true,"max":25,"min":3,"regex":"^[a-zA-Z]" } } }}