@electerm/electerm-react 1.100.60 → 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/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/footer/footer-entry.jsx +1 -1
- package/client/components/main/main.jsx +12 -2
- 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/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/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,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { useEffect } from 'react'
|
|
6
|
-
import {
|
|
7
|
-
Tabs,
|
|
8
|
-
Input,
|
|
9
|
-
Form
|
|
10
|
-
} from 'antd'
|
|
11
|
-
import { formItemLayout } from '../../common/form-layout'
|
|
12
|
-
import {
|
|
13
|
-
newBookmarkIdPrefix,
|
|
14
|
-
terminalLocalType
|
|
15
|
-
} from '../../common/constants'
|
|
16
|
-
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
17
|
-
import useSubmit from './use-submit'
|
|
18
|
-
import useUI from './use-ui'
|
|
19
|
-
import useQm from './use-quick-commands'
|
|
20
|
-
import copy from 'json-deep-copy'
|
|
21
|
-
import renderTermBg from './render-bg'
|
|
22
|
-
import { defaults } from 'lodash-es'
|
|
23
|
-
import renderRunScripts from './render-delayed-scripts.jsx'
|
|
24
|
-
import { ColorPickerItem } from './color-picker-item.jsx'
|
|
25
|
-
import { getColorFromCategory } from '../../common/get-category-color.js'
|
|
26
|
-
import BookmarkCategorySelect from './bookmark-category-select.jsx'
|
|
27
|
-
|
|
28
|
-
const FormItem = Form.Item
|
|
29
|
-
const e = window.translate
|
|
30
|
-
|
|
31
|
-
export default function LocalFormUi (props) {
|
|
32
|
-
const [
|
|
33
|
-
form,
|
|
34
|
-
handleFinish,
|
|
35
|
-
submitUi
|
|
36
|
-
] = useSubmit(props)
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (props.formData.id.startsWith(newBookmarkIdPrefix)) {
|
|
39
|
-
form.setFieldsValue({
|
|
40
|
-
category: props.currentBookmarkGroupId
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
}, [props.currentBookmarkGroupId])
|
|
44
|
-
const qms = useQm(form, props.formData)
|
|
45
|
-
const uis = useUI(props)
|
|
46
|
-
const {
|
|
47
|
-
id = ''
|
|
48
|
-
} = props.formData
|
|
49
|
-
const {
|
|
50
|
-
bookmarkGroups = [],
|
|
51
|
-
currentBookmarkGroupId
|
|
52
|
-
} = props
|
|
53
|
-
const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
|
|
54
|
-
? findBookmarkGroupId(bookmarkGroups, id)
|
|
55
|
-
: currentBookmarkGroupId
|
|
56
|
-
let initialValues = copy(props.formData)
|
|
57
|
-
const defaultValues = {
|
|
58
|
-
category: initBookmarkGroupId,
|
|
59
|
-
term: props.store.config.terminalType,
|
|
60
|
-
displayRaw: false,
|
|
61
|
-
type: terminalLocalType,
|
|
62
|
-
color: getColorFromCategory(bookmarkGroups, currentBookmarkGroupId),
|
|
63
|
-
runScripts: [{}],
|
|
64
|
-
enableSsh: true
|
|
65
|
-
}
|
|
66
|
-
initialValues = defaults(initialValues, defaultValues)
|
|
67
|
-
function renderCommon () {
|
|
68
|
-
const {
|
|
69
|
-
bookmarkGroups = []
|
|
70
|
-
} = props
|
|
71
|
-
return (
|
|
72
|
-
<div className='pd1x'>
|
|
73
|
-
{renderRunScripts()}
|
|
74
|
-
<FormItem
|
|
75
|
-
{...formItemLayout}
|
|
76
|
-
label={e('title')}
|
|
77
|
-
hasFeedback
|
|
78
|
-
>
|
|
79
|
-
<FormItem noStyle name='title'>
|
|
80
|
-
<Input addonBefore={<ColorPickerItem />} />
|
|
81
|
-
</FormItem>
|
|
82
|
-
</FormItem>
|
|
83
|
-
<FormItem
|
|
84
|
-
{...formItemLayout}
|
|
85
|
-
label={e('description')}
|
|
86
|
-
name='description'
|
|
87
|
-
hasFeedback
|
|
88
|
-
>
|
|
89
|
-
<Input.TextArea autoSize={{ minRows: 1 }} />
|
|
90
|
-
</FormItem>
|
|
91
|
-
<BookmarkCategorySelect
|
|
92
|
-
bookmarkGroups={bookmarkGroups}
|
|
93
|
-
form={form}
|
|
94
|
-
/>
|
|
95
|
-
<FormItem
|
|
96
|
-
{...formItemLayout}
|
|
97
|
-
label='type'
|
|
98
|
-
name='type'
|
|
99
|
-
className='hide'
|
|
100
|
-
>
|
|
101
|
-
<Input />
|
|
102
|
-
</FormItem>
|
|
103
|
-
</div>
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function renderTabs () {
|
|
108
|
-
const items = [
|
|
109
|
-
{
|
|
110
|
-
key: 'auth',
|
|
111
|
-
label: e('auth'),
|
|
112
|
-
forceRender: true,
|
|
113
|
-
children: renderCommon()
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
key: 'settings',
|
|
117
|
-
label: e('settings'),
|
|
118
|
-
forceRender: true,
|
|
119
|
-
children: (
|
|
120
|
-
<>
|
|
121
|
-
{uis}
|
|
122
|
-
{renderTermBg(form)}
|
|
123
|
-
</>
|
|
124
|
-
)
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
key: 'quickCommands',
|
|
128
|
-
forceRender: true,
|
|
129
|
-
label: e('quickCommands'),
|
|
130
|
-
children: qms
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
return (
|
|
134
|
-
<Tabs
|
|
135
|
-
items={items}
|
|
136
|
-
/>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<Form
|
|
142
|
-
form={form}
|
|
143
|
-
onFinish={handleFinish}
|
|
144
|
-
initialValues={initialValues}
|
|
145
|
-
name='local-form'
|
|
146
|
-
>
|
|
147
|
-
{renderTabs({ form })}
|
|
148
|
-
{submitUi}
|
|
149
|
-
</Form>
|
|
150
|
-
)
|
|
151
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import BookmarkForm from './ssh-form'
|
|
5
|
-
import LocalFormUi from './local-form-ui'
|
|
6
|
-
|
|
7
|
-
export default class LocalForm extends BookmarkForm {
|
|
8
|
-
render () {
|
|
9
|
-
return (
|
|
10
|
-
<LocalFormUi
|
|
11
|
-
{...this.props}
|
|
12
|
-
{...this.getProps()}
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
Form,
|
|
6
|
-
Select
|
|
7
|
-
} from 'antd'
|
|
8
|
-
import { formItemLayout } from '../../common/form-layout'
|
|
9
|
-
import './bookmark-form.styl'
|
|
10
|
-
|
|
11
|
-
const FormItem = Form.Item
|
|
12
|
-
const e = window.translate
|
|
13
|
-
|
|
14
|
-
export default function ProfileItem (props) {
|
|
15
|
-
const {
|
|
16
|
-
store,
|
|
17
|
-
profileFilter = (d) => d
|
|
18
|
-
} = props
|
|
19
|
-
const opts = {
|
|
20
|
-
options: store.profiles
|
|
21
|
-
.filter(profileFilter)
|
|
22
|
-
.map(d => {
|
|
23
|
-
return {
|
|
24
|
-
label: d.name,
|
|
25
|
-
value: d.id
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
placeholder: e('profiles'),
|
|
29
|
-
allowClear: true
|
|
30
|
-
}
|
|
31
|
-
return (
|
|
32
|
-
<FormItem
|
|
33
|
-
{...formItemLayout}
|
|
34
|
-
label={e('profiles')}
|
|
35
|
-
name='profile'
|
|
36
|
-
hasFeedback
|
|
37
|
-
>
|
|
38
|
-
<Select
|
|
39
|
-
{...opts}
|
|
40
|
-
/>
|
|
41
|
-
</FormItem>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quick command list
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { memo } from 'react'
|
|
6
|
-
import QmItem from './quick-command'
|
|
7
|
-
|
|
8
|
-
export default memo(function QMList (props) {
|
|
9
|
-
const { quickCommands, form } = this.props
|
|
10
|
-
return (
|
|
11
|
-
<div className='pd3b mg3b'>
|
|
12
|
-
<QmItem
|
|
13
|
-
form={form}
|
|
14
|
-
item={{}}
|
|
15
|
-
/>
|
|
16
|
-
{
|
|
17
|
-
quickCommands.map((item, i) => {
|
|
18
|
-
const k = 'qmitem' + i
|
|
19
|
-
return (
|
|
20
|
-
<QmItem
|
|
21
|
-
form={this.props.form}
|
|
22
|
-
item={item}
|
|
23
|
-
key={k}
|
|
24
|
-
i={i}
|
|
25
|
-
/>
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
})
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quick command list
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { PureComponent } from 'react'
|
|
6
|
-
import { CheckOutlined, CloseCircleOutlined, CloseOutlined, EditOutlined } from '@ant-design/icons'
|
|
7
|
-
import {
|
|
8
|
-
Input,
|
|
9
|
-
Col,
|
|
10
|
-
Row,
|
|
11
|
-
message,
|
|
12
|
-
Switch,
|
|
13
|
-
Tooltip,
|
|
14
|
-
Space
|
|
15
|
-
} from 'antd'
|
|
16
|
-
import { settingMap } from '../../common/constants'
|
|
17
|
-
import generate from '../../common/uid'
|
|
18
|
-
import eq from 'fast-deep-equal'
|
|
19
|
-
|
|
20
|
-
const InputGroup = Space.Compact
|
|
21
|
-
const e = window.translate
|
|
22
|
-
|
|
23
|
-
export default class QuickCommandItem extends PureComponent {
|
|
24
|
-
constructor (props) {
|
|
25
|
-
super(props)
|
|
26
|
-
this.state = {
|
|
27
|
-
edit: !props.item.id,
|
|
28
|
-
item: props.item || {}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
componentDidUpdate (prevProps) {
|
|
33
|
-
if (!eq(this.props.item, prevProps.item)) {
|
|
34
|
-
this.setState({
|
|
35
|
-
item: this.props.item
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
handleSubmit = () => {
|
|
41
|
-
const {
|
|
42
|
-
name, command, id, inputOnly
|
|
43
|
-
} = this.state.item
|
|
44
|
-
if (!name) {
|
|
45
|
-
return message.warning('name required')
|
|
46
|
-
} else if (!command) {
|
|
47
|
-
return message.warning('command required')
|
|
48
|
-
}
|
|
49
|
-
const quickCommands = this.props.form.getFieldValue(settingMap.quickCommands) || []
|
|
50
|
-
if (id) {
|
|
51
|
-
const qm = quickCommands.find(d => d.id === id)
|
|
52
|
-
if (qm) {
|
|
53
|
-
Object.assign(qm, {
|
|
54
|
-
name, command, inputOnly
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
this.setState({
|
|
58
|
-
edit: false
|
|
59
|
-
})
|
|
60
|
-
} else {
|
|
61
|
-
quickCommands.unshift({
|
|
62
|
-
name,
|
|
63
|
-
command,
|
|
64
|
-
inputOnly,
|
|
65
|
-
id: generate()
|
|
66
|
-
})
|
|
67
|
-
this.setState({
|
|
68
|
-
item: {}
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
this.props.form.setFieldsValue({
|
|
72
|
-
quickCommands
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
handleDel = () => {
|
|
77
|
-
let quickCommands = this.props.form.getFieldValue(settingMap.quickCommands) || []
|
|
78
|
-
quickCommands = quickCommands.filter(d => {
|
|
79
|
-
return d.id !== this.state.item.id
|
|
80
|
-
})
|
|
81
|
-
this.props.form.setFieldsValue({
|
|
82
|
-
quickCommands
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
handleEdit = () => {
|
|
87
|
-
this.setState({
|
|
88
|
-
edit: true
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
handleCancel = () => {
|
|
93
|
-
this.setState({
|
|
94
|
-
item: this.props.item,
|
|
95
|
-
edit: false
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
renderNew = (item) => {
|
|
100
|
-
return <CheckOutlined className='pointer mg1l' onClick={this.handleSubmit} />
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
renderIcons = (item) => {
|
|
104
|
-
if (!item.id) {
|
|
105
|
-
return this.renderNew(item)
|
|
106
|
-
}
|
|
107
|
-
return (
|
|
108
|
-
<span>
|
|
109
|
-
<CheckOutlined className='pointer mg1x' onClick={this.handleSubmit} />
|
|
110
|
-
<CloseOutlined className='pointer' onClick={this.handleCancel} />
|
|
111
|
-
</span>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
handleChangeName = e => {
|
|
116
|
-
const v = e.target.value
|
|
117
|
-
this.setState({
|
|
118
|
-
item: {
|
|
119
|
-
...this.state.item,
|
|
120
|
-
name: v
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
handleChangeCommand = e => {
|
|
126
|
-
const v = e.target.value
|
|
127
|
-
this.setState(old => {
|
|
128
|
-
return {
|
|
129
|
-
item: {
|
|
130
|
-
...old.item,
|
|
131
|
-
command: v
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
handleChangeInputOnly = v => {
|
|
138
|
-
this.setState(old => {
|
|
139
|
-
return {
|
|
140
|
-
item: {
|
|
141
|
-
...old.item,
|
|
142
|
-
inputOnly: v
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
renderForm = (item = this.state.item) => {
|
|
149
|
-
return (
|
|
150
|
-
<Row className='mg1t'>
|
|
151
|
-
<Col span={15}>
|
|
152
|
-
<InputGroup>
|
|
153
|
-
<Input
|
|
154
|
-
value={item.name}
|
|
155
|
-
onChange={this.handleChangeName}
|
|
156
|
-
className='width-40'
|
|
157
|
-
title={item.name}
|
|
158
|
-
placeholder={e('quickCommandName')}
|
|
159
|
-
/>
|
|
160
|
-
<Input
|
|
161
|
-
value={item.command}
|
|
162
|
-
onChange={this.handleChangeCommand}
|
|
163
|
-
className='width-60'
|
|
164
|
-
placeholder={e('quickCommand')}
|
|
165
|
-
title={item.command}
|
|
166
|
-
/>
|
|
167
|
-
</InputGroup>
|
|
168
|
-
</Col>
|
|
169
|
-
<Col span={3}>
|
|
170
|
-
<Tooltip title={e('inputOnly')}>
|
|
171
|
-
<Switch
|
|
172
|
-
checked={!!item.inputOnly}
|
|
173
|
-
onChange={this.handleChangeInputOnly}
|
|
174
|
-
/>
|
|
175
|
-
</Tooltip>
|
|
176
|
-
</Col>
|
|
177
|
-
<Col span={6}>
|
|
178
|
-
{this.renderIcons(item)}
|
|
179
|
-
</Col>
|
|
180
|
-
</Row>
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
renderItem = (item = this.state.item) => {
|
|
185
|
-
return (
|
|
186
|
-
<Row className='mg1t'>
|
|
187
|
-
<Col span={15}>
|
|
188
|
-
<InputGroup>
|
|
189
|
-
<Input
|
|
190
|
-
value={item.name}
|
|
191
|
-
readOnly
|
|
192
|
-
className='width-40'
|
|
193
|
-
title={item.name}
|
|
194
|
-
placeholder={e('quickCommandName')}
|
|
195
|
-
/>
|
|
196
|
-
<Input
|
|
197
|
-
value={item.command}
|
|
198
|
-
readOnly
|
|
199
|
-
className='width-60'
|
|
200
|
-
title={item.command}
|
|
201
|
-
/>
|
|
202
|
-
</InputGroup>
|
|
203
|
-
</Col>
|
|
204
|
-
<Col span={3}>
|
|
205
|
-
<Tooltip title={e('inputOnly')}>
|
|
206
|
-
<Switch
|
|
207
|
-
checked={!!item.inputOnly}
|
|
208
|
-
title={e('inputOnly')}
|
|
209
|
-
readOnly
|
|
210
|
-
/>
|
|
211
|
-
</Tooltip>
|
|
212
|
-
</Col>
|
|
213
|
-
<Col span={6}>
|
|
214
|
-
<EditOutlined className='pointer font16 mg1x' onClick={this.handleEdit} />
|
|
215
|
-
<CloseCircleOutlined className='pointer font16' onClick={this.handleDel} />
|
|
216
|
-
</Col>
|
|
217
|
-
</Row>
|
|
218
|
-
)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
render () {
|
|
222
|
-
if (this.state.edit) {
|
|
223
|
-
return this.renderForm()
|
|
224
|
-
}
|
|
225
|
-
return this.renderItem()
|
|
226
|
-
}
|
|
227
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* web form
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { useEffect } from 'react'
|
|
6
|
-
import {
|
|
7
|
-
Input,
|
|
8
|
-
Form,
|
|
9
|
-
InputNumber,
|
|
10
|
-
Alert
|
|
11
|
-
} from 'antd'
|
|
12
|
-
import { formItemLayout } from '../../common/form-layout'
|
|
13
|
-
import {
|
|
14
|
-
newBookmarkIdPrefix,
|
|
15
|
-
terminalRdpType,
|
|
16
|
-
rdpWikiLink
|
|
17
|
-
} from '../../common/constants'
|
|
18
|
-
import useSubmit from './use-submit'
|
|
19
|
-
import copy from 'json-deep-copy'
|
|
20
|
-
import { defaults, isEmpty } from 'lodash-es'
|
|
21
|
-
import Password from '../common/password'
|
|
22
|
-
import { ColorPickerItem } from './color-picker-item.jsx'
|
|
23
|
-
import { getColorFromCategory } from '../../common/get-category-color.js'
|
|
24
|
-
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
25
|
-
import ProfileItem from './profile-form-item'
|
|
26
|
-
import Link from '../common/external-link'
|
|
27
|
-
import BookmarkCategorySelect from './bookmark-category-select.jsx'
|
|
28
|
-
|
|
29
|
-
const FormItem = Form.Item
|
|
30
|
-
const e = window.translate
|
|
31
|
-
|
|
32
|
-
export default function RdpFormUi (props) {
|
|
33
|
-
const [
|
|
34
|
-
form,
|
|
35
|
-
handleFinish,
|
|
36
|
-
submitUi
|
|
37
|
-
] = useSubmit(props)
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (props.formData.id.startsWith(newBookmarkIdPrefix)) {
|
|
40
|
-
form.setFieldsValue({
|
|
41
|
-
category: props.currentBookmarkGroupId
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
}, [props.currentBookmarkGroupId])
|
|
45
|
-
const {
|
|
46
|
-
id = ''
|
|
47
|
-
} = props.formData
|
|
48
|
-
const {
|
|
49
|
-
bookmarkGroups = [],
|
|
50
|
-
currentBookmarkGroupId
|
|
51
|
-
} = props
|
|
52
|
-
let initialValues = copy(props.formData)
|
|
53
|
-
const initBookmarkGroupId = !id.startsWith(newBookmarkIdPrefix)
|
|
54
|
-
? findBookmarkGroupId(bookmarkGroups, id)
|
|
55
|
-
: currentBookmarkGroupId
|
|
56
|
-
const defaultValues = {
|
|
57
|
-
type: terminalRdpType,
|
|
58
|
-
port: 3389,
|
|
59
|
-
category: initBookmarkGroupId,
|
|
60
|
-
color: getColorFromCategory(bookmarkGroups, currentBookmarkGroupId)
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
initialValues = defaults(initialValues, defaultValues)
|
|
64
|
-
function renderCommon () {
|
|
65
|
-
const {
|
|
66
|
-
bookmarkGroups = []
|
|
67
|
-
} = props
|
|
68
|
-
const alertProps = {
|
|
69
|
-
message: (
|
|
70
|
-
<Link to={rdpWikiLink}>WIKI: {rdpWikiLink}</Link>
|
|
71
|
-
),
|
|
72
|
-
type: 'warning',
|
|
73
|
-
className: 'mg2y'
|
|
74
|
-
}
|
|
75
|
-
return (
|
|
76
|
-
<div className='pd1x'>
|
|
77
|
-
<Alert
|
|
78
|
-
{...alertProps}
|
|
79
|
-
/>
|
|
80
|
-
<FormItem
|
|
81
|
-
{...formItemLayout}
|
|
82
|
-
label={e('title')}
|
|
83
|
-
hasFeedback
|
|
84
|
-
>
|
|
85
|
-
<FormItem noStyle name='title'>
|
|
86
|
-
<Input addonBefore={<ColorPickerItem />} />
|
|
87
|
-
</FormItem>
|
|
88
|
-
</FormItem>
|
|
89
|
-
<FormItem
|
|
90
|
-
{...formItemLayout}
|
|
91
|
-
label={e('host')}
|
|
92
|
-
hasFeedback
|
|
93
|
-
name='host'
|
|
94
|
-
required
|
|
95
|
-
>
|
|
96
|
-
<Input />
|
|
97
|
-
</FormItem>
|
|
98
|
-
<FormItem
|
|
99
|
-
{...formItemLayout}
|
|
100
|
-
label={e('port')}
|
|
101
|
-
hasFeedback
|
|
102
|
-
name='port'
|
|
103
|
-
rules={[{
|
|
104
|
-
required: true, message: 'port required'
|
|
105
|
-
}]}
|
|
106
|
-
>
|
|
107
|
-
<InputNumber
|
|
108
|
-
placeholder={e('port')}
|
|
109
|
-
min={1}
|
|
110
|
-
max={65535}
|
|
111
|
-
step={1}
|
|
112
|
-
/>
|
|
113
|
-
</FormItem>
|
|
114
|
-
<ProfileItem
|
|
115
|
-
store={props.store}
|
|
116
|
-
profileFilter={d => !isEmpty(d.rdp)}
|
|
117
|
-
/>
|
|
118
|
-
<FormItem
|
|
119
|
-
{...formItemLayout}
|
|
120
|
-
label={e('username')}
|
|
121
|
-
hasFeedback
|
|
122
|
-
name='userName'
|
|
123
|
-
required
|
|
124
|
-
>
|
|
125
|
-
<Input />
|
|
126
|
-
</FormItem>
|
|
127
|
-
<FormItem
|
|
128
|
-
{...formItemLayout}
|
|
129
|
-
label={e('password')}
|
|
130
|
-
hasFeedback
|
|
131
|
-
name='password'
|
|
132
|
-
required
|
|
133
|
-
>
|
|
134
|
-
<Password />
|
|
135
|
-
</FormItem>
|
|
136
|
-
<FormItem
|
|
137
|
-
{...formItemLayout}
|
|
138
|
-
label={e('description')}
|
|
139
|
-
name='description'
|
|
140
|
-
hasFeedback
|
|
141
|
-
>
|
|
142
|
-
<Input.TextArea autoSize={{ minRows: 1 }} />
|
|
143
|
-
</FormItem>
|
|
144
|
-
<FormItem
|
|
145
|
-
{...formItemLayout}
|
|
146
|
-
label={e('domain')}
|
|
147
|
-
hasFeedback
|
|
148
|
-
name='domain'
|
|
149
|
-
>
|
|
150
|
-
<Input />
|
|
151
|
-
</FormItem>
|
|
152
|
-
<BookmarkCategorySelect
|
|
153
|
-
bookmarkGroups={bookmarkGroups}
|
|
154
|
-
form={form}
|
|
155
|
-
/>
|
|
156
|
-
<FormItem
|
|
157
|
-
{...formItemLayout}
|
|
158
|
-
label='type'
|
|
159
|
-
name='type'
|
|
160
|
-
className='hide'
|
|
161
|
-
>
|
|
162
|
-
<Input />
|
|
163
|
-
</FormItem>
|
|
164
|
-
</div>
|
|
165
|
-
)
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
<Form
|
|
170
|
-
form={form}
|
|
171
|
-
onFinish={handleFinish}
|
|
172
|
-
initialValues={initialValues}
|
|
173
|
-
name='rdp-form'
|
|
174
|
-
>
|
|
175
|
-
{renderCommon()}
|
|
176
|
-
{submitUi}
|
|
177
|
-
</Form>
|
|
178
|
-
)
|
|
179
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bookmark form
|
|
3
|
-
*/
|
|
4
|
-
import BookmarkForm from './ssh-form'
|
|
5
|
-
import RdpFormUi from './rdp-form-ui'
|
|
6
|
-
|
|
7
|
-
export default class RdpForm extends BookmarkForm {
|
|
8
|
-
render () {
|
|
9
|
-
return (
|
|
10
|
-
<RdpFormUi
|
|
11
|
-
{...this.props}
|
|
12
|
-
{...this.getProps()}
|
|
13
|
-
/>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|