@electerm/electerm-react 3.9.15 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/common/bookmark-schemas.js +164 -0
- package/client/common/default-setting.js +3 -2
- package/client/common/ws.js +25 -6
- package/client/common/zod.js +180 -0
- package/client/components/ai/agent-tool-call-card.jsx +90 -0
- package/client/components/ai/agent-tools.js +193 -0
- package/client/components/ai/agent.js +159 -0
- package/client/components/ai/ai-chat-entry.jsx +11 -0
- package/client/components/ai/ai-chat-history-item.jsx +48 -2
- package/client/components/ai/ai-chat.jsx +25 -6
- package/client/components/ai/ai-config.jsx +54 -5
- package/client/components/ai/ai.styl +73 -0
- package/client/components/batch-op/batch-op-runner.jsx +1 -2
- package/client/components/bookmark-form/common/bookmark-group-tree-format.js +1 -1
- package/client/components/bookmark-form/common/bookmark-select.jsx +1 -1
- package/client/components/bookmark-form/tree-select.jsx +1 -1
- package/client/components/main/main.jsx +3 -3
- package/client/components/rdp/file-transfer.js +3 -0
- package/client/components/setting-panel/setting-terminal.jsx +12 -0
- package/client/components/setting-panel/start-session-select.jsx +1 -1
- package/client/components/terminal/drop-file-modal.jsx +3 -3
- package/client/components/terminal/terminal-apis.js +8 -0
- package/client/components/terminal/terminal-error-handle.jsx +1 -1
- package/client/components/terminal/terminal-interactive-ui.jsx +157 -0
- package/client/components/terminal/terminal-interactive.jsx +65 -125
- package/client/components/terminal/terminal.jsx +28 -14
- package/client/components/terminal-info/base.jsx +25 -14
- package/client/components/terminal-info/log-path-edit.jsx +86 -0
- package/client/components/terminal-info/terminal-info-entry.jsx +11 -0
- package/client/components/text-editor/text-editor-entry.jsx +11 -0
- package/client/components/widgets/widget-form.jsx +30 -2
- package/client/entry/worker.js +9 -5
- package/package.json +1 -1
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Widget form component
|
|
3
3
|
*/
|
|
4
4
|
import React, { useState, useEffect } from 'react'
|
|
5
|
-
import { Form, Input, InputNumber, Switch, Select, Button, Tooltip, Alert } from 'antd'
|
|
5
|
+
import { Form, Input, InputNumber, Switch, Select, Button, Tooltip, Alert, Space } from 'antd'
|
|
6
6
|
import { formItemLayout, tailFormItemLayout } from '../../common/form-layout'
|
|
7
7
|
import HelpIcon from '../common/help-icon'
|
|
8
|
+
import { nanoid } from 'nanoid'
|
|
8
9
|
import BatchOpEditor from '../batch-op/batch-op-editor'
|
|
9
10
|
|
|
10
11
|
export default function WidgetForm ({ widget, onSubmit, loading, hasRunningInstance }) {
|
|
@@ -43,12 +44,39 @@ export default function WidgetForm ({ widget, onSubmit, loading, hasRunningInsta
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const renderFormItem = (config) => {
|
|
46
|
-
const { name, type, description, choices } = config
|
|
47
|
+
const { name, type, description, choices, showGenerator } = config
|
|
47
48
|
let control = null
|
|
48
49
|
|
|
49
50
|
switch (type) {
|
|
50
51
|
case 'string':
|
|
51
52
|
control = <Input placeholder={description} />
|
|
53
|
+
if (showGenerator) {
|
|
54
|
+
return (
|
|
55
|
+
<Form.Item
|
|
56
|
+
key={name}
|
|
57
|
+
{...formItemLayout}
|
|
58
|
+
label={name}
|
|
59
|
+
tooltip={description}
|
|
60
|
+
>
|
|
61
|
+
<Space.Compact style={{ width: '100%' }}>
|
|
62
|
+
<Form.Item
|
|
63
|
+
noStyle
|
|
64
|
+
name={name}
|
|
65
|
+
>
|
|
66
|
+
<Input placeholder={description} />
|
|
67
|
+
</Form.Item>
|
|
68
|
+
<Button
|
|
69
|
+
onClick={() => form.setFieldValue(name, 'ett_' + nanoid())}
|
|
70
|
+
>
|
|
71
|
+
Generate
|
|
72
|
+
</Button>
|
|
73
|
+
</Space.Compact>
|
|
74
|
+
</Form.Item>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
break
|
|
78
|
+
case 'textarea':
|
|
79
|
+
control = <Input.TextArea autoSize={{ minRows: 3 }} placeholder={description} />
|
|
52
80
|
break
|
|
53
81
|
case 'number':
|
|
54
82
|
control = <InputNumber style={{ width: '100%' }} placeholder={description} />
|
package/client/entry/worker.js
CHANGED
|
@@ -114,7 +114,10 @@ async function onMsg (e) {
|
|
|
114
114
|
} else if (action === 'addEventListener') {
|
|
115
115
|
const ws = self.insts[wsId]
|
|
116
116
|
if (ws) {
|
|
117
|
-
ws.
|
|
117
|
+
if (!ws.cbs) {
|
|
118
|
+
ws.cbs = {}
|
|
119
|
+
}
|
|
120
|
+
const cb = (e) => {
|
|
118
121
|
send({
|
|
119
122
|
wsId,
|
|
120
123
|
id,
|
|
@@ -123,13 +126,14 @@ async function onMsg (e) {
|
|
|
123
126
|
}
|
|
124
127
|
})
|
|
125
128
|
}
|
|
126
|
-
ws.
|
|
129
|
+
ws.cbs[id] = cb
|
|
130
|
+
ws.addEventListener(type, cb)
|
|
127
131
|
}
|
|
128
132
|
} else if (action === 'removeEventListener') {
|
|
129
133
|
const ws = self.insts[wsId]
|
|
130
|
-
if (ws) {
|
|
131
|
-
ws.removeEventListener(type, ws.
|
|
132
|
-
delete ws.
|
|
134
|
+
if (ws && ws.cbs && ws.cbs[id]) {
|
|
135
|
+
ws.removeEventListener(type, ws.cbs[id])
|
|
136
|
+
delete ws.cbs[id]
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
139
|
}
|