Skip to content

Commit

Permalink
feat(设备模拟器): 添加设备模拟器
Browse files Browse the repository at this point in the history
优化字段必填设置,优化默认值

re #203
  • Loading branch information
Lind-pro committed Sep 21, 2020
1 parent 4b11e36 commit cf0c45f
Showing 1 changed file with 49 additions and 6 deletions.
55 changes: 49 additions & 6 deletions src/pages/simulator/device/save/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ const Save: React.FC<Props> = props => {
"runner.binds": {
"title": "绑定网卡",
"x-component": "select",
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"x-component-props": {
"mode": "tags",
},
Expand Down Expand Up @@ -316,24 +310,48 @@ const Save: React.FC<Props> = props => {
{ "label": "自动重连", "value": "auto-reconnect" },
{ "label": "脚本", "value": "jsr223" }
],
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"x-mega-props": { "labelCol": 6 },
},
"configuration.maxTimes": {
"title": "最大重连次数",
"x-component": "input",
"visible": false,
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"x-mega-props": { "labelCol": 6 },
},
"configuration.delays": {
"title": "重连间隔",
"x-component": "input",
"visible": false,
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"x-mega-props": { "labelCol": 6 },
},
"configuration.lang": {
"title": "脚本语言",
"x-component": "select",
"visible": false,
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"enum": [
{ "label": "js", "value": "js" },
]
Expand All @@ -342,6 +360,30 @@ const Save: React.FC<Props> = props => {
"title": "脚本内容",
"x-component": "AceComponent",
"visible": false,
"default": `
//内置变量
//simulator , listener
//启动完成
simulator.doOnComplete(function () {
})
//连接前
listener.onBefore(function (session) {
});
//连接后
listener.onAfter(function (session) {
});`,
"x-rules": [
{
"required": true,
"message": "此字段必填"
}
],
"x-mega-props": { "labelCol": 2, "span": 2 }
}
}
Expand All @@ -357,6 +399,7 @@ const Save: React.FC<Props> = props => {
props.close();
})
}

return (
<Modal
title={`${props.data.id ? '编辑' : '新建'}模拟器`}
Expand Down

0 comments on commit cf0c45f

Please sign in to comment.