@electerm/electerm-react 1.100.56 → 1.101.10
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/check-skip-src.js +16 -0
- package/client/components/bookmark-form/{bookmark-select.jsx → common/bookmark-select.jsx} +11 -44
- package/client/components/bookmark-form/{bookmark-category-select.jsx → common/category-select.jsx} +10 -4
- package/client/components/bookmark-form/{color-picker-item.jsx → common/color-picker-item.jsx} +2 -3
- package/client/components/bookmark-form/{color-picker.jsx → common/color-picker.jsx} +10 -46
- package/client/components/bookmark-form/{render-connection-hopping.jsx → common/connection-hopping.jsx} +7 -7
- package/client/components/bookmark-form/common/fields.jsx +202 -0
- package/client/components/bookmark-form/common/hex-input.jsx +22 -0
- package/client/components/bookmark-form/common/init-values.js +83 -0
- package/client/components/bookmark-form/common/profile-item.jsx +34 -0
- package/client/components/bookmark-form/{proxy.jsx → common/proxy.jsx} +1 -1
- package/client/components/bookmark-form/{use-quick-commands.jsx → common/quick-commands.jsx} +1 -1
- package/client/components/bookmark-form/common/rdp-alert.jsx +13 -0
- package/client/components/bookmark-form/common/render-auth-ssh.jsx +119 -0
- package/client/components/bookmark-form/{render-delayed-scripts.jsx → common/run-scripts.jsx} +6 -2
- package/client/components/bookmark-form/common/serial-path-selector.jsx +39 -0
- package/client/components/bookmark-form/{render-auth-ssh.jsx → common/ssh-auth-selector.jsx} +3 -4
- package/client/components/bookmark-form/common/ssh-auth-type-selector.jsx +38 -0
- package/client/components/bookmark-form/common/ssh-host-selector.jsx +61 -0
- package/client/components/bookmark-form/{render-ssh-tunnel.jsx → common/ssh-tunnels.jsx} +4 -4
- package/client/components/bookmark-form/common/submit-buttons.jsx +42 -0
- package/client/components/bookmark-form/{render-bg.jsx → common/terminal-background.jsx} +2 -2
- package/client/components/bookmark-form/{x11.jsx → common/x11.jsx} +2 -2
- package/client/components/bookmark-form/config/common-fields.js +305 -0
- package/client/components/bookmark-form/config/ftp.js +40 -0
- package/client/components/bookmark-form/config/local.js +96 -0
- package/client/components/bookmark-form/config/rdp.js +39 -0
- package/client/components/bookmark-form/config/serial.js +69 -0
- package/client/components/bookmark-form/config/session-config.js +23 -0
- package/client/components/bookmark-form/config/ssh.js +47 -0
- package/client/components/bookmark-form/config/telnet.js +40 -0
- package/client/components/bookmark-form/config/vnc.js +44 -0
- package/client/components/bookmark-form/config/web.js +45 -0
- package/client/components/bookmark-form/form-renderer.jsx +328 -0
- package/client/components/bookmark-form/index.jsx +32 -91
- package/client/components/bookmark-form/render-form.jsx +11 -0
- package/client/components/common/password.jsx +21 -12
- package/client/components/footer/footer-entry.jsx +1 -1
- package/client/components/main/main.jsx +12 -2
- package/client/components/main/upgrade.jsx +3 -3
- package/client/components/profile/profile-form-ftp.jsx +35 -0
- package/client/components/profile/profile-form-ssh.jsx +3 -3
- package/client/components/profile/profile-form-telnet.jsx +1 -1
- package/client/components/profile/profile-tabs.jsx +4 -0
- package/client/components/setting-panel/setting-modal.jsx +1 -1
- package/client/components/setting-panel/setting-wrap.jsx +1 -1
- package/client/components/setting-panel/text-bg-modal.jsx +2 -2
- package/client/components/sidebar/info-modal.jsx +3 -3
- package/client/components/theme/theme-edit-slot.jsx +1 -1
- package/client/components/tree-list/category-color-picker.jsx +1 -1
- package/client/components/tree-list/move-item-modal.jsx +1 -1
- package/client/entry/basic.js +6 -1
- package/client/store/load-data.js +1 -1
- package/package.json +1 -1
- package/client/components/bookmark-form/form-ssh-common.jsx +0 -219
- package/client/components/bookmark-form/form-tabs.jsx +0 -66
- package/client/components/bookmark-form/ftp-form-ui.jsx +0 -160
- package/client/components/bookmark-form/ftp-form.jsx +0 -16
- package/client/components/bookmark-form/hex-input.jsx +0 -39
- package/client/components/bookmark-form/local-form-ui.jsx +0 -151
- package/client/components/bookmark-form/local-form.jsx +0 -16
- package/client/components/bookmark-form/profile-form-item.jsx +0 -43
- package/client/components/bookmark-form/quick-command-list.jsx +0 -31
- package/client/components/bookmark-form/quick-command.jsx +0 -227
- package/client/components/bookmark-form/rdp-form-ui.jsx +0 -179
- package/client/components/bookmark-form/rdp-form.jsx +0 -16
- package/client/components/bookmark-form/render-profile-item.jsx +0 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +0 -309
- package/client/components/bookmark-form/serial-form.jsx +0 -20
- package/client/components/bookmark-form/sftp-enable.jsx +0 -41
- package/client/components/bookmark-form/ssh-form-ui.jsx +0 -121
- package/client/components/bookmark-form/ssh-form.jsx +0 -292
- package/client/components/bookmark-form/telnet-form-ui.jsx +0 -140
- package/client/components/bookmark-form/telnet-form.jsx +0 -16
- package/client/components/bookmark-form/use-form-funcs.jsx +0 -50
- package/client/components/bookmark-form/use-submit.jsx +0 -67
- package/client/components/bookmark-form/use-ui.jsx +0 -97
- package/client/components/bookmark-form/vnc-form-ui.jsx +0 -213
- package/client/components/bookmark-form/vnc-form.jsx +0 -16
- package/client/components/bookmark-form/web-form-ui.jsx +0 -143
- package/client/components/bookmark-form/web-form.jsx +0 -16
- /package/client/components/bookmark-form/{bookmark-group-tree-format.js → common/bookmark-group-tree-format.js} +0 -0
- /package/client/components/bookmark-form/{color-picker.styl → common/color-picker.styl} +0 -0
- /package/client/components/bookmark-form/{encodes.js → common/encodes.js} +0 -0
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import { PureComponent } from 'react'
|
|
5
|
-
import {
|
|
6
|
-
message
|
|
7
|
-
} from 'antd'
|
|
8
|
-
import { uniq, pick } from 'lodash-es'
|
|
9
|
-
import copy from 'json-deep-copy'
|
|
10
|
-
import generate from '../../common/uid'
|
|
11
|
-
import {
|
|
12
|
-
settingMap,
|
|
13
|
-
defaultBookmarkGroupId,
|
|
14
|
-
newBookmarkIdPrefix
|
|
15
|
-
} from '../../common/constants'
|
|
16
|
-
import { isValidIP } from '../../common/is-ip'
|
|
17
|
-
import runIdle from '../../common/run-idle'
|
|
18
|
-
import getInitItem from '../../common/init-setting-item'
|
|
19
|
-
import testCon from '../../common/test-connection'
|
|
20
|
-
import FormUi from './ssh-form-ui'
|
|
21
|
-
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
22
|
-
import newTerm from '../../common/new-terminal'
|
|
23
|
-
import { action } from 'manate'
|
|
24
|
-
|
|
25
|
-
export default class BookmarkForm extends PureComponent {
|
|
26
|
-
state = {
|
|
27
|
-
testing: false,
|
|
28
|
-
ips: []
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
trim = (v) => {
|
|
32
|
-
return (v || '').replace(/^\s+|\s+$/g, '')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
useIp = (form, ip) => {
|
|
36
|
-
form.setFieldsValue({
|
|
37
|
-
host: ip
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onPaste = (e, form) => {
|
|
42
|
-
const txt = e.clipboardData.getData('Text')
|
|
43
|
-
// support name:passsword@host:23
|
|
44
|
-
const arr = txt.match(/([^:@]+)(:[^:@]+)?@([^:@]+)(:\d+)?/)
|
|
45
|
-
if (!arr) {
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
const username = arr[1]
|
|
49
|
-
const password = arr[2] ? arr[2].slice(1) : ''
|
|
50
|
-
const host = arr[3]
|
|
51
|
-
const port = arr[4] ? arr[4].slice(1) : ''
|
|
52
|
-
const obj = {
|
|
53
|
-
username,
|
|
54
|
-
host
|
|
55
|
-
}
|
|
56
|
-
if (password) {
|
|
57
|
-
obj.password = password
|
|
58
|
-
}
|
|
59
|
-
if (port) {
|
|
60
|
-
obj.port = port
|
|
61
|
-
}
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
form.setFieldsValue(obj)
|
|
64
|
-
}, 20)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
onBlur = async (e) => {
|
|
68
|
-
const value = e.target.value.trim()
|
|
69
|
-
const { type } = this.props
|
|
70
|
-
if (
|
|
71
|
-
type !== settingMap.bookmarks ||
|
|
72
|
-
!value ||
|
|
73
|
-
isValidIP(value)
|
|
74
|
-
) {
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
const ips = await window.pre.runGlobalAsync('lookup', value)
|
|
78
|
-
.catch(err => {
|
|
79
|
-
log.debug(err)
|
|
80
|
-
})
|
|
81
|
-
this.setState({
|
|
82
|
-
ips: ips || []
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
getBookmarkGroupId = () => {
|
|
87
|
-
const {
|
|
88
|
-
id
|
|
89
|
-
} = this.props.formData
|
|
90
|
-
const {
|
|
91
|
-
bookmarkGroups,
|
|
92
|
-
currentBookmarkGroupId
|
|
93
|
-
} = this.props
|
|
94
|
-
return id
|
|
95
|
-
? findBookmarkGroupId(bookmarkGroups, id)
|
|
96
|
-
: currentBookmarkGroupId
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
updateBookmarkGroups = action((bookmark, categoryId) => {
|
|
100
|
-
const {
|
|
101
|
-
bookmarkGroups
|
|
102
|
-
} = window.store
|
|
103
|
-
let index = bookmarkGroups.findIndex(
|
|
104
|
-
bg => bg.id === categoryId
|
|
105
|
-
)
|
|
106
|
-
if (index < 0) {
|
|
107
|
-
index = bookmarkGroups.findIndex(
|
|
108
|
-
bg => bg.id === defaultBookmarkGroupId
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
const bid = bookmark.id
|
|
112
|
-
const bg = bookmarkGroups[index]
|
|
113
|
-
if (!bg.bookmarkIds.includes(bid)) {
|
|
114
|
-
bg.bookmarkIds.unshift(bid)
|
|
115
|
-
}
|
|
116
|
-
bg.bookmarkIds = uniq(bg.bookmarkIds)
|
|
117
|
-
bookmarkGroups.forEach((bg, i) => {
|
|
118
|
-
if (i === index) {
|
|
119
|
-
return bg
|
|
120
|
-
}
|
|
121
|
-
bg.bookmarkIds = bg.bookmarkIds.filter(
|
|
122
|
-
g => g !== bid
|
|
123
|
-
)
|
|
124
|
-
return bg
|
|
125
|
-
})
|
|
126
|
-
message.success('OK', 3)
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
submit = (evt, item, type = this.props.type) => {
|
|
130
|
-
if (item.host) {
|
|
131
|
-
item.host = item.host.trim()
|
|
132
|
-
}
|
|
133
|
-
const obj = item
|
|
134
|
-
if (obj.connectionHoppings?.length) {
|
|
135
|
-
obj.hasHopping = true
|
|
136
|
-
}
|
|
137
|
-
const { addItem, editItem } = this.props.store
|
|
138
|
-
const categoryId = obj.category
|
|
139
|
-
delete obj.category
|
|
140
|
-
if (!obj.id.startsWith(newBookmarkIdPrefix)) {
|
|
141
|
-
const tar = copy(obj)
|
|
142
|
-
delete tar.id
|
|
143
|
-
runIdle(() => {
|
|
144
|
-
editItem(obj.id, tar, settingMap.bookmarks)
|
|
145
|
-
})
|
|
146
|
-
this.updateBookmarkGroups(
|
|
147
|
-
obj,
|
|
148
|
-
categoryId
|
|
149
|
-
)
|
|
150
|
-
if (evt === 'saveAndCreateNew') {
|
|
151
|
-
this.setNewItem()
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
obj.id = generate()
|
|
155
|
-
runIdle(() => {
|
|
156
|
-
addItem(obj, settingMap.bookmarks)
|
|
157
|
-
})
|
|
158
|
-
this.updateBookmarkGroups(
|
|
159
|
-
obj,
|
|
160
|
-
categoryId
|
|
161
|
-
)
|
|
162
|
-
this.setNewItem(evt === 'saveAndCreateNew'
|
|
163
|
-
? getInitItem([], settingMap.bookmarks)
|
|
164
|
-
: obj
|
|
165
|
-
)
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
setNewItem = (
|
|
170
|
-
settingItem = getInitItem([], settingMap.bookmarks)
|
|
171
|
-
) => {
|
|
172
|
-
const { store } = this.props
|
|
173
|
-
store.setSettingItem(settingItem)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
test = async (update) => {
|
|
177
|
-
let options = {
|
|
178
|
-
...this.props.formData,
|
|
179
|
-
...update
|
|
180
|
-
}
|
|
181
|
-
let msg = ''
|
|
182
|
-
this.setState({
|
|
183
|
-
testing: true
|
|
184
|
-
})
|
|
185
|
-
options = window.store.applyProfileToTabs(options)
|
|
186
|
-
const res = await testCon(options)
|
|
187
|
-
.then(r => r)
|
|
188
|
-
.catch((e) => {
|
|
189
|
-
msg = e.message
|
|
190
|
-
return false
|
|
191
|
-
})
|
|
192
|
-
this.setState({
|
|
193
|
-
testing: false
|
|
194
|
-
})
|
|
195
|
-
if (res) {
|
|
196
|
-
message.success('connection ok')
|
|
197
|
-
} else {
|
|
198
|
-
const err = 'connection fails' +
|
|
199
|
-
(msg ? `: ${msg}` : '')
|
|
200
|
-
message.error(err)
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// reset (form) {
|
|
205
|
-
// form.resetFields()
|
|
206
|
-
// }
|
|
207
|
-
|
|
208
|
-
onSelectProxy = (proxy, form) => {
|
|
209
|
-
const obj = Object.keys(proxy)
|
|
210
|
-
.reduce((prev, c) => {
|
|
211
|
-
return {
|
|
212
|
-
...prev,
|
|
213
|
-
[`proxy.${c}`]: proxy[c]
|
|
214
|
-
}
|
|
215
|
-
}, {})
|
|
216
|
-
form.setFieldsValue(obj)
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
handleFinish = (res) => {
|
|
220
|
-
this.handleSubmit('submit', res, false)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
saveAndCreateNew = (res) => {
|
|
224
|
-
this.handleSubmit('saveAndCreateNew', res, false)
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
save = (res) => {
|
|
228
|
-
this.handleSubmit('save', res, false)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
testConnection = (res) => {
|
|
232
|
-
this.handleSubmit('test', res, true)
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
connect = (res) => {
|
|
236
|
-
this.handleSubmit('connect', res, false)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
handleSubmit = async (evt, res, isTest = false) => {
|
|
240
|
-
if (res.enableSsh === false && res.enableSftp === false) {
|
|
241
|
-
return message.warning('SSH and SFTP all disabled')
|
|
242
|
-
}
|
|
243
|
-
const obj = {
|
|
244
|
-
...this.props.formData,
|
|
245
|
-
...res
|
|
246
|
-
}
|
|
247
|
-
if (isTest) {
|
|
248
|
-
return this.test(obj)
|
|
249
|
-
}
|
|
250
|
-
if (evt && evt !== 'connect') {
|
|
251
|
-
this.submit(evt, obj)
|
|
252
|
-
}
|
|
253
|
-
if (evt !== 'save' && evt !== 'saveAndCreateNew') {
|
|
254
|
-
window.store.currentLayoutBatch = window.openTabBatch || 0
|
|
255
|
-
this.props.store.addTab({
|
|
256
|
-
...copy(obj),
|
|
257
|
-
...newTerm(true, true),
|
|
258
|
-
batch: window.openTabBatch ?? window.store.currentLayoutBatch
|
|
259
|
-
})
|
|
260
|
-
delete window.openTabBatch
|
|
261
|
-
this.props.hide()
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
getProps = () => {
|
|
266
|
-
const funcs = pick(this, [
|
|
267
|
-
'handleFinish',
|
|
268
|
-
'testConnection',
|
|
269
|
-
'connect',
|
|
270
|
-
'save',
|
|
271
|
-
'saveAndCreateNew',
|
|
272
|
-
'onSelectProxy',
|
|
273
|
-
'onBlur',
|
|
274
|
-
'onPaste',
|
|
275
|
-
'useIp',
|
|
276
|
-
'trim'
|
|
277
|
-
])
|
|
278
|
-
return {
|
|
279
|
-
...this.state,
|
|
280
|
-
...funcs
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
render () {
|
|
285
|
-
return (
|
|
286
|
-
<FormUi
|
|
287
|
-
{...this.props}
|
|
288
|
-
{...this.getProps()}
|
|
289
|
-
/>
|
|
290
|
-
)
|
|
291
|
-
}
|
|
292
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Input,
|
|
7
|
-
Tabs,
|
|
8
|
-
Form
|
|
9
|
-
} from 'antd'
|
|
10
|
-
import { useState, useEffect } from 'react'
|
|
11
|
-
import {
|
|
12
|
-
newBookmarkIdPrefix,
|
|
13
|
-
terminalTelnetType,
|
|
14
|
-
authTypeMap
|
|
15
|
-
} from '../../common/constants'
|
|
16
|
-
import { formItemLayout } from '../../common/form-layout'
|
|
17
|
-
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
18
|
-
import defaultSettings from '../../common/default-setting'
|
|
19
|
-
import useSubmit from './use-submit'
|
|
20
|
-
import useUI from './use-ui'
|
|
21
|
-
import useQm from './use-quick-commands'
|
|
22
|
-
import renderCommon from './form-ssh-common'
|
|
23
|
-
import renderTermBg from './render-bg'
|
|
24
|
-
import { getColorFromCategory } from '../../common/get-category-color.js'
|
|
25
|
-
import copy from 'json-deep-copy'
|
|
26
|
-
import { defaultsDeep, isEmpty } from 'lodash-es'
|
|
27
|
-
import renderAuth from './render-auth-ssh'
|
|
28
|
-
import './bookmark-form.styl'
|
|
29
|
-
|
|
30
|
-
const FormItem = Form.Item
|
|
31
|
-
const e = window.translate
|
|
32
|
-
|
|
33
|
-
export default function TelnetFormUI (props) {
|
|
34
|
-
const [
|
|
35
|
-
form,
|
|
36
|
-
handleFinish,
|
|
37
|
-
submitUi
|
|
38
|
-
] = useSubmit(props)
|
|
39
|
-
const [authType, setAuthType] = useState(props.formData.authType || authTypeMap.password)
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if ((props.formData.id || '').startsWith(newBookmarkIdPrefix)) {
|
|
42
|
-
form.setFieldsValue({
|
|
43
|
-
category: props.currentBookmarkGroupId
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
}, [props.currentBookmarkGroupId])
|
|
47
|
-
const qms = useQm(form, props.formData)
|
|
48
|
-
const uis = useUI(props)
|
|
49
|
-
const {
|
|
50
|
-
id = ''
|
|
51
|
-
} = props.formData
|
|
52
|
-
const {
|
|
53
|
-
bookmarkGroups = [],
|
|
54
|
-
currentBookmarkGroupId
|
|
55
|
-
} = props
|
|
56
|
-
const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
|
|
57
|
-
? findBookmarkGroupId(bookmarkGroups, id)
|
|
58
|
-
: currentBookmarkGroupId
|
|
59
|
-
let initialValues = copy(props.formData)
|
|
60
|
-
function onChangeAuthType (e) {
|
|
61
|
-
setAuthType(e.target.value)
|
|
62
|
-
}
|
|
63
|
-
const defaultValues = {
|
|
64
|
-
port: 23,
|
|
65
|
-
id: '',
|
|
66
|
-
username: 'root',
|
|
67
|
-
password: 'guest',
|
|
68
|
-
color: getColorFromCategory(bookmarkGroups, currentBookmarkGroupId),
|
|
69
|
-
runScripts: [{}],
|
|
70
|
-
term: defaultSettings.terminalType,
|
|
71
|
-
displayRaw: false,
|
|
72
|
-
type: terminalTelnetType,
|
|
73
|
-
category: initBookmarkGroupId,
|
|
74
|
-
authType: authTypeMap.password
|
|
75
|
-
}
|
|
76
|
-
initialValues = defaultsDeep(initialValues, defaultValues)
|
|
77
|
-
|
|
78
|
-
const tprops = {
|
|
79
|
-
...props,
|
|
80
|
-
renderAuth,
|
|
81
|
-
authType,
|
|
82
|
-
onChangeAuthType,
|
|
83
|
-
form,
|
|
84
|
-
bookmarkType: terminalTelnetType,
|
|
85
|
-
filterAuthType: a => a !== 'privateKey',
|
|
86
|
-
profileFilter: d => !isEmpty(d.telnet)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function renderTabs () {
|
|
90
|
-
const items = [
|
|
91
|
-
{
|
|
92
|
-
key: 'auth',
|
|
93
|
-
label: e('auth'),
|
|
94
|
-
forceRender: true,
|
|
95
|
-
children: (
|
|
96
|
-
<div>
|
|
97
|
-
{renderCommon(tprops)}
|
|
98
|
-
<FormItem {...formItemLayout} label={e('type')} name='type' className='hide'>
|
|
99
|
-
<Input />
|
|
100
|
-
</FormItem>
|
|
101
|
-
</div>
|
|
102
|
-
)
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
key: 'settings',
|
|
106
|
-
label: e('settings'),
|
|
107
|
-
forceRender: true,
|
|
108
|
-
children: (
|
|
109
|
-
<>
|
|
110
|
-
{uis}
|
|
111
|
-
{renderTermBg(form)}
|
|
112
|
-
</>
|
|
113
|
-
)
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
key: 'quickCommands',
|
|
117
|
-
label: e('quickCommands'),
|
|
118
|
-
forceRender: true,
|
|
119
|
-
children: qms
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
return (
|
|
123
|
-
<Tabs
|
|
124
|
-
items={items}
|
|
125
|
-
/>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return (
|
|
130
|
-
<Form
|
|
131
|
-
form={form}
|
|
132
|
-
name='ssh-form'
|
|
133
|
-
onFinish={handleFinish}
|
|
134
|
-
initialValues={initialValues}
|
|
135
|
-
>
|
|
136
|
-
{renderTabs()}
|
|
137
|
-
{submitUi}
|
|
138
|
-
</Form>
|
|
139
|
-
)
|
|
140
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import BookmarkForm from './ssh-form'
|
|
5
|
-
import TelnetFormUi from './telnet-form-ui'
|
|
6
|
-
|
|
7
|
-
export default class TelnetForm extends BookmarkForm {
|
|
8
|
-
render () {
|
|
9
|
-
return (
|
|
10
|
-
<TelnetFormUi
|
|
11
|
-
{...this.props}
|
|
12
|
-
{...this.getProps()}
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import { useRef } from 'react'
|
|
5
|
-
import {
|
|
6
|
-
Form
|
|
7
|
-
} from 'antd'
|
|
8
|
-
|
|
9
|
-
export default function useFormFuncs (props) {
|
|
10
|
-
const [form] = Form.useForm()
|
|
11
|
-
const action = useRef('submit')
|
|
12
|
-
function save () {
|
|
13
|
-
action.current = 'save'
|
|
14
|
-
form.submit()
|
|
15
|
-
}
|
|
16
|
-
function saveAndCreateNew () {
|
|
17
|
-
action.current = 'saveAndCreateNew'
|
|
18
|
-
form.submit()
|
|
19
|
-
}
|
|
20
|
-
function testConnection () {
|
|
21
|
-
action.current = 'testConnection'
|
|
22
|
-
form.submit()
|
|
23
|
-
}
|
|
24
|
-
function connect () {
|
|
25
|
-
action.current = 'connect'
|
|
26
|
-
form.submit()
|
|
27
|
-
}
|
|
28
|
-
function handleFinish (res) {
|
|
29
|
-
if (action.current === 'save') {
|
|
30
|
-
props.save(res)
|
|
31
|
-
} else if (action.current === 'saveAndCreateNew') {
|
|
32
|
-
props.saveAndCreateNew(res)
|
|
33
|
-
} else if (action.current === 'connect') {
|
|
34
|
-
props.connect(res)
|
|
35
|
-
} else if (action.current === 'testConnection') {
|
|
36
|
-
props.testConnection(res)
|
|
37
|
-
} else {
|
|
38
|
-
props.handleFinish(res)
|
|
39
|
-
}
|
|
40
|
-
action.current = 'submit'
|
|
41
|
-
}
|
|
42
|
-
return [
|
|
43
|
-
form,
|
|
44
|
-
save,
|
|
45
|
-
saveAndCreateNew,
|
|
46
|
-
connect,
|
|
47
|
-
testConnection,
|
|
48
|
-
handleFinish
|
|
49
|
-
]
|
|
50
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* submit buttons
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* bookmark form
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
Button,
|
|
11
|
-
Form
|
|
12
|
-
} from 'antd'
|
|
13
|
-
import { tailFormItemLayout } from '../../common/form-layout'
|
|
14
|
-
import useFuncs from './use-form-funcs'
|
|
15
|
-
|
|
16
|
-
const FormItem = Form.Item
|
|
17
|
-
const e = window.translate
|
|
18
|
-
|
|
19
|
-
export default function useBookmarkSubmit (props) {
|
|
20
|
-
const [
|
|
21
|
-
form,
|
|
22
|
-
save,
|
|
23
|
-
saveAndCreateNew,
|
|
24
|
-
connect,
|
|
25
|
-
testConnection,
|
|
26
|
-
handleFinish
|
|
27
|
-
] = useFuncs(props)
|
|
28
|
-
const ui = (
|
|
29
|
-
<FormItem {...tailFormItemLayout}>
|
|
30
|
-
<p>
|
|
31
|
-
<Button
|
|
32
|
-
type='primary'
|
|
33
|
-
htmlType='submit'
|
|
34
|
-
className='mg1r mg1b'
|
|
35
|
-
>{e('saveAndConnect')}
|
|
36
|
-
</Button>
|
|
37
|
-
<Button
|
|
38
|
-
type='primary'
|
|
39
|
-
className='mg1r mg1b'
|
|
40
|
-
onClick={saveAndCreateNew}
|
|
41
|
-
>{e('saveAndCreateNew')}
|
|
42
|
-
</Button>
|
|
43
|
-
<Button
|
|
44
|
-
type='dashed'
|
|
45
|
-
className='mg1r mg1b'
|
|
46
|
-
onClick={save}
|
|
47
|
-
>{e('save')}
|
|
48
|
-
</Button>
|
|
49
|
-
</p>
|
|
50
|
-
<p>
|
|
51
|
-
<Button
|
|
52
|
-
type='dashed'
|
|
53
|
-
onClick={connect}
|
|
54
|
-
className='mg1r mg1b'
|
|
55
|
-
>{e('connect')}
|
|
56
|
-
</Button>
|
|
57
|
-
<Button
|
|
58
|
-
type='dashed'
|
|
59
|
-
onClick={testConnection}
|
|
60
|
-
className='mg1r mg1b'
|
|
61
|
-
>{e('testConnection')}
|
|
62
|
-
</Button>
|
|
63
|
-
</p>
|
|
64
|
-
</FormItem>
|
|
65
|
-
)
|
|
66
|
-
return [form, handleFinish, ui]
|
|
67
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ui forms render
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* bookmark form
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
Input,
|
|
11
|
-
InputNumber,
|
|
12
|
-
AutoComplete,
|
|
13
|
-
Form,
|
|
14
|
-
Switch
|
|
15
|
-
} from 'antd'
|
|
16
|
-
import { formItemLayout } from '../../common/form-layout'
|
|
17
|
-
import defaultSettings from '../../common/default-setting'
|
|
18
|
-
import mapper from '../../common/auto-complete-data-mapper'
|
|
19
|
-
import { defaultEnvLang, terminalTypes } from '../../common/constants'
|
|
20
|
-
|
|
21
|
-
const FormItem = Form.Item
|
|
22
|
-
const e = window.translate
|
|
23
|
-
|
|
24
|
-
export default function useBookmarkFormUI (props) {
|
|
25
|
-
const {
|
|
26
|
-
fontFamily: defaultFontFamily,
|
|
27
|
-
fontSize: defaultFontSize
|
|
28
|
-
} = defaultSettings
|
|
29
|
-
return (
|
|
30
|
-
<>
|
|
31
|
-
<FormItem
|
|
32
|
-
{...formItemLayout}
|
|
33
|
-
label='ENV:LANG'
|
|
34
|
-
rules={[{
|
|
35
|
-
max: 130, message: '130 chars max'
|
|
36
|
-
}]}
|
|
37
|
-
name='envLang'
|
|
38
|
-
>
|
|
39
|
-
<Input placeholder={defaultEnvLang} />
|
|
40
|
-
</FormItem>,
|
|
41
|
-
<FormItem
|
|
42
|
-
{...formItemLayout}
|
|
43
|
-
label={e('terminalType')}
|
|
44
|
-
rules={[{
|
|
45
|
-
required: true, message: 'terminal type required'
|
|
46
|
-
}]}
|
|
47
|
-
normalize={props.trim}
|
|
48
|
-
name='term'
|
|
49
|
-
>
|
|
50
|
-
<AutoComplete
|
|
51
|
-
options={terminalTypes.map(mapper)}
|
|
52
|
-
/>
|
|
53
|
-
</FormItem>,
|
|
54
|
-
<FormItem
|
|
55
|
-
{...formItemLayout}
|
|
56
|
-
label={e('displayRaw')}
|
|
57
|
-
name='displayRaw'
|
|
58
|
-
valuePropName='checked'
|
|
59
|
-
>
|
|
60
|
-
<Switch />
|
|
61
|
-
</FormItem>,
|
|
62
|
-
<FormItem
|
|
63
|
-
{...formItemLayout}
|
|
64
|
-
label={e('fontFamily')}
|
|
65
|
-
name='fontFamily'
|
|
66
|
-
rules={[{
|
|
67
|
-
max: 130, message: '130 chars max'
|
|
68
|
-
}]}
|
|
69
|
-
>
|
|
70
|
-
<Input placeholder={defaultFontFamily + ''} />
|
|
71
|
-
</FormItem>,
|
|
72
|
-
<FormItem
|
|
73
|
-
{...formItemLayout}
|
|
74
|
-
label={e('fontSize')}
|
|
75
|
-
name='fontSize'
|
|
76
|
-
>
|
|
77
|
-
<InputNumber
|
|
78
|
-
min={9}
|
|
79
|
-
max={65535}
|
|
80
|
-
step={1}
|
|
81
|
-
placeholder={defaultFontSize}
|
|
82
|
-
/>
|
|
83
|
-
</FormItem>,
|
|
84
|
-
<FormItem
|
|
85
|
-
{...formItemLayout}
|
|
86
|
-
label={e('keepaliveIntervalDesc')}
|
|
87
|
-
name='keepaliveInterval'
|
|
88
|
-
>
|
|
89
|
-
<InputNumber
|
|
90
|
-
min={0}
|
|
91
|
-
max={20000000}
|
|
92
|
-
step={1000}
|
|
93
|
-
/>
|
|
94
|
-
</FormItem>
|
|
95
|
-
</>
|
|
96
|
-
)
|
|
97
|
-
}
|