@electerm/electerm-react 1.40.20 → 1.50.31
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/constants.js +57 -7
- package/client/common/new-terminal.js +2 -2
- package/client/components/auth/login.jsx +34 -57
- package/client/components/batch-op/batch-op.jsx +12 -11
- package/client/components/bookmark-form/index.jsx +2 -2
- package/client/components/bookmark-form/ssh-form.jsx +4 -1
- package/client/components/bookmark-form/tree-delete.jsx +5 -5
- package/client/components/context-menu/boomarks.jsx +8 -12
- package/client/components/context-menu/context-menu.jsx +10 -10
- package/client/components/context-menu/history.jsx +21 -24
- package/client/components/context-menu/menu-btn.jsx +11 -11
- package/client/components/context-menu/tabs.jsx +15 -19
- package/client/components/context-menu/zoom.jsx +25 -29
- package/client/components/footer/footer-entry.jsx +56 -56
- package/client/components/icons/split-icons.jsx +77 -0
- package/client/components/layout/layout-alg.js +260 -0
- package/client/components/layout/layout-item.jsx +94 -0
- package/client/components/layout/layout.jsx +167 -0
- package/client/components/layout/layout.styl +8 -0
- package/client/components/layout/layouts.jsx +72 -0
- package/client/components/layout/session-size-alg.js +31 -0
- package/client/components/main/custom-css.jsx +1 -1
- package/client/components/main/main.jsx +184 -110
- package/client/components/main/ui-theme.jsx +1 -1
- package/client/components/main/wrapper.styl +2 -4
- package/client/components/profile/profile-list.jsx +1 -3
- package/client/components/profile/profile-transport-mod.jsx +1 -1
- package/client/components/profile/profile-transport.jsx +6 -9
- package/client/components/quick-commands/quick-command-transport.jsx +6 -9
- package/client/components/quick-commands/quick-commands-box.jsx +144 -153
- package/client/components/quick-commands/quick-commands-select.jsx +10 -3
- package/client/components/rdp/rdp-session.jsx +3 -23
- package/client/components/rdp/resolution-edit.jsx +40 -42
- package/client/components/session/session.jsx +63 -328
- package/client/components/session/session.styl +1 -5
- package/client/components/session/sessions.jsx +140 -111
- package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
- package/client/components/setting-panel/setting-common.jsx +6 -4
- package/client/components/setting-panel/setting-modal.jsx +31 -31
- package/client/components/setting-panel/start-session-select.jsx +4 -4
- package/client/components/setting-panel/tab-settings.jsx +27 -5
- package/client/components/setting-sync/data-import.jsx +36 -39
- package/client/components/setting-sync/setting-sync-form.jsx +10 -10
- package/client/components/setting-sync/setting-sync.jsx +50 -52
- package/client/components/sftp/address-bookmark.jsx +57 -58
- package/client/components/sftp/confirm-modal-store.jsx +34 -40
- package/client/components/sftp/file-item.jsx +14 -3
- package/client/components/sftp/file-mode-modal.jsx +3 -0
- package/client/components/sftp/list-table-ui.jsx +4 -4
- package/client/components/sftp/sftp-entry.jsx +2 -2
- package/client/components/sftp/transfer-conflict-store.jsx +13 -17
- package/client/components/sftp/transport-action-store.jsx +38 -31
- package/client/components/sftp/transports-action-store.jsx +3 -3
- package/client/components/sftp/transports-ui-store.jsx +18 -23
- package/client/components/shortcuts/shortcut-handler.js +1 -0
- package/client/components/shortcuts/shortcuts-defaults.js +5 -5
- package/client/components/shortcuts/shortcuts.jsx +9 -12
- package/client/components/side-panel-r/right-side-panel.styl +40 -0
- package/client/components/side-panel-r/side-panel-r.jsx +102 -0
- package/client/components/sidebar/bookmark-select.jsx +40 -40
- package/client/components/sidebar/bookmark.jsx +63 -65
- package/client/components/sidebar/history.jsx +53 -50
- package/client/components/sidebar/index.jsx +195 -184
- package/client/components/sidebar/info-modal.jsx +202 -202
- package/client/components/sidebar/sidebar.styl +8 -2
- package/client/components/sidebar/transfer-history-modal.jsx +95 -100
- package/client/components/sidebar/transfer-list-control.jsx +2 -2
- package/client/components/sidebar/transfer-list.jsx +45 -42
- package/client/components/sidebar/transfer-modal.jsx +49 -52
- package/client/components/sidebar/transport-ui.jsx +1 -1
- package/client/components/tabs/index.jsx +261 -49
- package/client/components/tabs/tab.jsx +48 -66
- package/client/components/tabs/tabs.styl +6 -1
- package/client/components/tabs/window-control.jsx +46 -48
- package/client/components/terminal/attach-addon-custom.js +1 -1
- package/client/components/terminal/index.jsx +111 -113
- package/client/components/terminal/term-search.jsx +26 -24
- package/client/components/terminal-info/run-cmd.jsx +0 -25
- package/client/components/terminal-info/terminal-info.jsx +60 -0
- package/client/components/terminal-info/terminal-info.styl +1 -1
- package/client/components/tree-list/bookmark-transport.jsx +8 -9
- package/client/components/tree-list/tree-list.jsx +36 -26
- package/client/components/vnc/vnc-session.jsx +1 -6
- package/client/components/web/address-bar.jsx +50 -0
- package/client/components/web/web-session.jsx +32 -10
- package/client/entry/index.jsx +5 -6
- package/client/store/common.js +1 -1
- package/client/store/db-upgrade.js +1 -1
- package/client/store/event.js +2 -2
- package/client/store/index.js +21 -32
- package/client/store/init-state.js +15 -3
- package/client/store/load-data.js +1 -1
- package/client/store/quick-command.js +4 -4
- package/client/store/session.js +1 -1
- package/client/store/setting.js +10 -6
- package/client/store/system-menu.js +1 -10
- package/client/store/tab.js +91 -1
- package/client/store/transfer-list.js +5 -6
- package/client/store/watch.js +11 -6
- package/package.json +1 -1
- package/client/components/common/react-subx.jsx +0 -1
- package/client/components/common/resize-wrap.jsx +0 -222
- package/client/components/common/resize-wrap.styl +0 -9
- package/client/components/terminal-info/content.jsx +0 -152
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import QmTransportMod from './quick-command-transport-mod'
|
|
2
|
-
import { Component } from '../common/react-subx'
|
|
3
2
|
|
|
4
|
-
export default
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
}
|
|
3
|
+
export default function QmTransport () {
|
|
4
|
+
return (
|
|
5
|
+
<div className='pd1b'>
|
|
6
|
+
<QmTransportMod store={window.store} />
|
|
7
|
+
</div>
|
|
8
|
+
)
|
|
12
9
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* quick commands footer selection wrap
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { useState, useRef } from 'react'
|
|
6
6
|
import { quickCommandLabelsLsKey } from '../../common/constants'
|
|
7
7
|
import { sortBy } from 'lodash-es'
|
|
8
8
|
import { Button, Input, Select, Space } from 'antd'
|
|
@@ -14,41 +14,40 @@ import {
|
|
|
14
14
|
PushpinOutlined
|
|
15
15
|
} from '@ant-design/icons'
|
|
16
16
|
import classNames from 'classnames'
|
|
17
|
-
import
|
|
17
|
+
import onDropFunc from './on-drop'
|
|
18
18
|
import './qm.styl'
|
|
19
19
|
|
|
20
20
|
const e = window.translate
|
|
21
21
|
const addQuickCommands = 'addQuickCommands'
|
|
22
22
|
const { Option } = Select
|
|
23
23
|
|
|
24
|
-
export default
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
24
|
+
export default function QuickCommandsFooterBox (props) {
|
|
25
|
+
const [keyword, setKeyword] = useState('')
|
|
26
|
+
const [labels, setLabels] = useState(ls.getItemJSON(quickCommandLabelsLsKey, []))
|
|
27
|
+
const timer = useRef(null)
|
|
29
28
|
|
|
30
|
-
handleMouseLeave
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
function handleMouseLeave () {
|
|
30
|
+
timer.current = setTimeout(() => {
|
|
31
|
+
toggle(false)
|
|
33
32
|
}, 500)
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
handleMouseEnter
|
|
37
|
-
clearTimeout(
|
|
35
|
+
function handleMouseEnter () {
|
|
36
|
+
clearTimeout(timer.current)
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
toggle
|
|
41
|
-
|
|
39
|
+
function toggle (openQuickCommandBar) {
|
|
40
|
+
window.store.openQuickCommandBar = openQuickCommandBar
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
handleTogglePinned
|
|
45
|
-
|
|
43
|
+
function handleTogglePinned () {
|
|
44
|
+
window.store.pinnedQuickCommandBar = !window.store.pinnedQuickCommandBar
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
async function handleSelect (id) {
|
|
49
48
|
const {
|
|
50
49
|
store
|
|
51
|
-
} =
|
|
50
|
+
} = window
|
|
52
51
|
if (id === addQuickCommands) {
|
|
53
52
|
store.handleOpenQuickCommandsSetting()
|
|
54
53
|
} else {
|
|
@@ -56,50 +55,45 @@ export default class QuickCommandsFooterBox extends Component {
|
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
handleClose
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
function handleClose () {
|
|
59
|
+
window.store.pinnedQuickCommandBar = false
|
|
60
|
+
window.store.openQuickCommandBar = false
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
handleChange
|
|
65
|
-
|
|
66
|
-
keyword: e.target.value
|
|
67
|
-
})
|
|
63
|
+
function handleChange (e) {
|
|
64
|
+
setKeyword(e.target.value)
|
|
68
65
|
}
|
|
69
66
|
|
|
70
|
-
handleChangeLabels
|
|
67
|
+
function handleChangeLabels (v) {
|
|
71
68
|
ls.setItemJSON(quickCommandLabelsLsKey, v)
|
|
72
|
-
|
|
73
|
-
labels: v
|
|
74
|
-
})
|
|
69
|
+
setLabels(v)
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
filterFunc
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
72
|
+
// function filterFunc (v, opt) {
|
|
73
|
+
// const c = opt.props.children.toLowerCase()
|
|
74
|
+
// const m = opt.props.cmd.toLowerCase()
|
|
75
|
+
// const vv = v.toLowerCase()
|
|
76
|
+
// return c.includes(vv) || m.includes(vv)
|
|
77
|
+
// }
|
|
83
78
|
|
|
84
|
-
onDragOver
|
|
79
|
+
function onDragOver (e) {
|
|
85
80
|
e.preventDefault()
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
onDragStart
|
|
83
|
+
function onDragStart (e) {
|
|
89
84
|
e.dataTransfer.setData('idDragged', e.target.getAttribute('data-id'))
|
|
90
85
|
}
|
|
91
86
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onDrop(e, '.qm-item')
|
|
87
|
+
function onDrop (e) {
|
|
88
|
+
onDropFunc(e, '.qm-item')
|
|
95
89
|
}
|
|
96
90
|
|
|
97
|
-
renderNoCmd
|
|
91
|
+
function renderNoCmd () {
|
|
98
92
|
return (
|
|
99
93
|
<div className='pd1'>
|
|
100
94
|
<Button
|
|
101
95
|
type='primary'
|
|
102
|
-
onClick={
|
|
96
|
+
onClick={window.store.handleOpenQuickCommandsSetting}
|
|
103
97
|
>
|
|
104
98
|
{e(addQuickCommands)}
|
|
105
99
|
</Button>
|
|
@@ -107,24 +101,24 @@ export default class QuickCommandsFooterBox extends Component {
|
|
|
107
101
|
)
|
|
108
102
|
}
|
|
109
103
|
|
|
110
|
-
renderItem
|
|
104
|
+
function renderItem (item) {
|
|
111
105
|
const {
|
|
112
106
|
qmSortByFrequency
|
|
113
|
-
} =
|
|
107
|
+
} = props
|
|
114
108
|
return (
|
|
115
109
|
<CmdItem
|
|
116
110
|
item={item}
|
|
117
111
|
key={item.id}
|
|
118
|
-
onSelect={
|
|
112
|
+
onSelect={handleSelect}
|
|
119
113
|
draggable={!qmSortByFrequency}
|
|
120
|
-
handleDragOver={
|
|
121
|
-
handleDragStart={
|
|
122
|
-
handleDrop={
|
|
114
|
+
handleDragOver={onDragOver}
|
|
115
|
+
handleDragStart={onDragStart}
|
|
116
|
+
handleDrop={onDrop}
|
|
123
117
|
/>
|
|
124
118
|
)
|
|
125
119
|
}
|
|
126
120
|
|
|
127
|
-
renderTag
|
|
121
|
+
function renderTag (tag) {
|
|
128
122
|
return (
|
|
129
123
|
<Option
|
|
130
124
|
value={tag}
|
|
@@ -135,7 +129,7 @@ export default class QuickCommandsFooterBox extends Component {
|
|
|
135
129
|
)
|
|
136
130
|
}
|
|
137
131
|
|
|
138
|
-
sortArray (array, keyword, labels, qmSortByFrequency) {
|
|
132
|
+
function sortArray (array, keyword, labels, qmSortByFrequency) {
|
|
139
133
|
const sorters = [
|
|
140
134
|
(obj) => !(keyword && obj.name.toLowerCase().includes(keyword)),
|
|
141
135
|
(obj) => !labels.some((label) => (obj.labels || []).includes(label))
|
|
@@ -146,113 +140,110 @@ export default class QuickCommandsFooterBox extends Component {
|
|
|
146
140
|
return sortBy(array, sorters)
|
|
147
141
|
}
|
|
148
142
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
nameMatch: keyword && d.name.toLowerCase().includes(keyword),
|
|
172
|
-
labelMatch: labels.some((label) => (d.labels || []).includes(label))
|
|
173
|
-
}
|
|
174
|
-
})
|
|
175
|
-
const sprops = {
|
|
176
|
-
value: labels,
|
|
177
|
-
mode: 'multiple',
|
|
178
|
-
onChange: this.handleChangeLabels,
|
|
179
|
-
placeholder: e('labels'),
|
|
180
|
-
className: 'iblock',
|
|
181
|
-
style: {
|
|
182
|
-
minWidth: '100px'
|
|
143
|
+
const {
|
|
144
|
+
openQuickCommandBar,
|
|
145
|
+
pinnedQuickCommandBar,
|
|
146
|
+
qmSortByFrequency,
|
|
147
|
+
inActiveTerminal,
|
|
148
|
+
leftSidebarWidth,
|
|
149
|
+
openedSideBar
|
|
150
|
+
} = props
|
|
151
|
+
if ((!openQuickCommandBar && !pinnedQuickCommandBar) || !inActiveTerminal) {
|
|
152
|
+
return null
|
|
153
|
+
}
|
|
154
|
+
const all = props.currentQuickCommands
|
|
155
|
+
if (!all.length) {
|
|
156
|
+
return renderNoCmd()
|
|
157
|
+
}
|
|
158
|
+
const keyword0 = keyword.toLowerCase()
|
|
159
|
+
const filtered = sortArray(all, keyword0, labels, qmSortByFrequency)
|
|
160
|
+
.map(d => {
|
|
161
|
+
return {
|
|
162
|
+
...d,
|
|
163
|
+
nameMatch: keyword && d.name.toLowerCase().includes(keyword),
|
|
164
|
+
labelMatch: labels.some((label) => (d.labels || []).includes(label))
|
|
183
165
|
}
|
|
166
|
+
})
|
|
167
|
+
const sprops = {
|
|
168
|
+
value: labels,
|
|
169
|
+
mode: 'multiple',
|
|
170
|
+
onChange: handleChangeLabels,
|
|
171
|
+
placeholder: e('labels'),
|
|
172
|
+
className: 'iblock',
|
|
173
|
+
style: {
|
|
174
|
+
minWidth: '100px'
|
|
184
175
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
176
|
+
}
|
|
177
|
+
const tp = pinnedQuickCommandBar
|
|
178
|
+
? 'primary'
|
|
179
|
+
: 'ghost'
|
|
180
|
+
const cls = classNames(
|
|
181
|
+
'qm-list-wrap',
|
|
182
|
+
{ 'fil-label': !!labels.length },
|
|
183
|
+
{ 'fil-keyword': !!keyword }
|
|
184
|
+
)
|
|
185
|
+
const type = qmSortByFrequency ? 'primary' : 'default'
|
|
186
|
+
const w = openedSideBar ? 43 + leftSidebarWidth : 43
|
|
187
|
+
const qmProps = {
|
|
188
|
+
className: 'qm-wrap-tooltip',
|
|
189
|
+
style: {
|
|
190
|
+
left: w
|
|
191
|
+
},
|
|
192
|
+
onMouseLeave: handleMouseLeave,
|
|
193
|
+
onMouseEnter: handleMouseEnter
|
|
194
|
+
}
|
|
195
|
+
return (
|
|
196
|
+
<div
|
|
197
|
+
{...qmProps}
|
|
198
|
+
>
|
|
199
|
+
<div className='pd2'>
|
|
200
|
+
<div className='pd2b fix'>
|
|
201
|
+
<span className='fleft'>
|
|
202
|
+
<Input.Search
|
|
203
|
+
value={keyword}
|
|
204
|
+
onChange={handleChange}
|
|
205
|
+
placeholder=''
|
|
206
|
+
className='iblock qm-search-input'
|
|
207
|
+
/>
|
|
208
|
+
</span>
|
|
209
|
+
<span className='fleft mg1l'>
|
|
210
|
+
<Select
|
|
211
|
+
{...sprops}
|
|
212
|
+
>
|
|
213
|
+
{props.quickCommandTags.map(
|
|
214
|
+
renderTag
|
|
215
|
+
)}
|
|
216
|
+
</Select>
|
|
217
|
+
<Button
|
|
218
|
+
className='mg1l iblock'
|
|
219
|
+
type={type}
|
|
220
|
+
onClick={window.store.handleSortByFrequency}
|
|
221
|
+
>
|
|
222
|
+
{e('sortByFrequency')}
|
|
223
|
+
</Button>
|
|
224
|
+
</span>
|
|
225
|
+
<span className='fright'>
|
|
226
|
+
<Space.Compact>
|
|
227
|
+
<Button
|
|
228
|
+
onClick={handleTogglePinned}
|
|
229
|
+
icon={<PushpinOutlined />}
|
|
230
|
+
type={tp}
|
|
231
|
+
/>
|
|
232
|
+
<Button
|
|
233
|
+
onClick={window.store.handleOpenQuickCommandsSetting}
|
|
234
|
+
icon={<EditOutlined />}
|
|
215
235
|
/>
|
|
216
|
-
</span>
|
|
217
|
-
<span className='fleft mg1l'>
|
|
218
|
-
<Select
|
|
219
|
-
{...sprops}
|
|
220
|
-
>
|
|
221
|
-
{this.props.store.quickCommandTags.map(
|
|
222
|
-
this.renderTag
|
|
223
|
-
)}
|
|
224
|
-
</Select>
|
|
225
236
|
<Button
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
<Space.Compact>
|
|
235
|
-
<Button
|
|
236
|
-
onClick={this.handleTogglePinned}
|
|
237
|
-
icon={<PushpinOutlined />}
|
|
238
|
-
type={tp}
|
|
239
|
-
/>
|
|
240
|
-
<Button
|
|
241
|
-
onClick={this.props.store.handleOpenQuickCommandsSetting}
|
|
242
|
-
icon={<EditOutlined />}
|
|
243
|
-
/>
|
|
244
|
-
<Button
|
|
245
|
-
onClick={this.handleClose}
|
|
246
|
-
icon={<CloseCircleOutlined />}
|
|
247
|
-
/>
|
|
248
|
-
</Space.Compact>
|
|
249
|
-
</span>
|
|
250
|
-
</div>
|
|
251
|
-
<div className={cls}>
|
|
252
|
-
{filtered.map(this.renderItem)}
|
|
253
|
-
</div>
|
|
237
|
+
onClick={handleClose}
|
|
238
|
+
icon={<CloseCircleOutlined />}
|
|
239
|
+
/>
|
|
240
|
+
</Space.Compact>
|
|
241
|
+
</span>
|
|
242
|
+
</div>
|
|
243
|
+
<div className={cls}>
|
|
244
|
+
{filtered.map(renderItem)}
|
|
254
245
|
</div>
|
|
255
246
|
</div>
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
</div>
|
|
248
|
+
)
|
|
258
249
|
}
|
|
@@ -9,6 +9,11 @@ import './qm.styl'
|
|
|
9
9
|
const e = window.translate
|
|
10
10
|
|
|
11
11
|
export default class QuickCommandsFooter extends PureComponent {
|
|
12
|
+
componentWillUnmount () {
|
|
13
|
+
clearTimeout(this.timer)
|
|
14
|
+
this.timer = null
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
handleOpen = () => {
|
|
13
18
|
this.timer = setTimeout(this.act, 500)
|
|
14
19
|
}
|
|
@@ -23,11 +28,13 @@ export default class QuickCommandsFooter extends PureComponent {
|
|
|
23
28
|
|
|
24
29
|
render () {
|
|
25
30
|
return (
|
|
26
|
-
<div
|
|
31
|
+
<div
|
|
32
|
+
className='fleft relative'
|
|
33
|
+
onMouseEnter={this.handleOpen}
|
|
34
|
+
onMouseLeave={this.handleMouseLeave}
|
|
35
|
+
>
|
|
27
36
|
<Button
|
|
28
37
|
size='small'
|
|
29
|
-
onMouseEnter={this.handleOpen}
|
|
30
|
-
onMouseLeave={this.handleMouseLeave}
|
|
31
38
|
type='ghost'
|
|
32
39
|
>
|
|
33
40
|
<span className='w500'>{e('quickCommands')}</span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PureComponent } from 'react'
|
|
2
2
|
import { createTerm } from '../terminal/terminal-apis'
|
|
3
3
|
import deepCopy from 'json-deep-copy'
|
|
4
4
|
import clone from '../../common/to-simple-obj'
|
|
@@ -22,7 +22,7 @@ import resolutions from './resolutions'
|
|
|
22
22
|
|
|
23
23
|
const { Option } = Select
|
|
24
24
|
|
|
25
|
-
export default class RdpSession extends
|
|
25
|
+
export default class RdpSession extends PureComponent {
|
|
26
26
|
constructor (props) {
|
|
27
27
|
const id = `rdp-reso-${props.tab.host}`
|
|
28
28
|
const resObj = ls.getItemJSON(id, resolutions[0])
|
|
@@ -55,21 +55,6 @@ export default class RdpSession extends Component {
|
|
|
55
55
|
})
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
computeProps = () => {
|
|
59
|
-
const {
|
|
60
|
-
height,
|
|
61
|
-
width,
|
|
62
|
-
tabsHeight,
|
|
63
|
-
leftSidebarWidth,
|
|
64
|
-
pinned,
|
|
65
|
-
openedSideBar
|
|
66
|
-
} = this.props
|
|
67
|
-
return {
|
|
68
|
-
width: width - (pinned && openedSideBar ? leftSidebarWidth : 0) - 42,
|
|
69
|
-
height: height - tabsHeight
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
58
|
remoteInit = async (term = this.term) => {
|
|
74
59
|
this.setState({
|
|
75
60
|
loading: true
|
|
@@ -202,8 +187,6 @@ export default class RdpSession extends Component {
|
|
|
202
187
|
}
|
|
203
188
|
|
|
204
189
|
handleCanvasEvent = e => {
|
|
205
|
-
// e.preventDefault()
|
|
206
|
-
// console.log('e', e)
|
|
207
190
|
const {
|
|
208
191
|
type,
|
|
209
192
|
clientX,
|
|
@@ -215,7 +198,6 @@ export default class RdpSession extends Component {
|
|
|
215
198
|
} = e.target.getBoundingClientRect()
|
|
216
199
|
const x = clientX - left
|
|
217
200
|
const y = clientY - top
|
|
218
|
-
// console.log('x,y', x, y, left, top, clientX, clientY, pageX, pageY)
|
|
219
201
|
const keyCode = this.getKeyCode(e)
|
|
220
202
|
const action = type.startsWith('key')
|
|
221
203
|
? 'sendKeyEventScancode'
|
|
@@ -230,7 +212,6 @@ export default class RdpSession extends Component {
|
|
|
230
212
|
const isHorizontal = false
|
|
231
213
|
const delta = isHorizontal ? e.deltaX : e.deltaY
|
|
232
214
|
const step = Math.round(Math.abs(delta) * 15 / 8)
|
|
233
|
-
// console.log(x, y, step, delta, isHorizontal)
|
|
234
215
|
params = [x, y, step, delta > 0, isHorizontal]
|
|
235
216
|
} else if (type === 'keydown' || type === 'keyup') {
|
|
236
217
|
params = [keyCode, pressed]
|
|
@@ -242,7 +223,6 @@ export default class RdpSession extends Component {
|
|
|
242
223
|
}
|
|
243
224
|
|
|
244
225
|
onData = async (msg) => {
|
|
245
|
-
// console.log('msg', msg.data)
|
|
246
226
|
let { data } = msg
|
|
247
227
|
data = JSON.parse(data)
|
|
248
228
|
if (data.action === 'session-rdp-connected') {
|
|
@@ -409,7 +389,7 @@ export default class RdpSession extends Component {
|
|
|
409
389
|
}
|
|
410
390
|
|
|
411
391
|
render () {
|
|
412
|
-
const { width: w, height: h } = this.
|
|
392
|
+
const { width: w, height: h } = this.props
|
|
413
393
|
const rdpProps = {
|
|
414
394
|
style: {
|
|
415
395
|
width: w + 'px',
|
|
@@ -1,63 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
// import { memo } from 'react'
|
|
2
2
|
import ResolutionForm from './resolution-form'
|
|
3
3
|
import {
|
|
4
4
|
Modal
|
|
5
5
|
} from 'antd'
|
|
6
6
|
import uid from '../../common/uid'
|
|
7
7
|
|
|
8
|
-
export default
|
|
9
|
-
remove
|
|
10
|
-
const {
|
|
11
|
-
const { resolutions } = store
|
|
8
|
+
export default function Resolutions (props) {
|
|
9
|
+
function remove (id) {
|
|
10
|
+
const { resolutions } = props
|
|
12
11
|
const index = resolutions.findIndex(d => d.id === id)
|
|
13
12
|
if (index < 0) {
|
|
14
13
|
return
|
|
15
14
|
}
|
|
16
15
|
resolutions.splice(index, 1)
|
|
17
|
-
store.setState('resolutions', resolutions)
|
|
16
|
+
window.store.setState('resolutions', resolutions)
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
submit
|
|
21
|
-
const {
|
|
22
|
-
const { resolutions } = store
|
|
19
|
+
function submit (data) {
|
|
20
|
+
const { resolutions } = props
|
|
23
21
|
resolutions.push({
|
|
24
22
|
...data,
|
|
25
23
|
id: uid()
|
|
26
24
|
})
|
|
27
|
-
store.setState('resolutions', resolutions)
|
|
25
|
+
window.store.setState('resolutions', resolutions)
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Modal
|
|
55
|
-
{...modalProps}
|
|
56
|
-
>
|
|
57
|
-
<ResolutionForm
|
|
58
|
-
{...resList}
|
|
59
|
-
/>
|
|
60
|
-
</Modal>
|
|
61
|
-
)
|
|
28
|
+
const {
|
|
29
|
+
resolutions
|
|
30
|
+
} = props
|
|
31
|
+
const {
|
|
32
|
+
openResolutionEdit,
|
|
33
|
+
toggleResolutionEdit
|
|
34
|
+
} = window.store
|
|
35
|
+
if (!openResolutionEdit) {
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
38
|
+
const modalProps = {
|
|
39
|
+
footer: null,
|
|
40
|
+
visible: true,
|
|
41
|
+
onCancel: () => toggleResolutionEdit()
|
|
42
|
+
}
|
|
43
|
+
const resList = {
|
|
44
|
+
list: resolutions,
|
|
45
|
+
initialValues: {
|
|
46
|
+
width: 1600,
|
|
47
|
+
height: 900
|
|
48
|
+
},
|
|
49
|
+
remove,
|
|
50
|
+
submit
|
|
62
51
|
}
|
|
52
|
+
return (
|
|
53
|
+
<Modal
|
|
54
|
+
{...modalProps}
|
|
55
|
+
>
|
|
56
|
+
<ResolutionForm
|
|
57
|
+
{...resList}
|
|
58
|
+
/>
|
|
59
|
+
</Modal>
|
|
60
|
+
)
|
|
63
61
|
}
|