@electerm/electerm-react 1.60.18 → 1.60.29
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/clipboard.js +1 -14
- package/client/common/constants.js +0 -43
- package/client/common/data-compare.js +55 -0
- package/client/common/default-setting.js +2 -10
- package/client/common/resolve.js +18 -22
- package/client/common/sftp.js +0 -3
- package/client/components/ai/ai-chat.jsx +30 -6
- package/client/components/ai/ai-config.jsx +17 -6
- package/client/components/batch-op/batch-op.jsx +3 -24
- package/client/components/bookmark-form/bookmark-group-tree-format.js +7 -9
- package/client/components/bookmark-form/form-ssh-common.jsx +0 -2
- package/client/components/bookmark-form/ssh-form.jsx +8 -41
- package/client/components/bookmark-form/tree-delete.jsx +6 -15
- package/client/components/common/animate-text.jsx +3 -4
- package/client/components/common/drag-handle.jsx +59 -45
- package/client/components/common/drag-handle.styl +2 -1
- package/client/components/common/input-auto-focus.jsx +29 -63
- package/client/components/common/ref.js +24 -0
- package/client/components/footer/batch-input.jsx +1 -6
- package/client/components/footer/footer-entry.jsx +13 -16
- package/client/components/footer/footer.styl +0 -5
- package/client/components/icons/ai-icon.jsx +17 -0
- package/client/components/icons/ai-icon.styl +3 -0
- package/client/components/layout/layout-item.jsx +14 -0
- package/client/components/main/main.jsx +8 -19
- package/client/components/main/upgrade.jsx +13 -25
- package/client/components/profile/profile-form-elem.jsx +1 -2
- package/client/components/quick-commands/on-drop.js +1 -12
- package/client/components/quick-commands/quick-command-transport-mod.jsx +3 -13
- package/client/components/quick-commands/quick-commands-form-elem.jsx +1 -2
- package/client/components/rdp/rdp-session.jsx +4 -4
- package/client/components/session/session.jsx +9 -11
- package/client/components/setting-panel/on-tree-drop.js +4 -35
- package/client/components/setting-panel/setting-common.jsx +4 -1
- package/client/components/setting-panel/setting-modal.jsx +7 -5
- package/client/components/setting-panel/tab-settings.jsx +0 -1
- package/client/components/setting-sync/setting-sync.jsx +0 -1
- package/client/components/sftp/address-bookmark-item.jsx +1 -15
- package/client/components/sftp/confirm-modal-store.jsx +2 -2
- package/client/components/sftp/{file-mode-modal.jsx → file-info-modal.jsx} +137 -37
- package/client/components/sftp/file-item.jsx +156 -192
- package/client/components/sftp/file-table-header.jsx +98 -0
- package/client/components/sftp/list-table-ui.jsx +125 -416
- package/client/components/sftp/sftp-entry.jsx +102 -128
- package/client/components/sftp/sftp.styl +6 -22
- package/client/components/sftp/transfer-conflict-store.jsx +8 -12
- package/client/components/sftp/transport-action-store.jsx +7 -15
- package/client/components/shortcuts/shortcut-control.jsx +72 -3
- package/client/components/shortcuts/shortcut-handler.js +0 -1
- package/client/components/side-panel-r/side-panel-r.jsx +7 -4
- package/client/components/sidebar/history.jsx +3 -0
- package/client/components/sidebar/index.jsx +1 -1
- package/client/components/sidebar/info-modal.jsx +3 -0
- package/client/components/sidebar/side-panel.jsx +7 -4
- package/client/components/sidebar/sidebar-panel.jsx +1 -1
- package/client/components/sidebar/sidebar.styl +3 -3
- package/client/components/sys-menu/icons-map.jsx +52 -0
- package/client/components/{context-menu → sys-menu}/menu-btn.jsx +33 -45
- package/client/components/sys-menu/sys-menu.jsx +163 -0
- package/client/components/{context-menu/context-menu.styl → sys-menu/sys-menu.styl} +2 -11
- package/client/components/tabs/index.jsx +5 -97
- package/client/components/tabs/tab.jsx +121 -73
- package/client/components/tabs/tabs.styl +4 -1
- package/client/components/terminal/term-search.jsx +16 -28
- package/client/components/terminal/terminal-interactive.jsx +0 -2
- package/client/components/terminal/{index.jsx → terminal.jsx} +110 -240
- package/client/components/terminal-info/base.jsx +21 -46
- package/client/components/terminal-info/terminal-info.jsx +3 -0
- package/client/components/text-editor/text-editor.jsx +38 -53
- package/client/components/theme/theme-form.jsx +0 -2
- package/client/components/tree-list/bookmark-toolbar.jsx +23 -47
- package/client/components/tree-list/bookmark-transport.jsx +2 -90
- package/client/components/tree-list/move-item-modal.jsx +101 -0
- package/client/components/tree-list/tree-list-item.jsx +6 -8
- package/client/components/tree-list/tree-list.jsx +48 -273
- package/client/components/vnc/vnc-session.jsx +5 -3
- package/client/store/app-upgrade.js +2 -5
- package/client/store/bookmark-group.js +74 -28
- package/client/store/common.js +36 -54
- package/client/store/event.js +4 -37
- package/client/store/init-state.js +9 -12
- package/client/store/item.js +34 -39
- package/client/store/load-data.js +5 -1
- package/client/store/quick-command.js +2 -12
- package/client/store/session.js +6 -7
- package/client/store/setting.js +3 -7
- package/client/store/sidebar.js +2 -8
- package/client/store/store.js +0 -20
- package/client/store/system-menu.js +1 -2
- package/client/store/tab.js +29 -1
- package/client/store/terminal-theme.js +0 -4
- package/client/store/watch.js +26 -4
- package/package.json +1 -1
- package/client/common/post-msg.js +0 -3
- package/client/components/common/native-input.jsx +0 -30
- package/client/components/context-menu/context-menu.jsx +0 -339
- package/client/components/sftp/file-props-modal.jsx +0 -210
- package/client/store/context-menu.js +0 -23
- /package/client/components/{context-menu → sys-menu}/boomarks.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/history.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/icon-holder.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/sub-tab-menu.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/tabs.jsx +0 -0
- /package/client/components/{context-menu → sys-menu}/zoom.jsx +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Component } from 'react'
|
|
2
|
-
import { handleErr } from '../../common/fetch'
|
|
3
|
-
import generate from '../../common/uid'
|
|
1
|
+
import { Component, createRef } from 'react'
|
|
2
|
+
import { handleErr } from '../../common/fetch.jsx'
|
|
3
|
+
import generate from '../../common/uid.js'
|
|
4
4
|
import { isEqual, pick, debounce, throttle } from 'lodash-es'
|
|
5
|
-
import
|
|
6
|
-
import clone from '../../common/to-simple-obj'
|
|
5
|
+
import clone from '../../common/to-simple-obj.js'
|
|
7
6
|
// import runIdle from '../../common/run-idle'
|
|
8
7
|
import {
|
|
9
8
|
ReloadOutlined
|
|
@@ -11,7 +10,8 @@ import {
|
|
|
11
10
|
import {
|
|
12
11
|
notification,
|
|
13
12
|
Spin,
|
|
14
|
-
Button
|
|
13
|
+
Button,
|
|
14
|
+
Dropdown
|
|
15
15
|
} from 'antd'
|
|
16
16
|
import classnames from 'classnames'
|
|
17
17
|
import './terminal.styl'
|
|
@@ -21,50 +21,45 @@ import {
|
|
|
21
21
|
typeMap,
|
|
22
22
|
isWin,
|
|
23
23
|
transferTypeMap,
|
|
24
|
-
terminalActions,
|
|
25
|
-
commonActions,
|
|
26
24
|
rendererTypes,
|
|
27
25
|
cwdId,
|
|
28
26
|
isMac,
|
|
29
27
|
zmodemTransferPackSize
|
|
30
|
-
} from '../../common/constants'
|
|
28
|
+
} from '../../common/constants.js'
|
|
31
29
|
import deepCopy from 'json-deep-copy'
|
|
32
|
-
import { readClipboardAsync, copy } from '../../common/clipboard'
|
|
30
|
+
import { readClipboardAsync, copy } from '../../common/clipboard.js'
|
|
33
31
|
import { FitAddon } from '@xterm/addon-fit'
|
|
34
|
-
import AttachAddon from './attach-addon-custom'
|
|
32
|
+
import AttachAddon from './attach-addon-custom.js'
|
|
35
33
|
import { SearchAddon } from '@xterm/addon-search'
|
|
36
34
|
import { WebLinksAddon } from '@xterm/addon-web-links'
|
|
37
35
|
import { CanvasAddon } from '@xterm/addon-canvas'
|
|
38
36
|
import { WebglAddon } from '@xterm/addon-webgl'
|
|
39
37
|
import { LigaturesAddon } from '@xterm/addon-ligatures'
|
|
40
|
-
import getProxy from '../../common/get-proxy'
|
|
41
|
-
import { AddonZmodem } from './xterm-zmodem'
|
|
38
|
+
import getProxy from '../../common/get-proxy.js'
|
|
39
|
+
import { AddonZmodem } from './xterm-zmodem.js'
|
|
42
40
|
import { Unicode11Addon } from '@xterm/addon-unicode11'
|
|
43
|
-
import keyControlPressed from '../../common/key-control-pressed'
|
|
41
|
+
import keyControlPressed from '../../common/key-control-pressed.js'
|
|
44
42
|
import { Terminal } from '@xterm/xterm'
|
|
45
|
-
import NormalBuffer from './normal-buffer'
|
|
46
|
-
import { createTerm, resizeTerm } from './terminal-apis'
|
|
43
|
+
import NormalBuffer from './normal-buffer.jsx'
|
|
44
|
+
import { createTerm, resizeTerm } from './terminal-apis.js'
|
|
47
45
|
import { shortcutExtend, shortcutDescExtend } from '../shortcuts/shortcut-handler.js'
|
|
48
46
|
import { KeywordHighlighterAddon } from './highlight-addon.js'
|
|
49
47
|
import { getLocalFileInfo } from '../sftp/file-read.js'
|
|
50
48
|
import { CommandTrackerAddon } from './command-tracker-addon.js'
|
|
49
|
+
import AIIcon from '../icons/ai-icon.jsx'
|
|
51
50
|
import { formatBytes } from '../../common/byte-format.js'
|
|
52
51
|
import * as fs from './fs.js'
|
|
52
|
+
import iconsMap from '../sys-menu/icons-map.jsx'
|
|
53
|
+
import { refs } from '../common/ref.js'
|
|
53
54
|
|
|
54
55
|
const e = window.translate
|
|
55
56
|
|
|
56
|
-
const computePos = (e) => {
|
|
57
|
-
return {
|
|
58
|
-
left: e.clientX,
|
|
59
|
-
top: e.clientY
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
57
|
class Term extends Component {
|
|
64
58
|
constructor (props) {
|
|
65
59
|
super(props)
|
|
66
60
|
this.state = {
|
|
67
61
|
loading: false,
|
|
62
|
+
hasSelection: false,
|
|
68
63
|
saveTerminalLogToFile: !!this.props.config.saveTerminalLogToFile,
|
|
69
64
|
addTimeStampToTermLog: !!this.props.config.addTimeStampToTermLog,
|
|
70
65
|
passType: 'password',
|
|
@@ -72,9 +67,12 @@ class Term extends Component {
|
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
|
|
70
|
+
domRef = createRef()
|
|
71
|
+
|
|
75
72
|
componentDidMount () {
|
|
73
|
+
this.id = `term-${this.props.tab.id}`
|
|
74
|
+
refs.add(this.id, this)
|
|
76
75
|
this.initTerminal()
|
|
77
|
-
this.initEvt()
|
|
78
76
|
if (this.props.tab.enableSsh === false) {
|
|
79
77
|
;(
|
|
80
78
|
document.querySelector('.session-current .term-sftp-tabs .type-tab.sftp') ||
|
|
@@ -155,6 +153,7 @@ clear\r`
|
|
|
155
153
|
}
|
|
156
154
|
|
|
157
155
|
componentWillUnmount () {
|
|
156
|
+
refs.remove(this.id)
|
|
158
157
|
if (this.zsession) {
|
|
159
158
|
this.onZmodemEnd()
|
|
160
159
|
}
|
|
@@ -177,10 +176,6 @@ clear\r`
|
|
|
177
176
|
'resize',
|
|
178
177
|
this.onResize
|
|
179
178
|
)
|
|
180
|
-
window.removeEventListener('message', this.handleEvent)
|
|
181
|
-
this.dom.removeEventListener('contextmenu', this.onContextMenu)
|
|
182
|
-
window.removeEventListener('message', this.onContextAction)
|
|
183
|
-
this.dom = null
|
|
184
179
|
this.attachAddon = null
|
|
185
180
|
this.fitAddon = null
|
|
186
181
|
this.zmodemAddon = null
|
|
@@ -249,17 +244,6 @@ clear\r`
|
|
|
249
244
|
return `term-${this.props.tab.id}`
|
|
250
245
|
}
|
|
251
246
|
|
|
252
|
-
initEvt = () => {
|
|
253
|
-
const dom = document.getElementById(this.getDomId())
|
|
254
|
-
this.dom = dom
|
|
255
|
-
dom.addEventListener('contextmenu', this.onContextMenu)
|
|
256
|
-
window.addEventListener(
|
|
257
|
-
'resize',
|
|
258
|
-
this.onResize
|
|
259
|
-
)
|
|
260
|
-
window.addEventListener('message', this.handleEvent)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
247
|
zoom = (v) => {
|
|
264
248
|
const { term } = this
|
|
265
249
|
if (!term) {
|
|
@@ -321,120 +305,12 @@ clear\r`
|
|
|
321
305
|
this.openNormalBuffer()
|
|
322
306
|
}
|
|
323
307
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
saveTerminalLogToFile,
|
|
331
|
-
addTimeStampToTermLog,
|
|
332
|
-
type,
|
|
333
|
-
cmd,
|
|
334
|
-
selectedTabIds = [],
|
|
335
|
-
activeTabId,
|
|
336
|
-
pid,
|
|
337
|
-
inputOnly,
|
|
338
|
-
zoomValue
|
|
339
|
-
} = e?.data || {}
|
|
340
|
-
|
|
341
|
-
const { id: activeTabIdProp } = this.props.tab
|
|
342
|
-
const tabIdMatch = selectedTabIds.includes(activeTabIdProp) || activeTabId === activeTabIdProp
|
|
343
|
-
if (
|
|
344
|
-
action === terminalActions.zoom &&
|
|
345
|
-
tabIdMatch
|
|
346
|
-
) {
|
|
347
|
-
this.zoom(zoomValue)
|
|
348
|
-
} else if (
|
|
349
|
-
action === terminalActions.changeEncode &&
|
|
350
|
-
tabIdMatch
|
|
351
|
-
) {
|
|
352
|
-
this.switchEncoding(encode)
|
|
353
|
-
} else if (
|
|
354
|
-
action === terminalActions.batchInput && tabIdMatch
|
|
355
|
-
) {
|
|
356
|
-
this.batchInput(cmd)
|
|
357
|
-
} else if (
|
|
358
|
-
action === terminalActions.showInfoPanel &&
|
|
359
|
-
tabIdMatch
|
|
360
|
-
) {
|
|
361
|
-
this.handleShowInfo()
|
|
362
|
-
} else if (
|
|
363
|
-
action === terminalActions.quickCommand &&
|
|
364
|
-
(
|
|
365
|
-
tabIdMatch
|
|
366
|
-
)
|
|
367
|
-
) {
|
|
368
|
-
e.stopPropagation()
|
|
369
|
-
this.term && this.attachAddon._sendData(
|
|
370
|
-
cmd +
|
|
371
|
-
(inputOnly ? '' : '\r')
|
|
372
|
-
)
|
|
373
|
-
this.term.focus()
|
|
374
|
-
} else if (
|
|
375
|
-
action === terminalActions.openTerminalSearch &&
|
|
376
|
-
(
|
|
377
|
-
tabIdMatch
|
|
378
|
-
)
|
|
379
|
-
) {
|
|
380
|
-
this.toggleSearch()
|
|
381
|
-
} else if (
|
|
382
|
-
action === terminalActions.doSearchNext &&
|
|
383
|
-
(
|
|
384
|
-
tabIdMatch
|
|
385
|
-
)
|
|
386
|
-
) {
|
|
387
|
-
this.searchNext(keyword, options)
|
|
388
|
-
} else if (
|
|
389
|
-
action === terminalActions.doSearchPrev &&
|
|
390
|
-
(
|
|
391
|
-
tabIdMatch
|
|
392
|
-
)
|
|
393
|
-
) {
|
|
394
|
-
this.searchPrev(keyword, options)
|
|
395
|
-
} else if (
|
|
396
|
-
action === terminalActions.clearSearch &&
|
|
397
|
-
(
|
|
398
|
-
tabIdMatch
|
|
399
|
-
)
|
|
400
|
-
) {
|
|
401
|
-
this.searchAddon.clearDecorations()
|
|
402
|
-
} else if (
|
|
403
|
-
action === commonActions.getTermLogState &&
|
|
404
|
-
pid === activeTabIdProp
|
|
405
|
-
) {
|
|
406
|
-
postMessage({
|
|
407
|
-
action: commonActions.returnTermLogState,
|
|
408
|
-
state: {
|
|
409
|
-
saveTerminalLogToFile: this.state.saveTerminalLogToFile,
|
|
410
|
-
addTimeStampToTermLog: this.state.addTimeStampToTermLog
|
|
411
|
-
},
|
|
412
|
-
pid: activeTabIdProp
|
|
413
|
-
})
|
|
414
|
-
} else if (
|
|
415
|
-
action === commonActions.setTermLogState &&
|
|
416
|
-
pid === activeTabIdProp
|
|
417
|
-
) {
|
|
418
|
-
this.setState({
|
|
419
|
-
addTimeStampToTermLog,
|
|
420
|
-
saveTerminalLogToFile
|
|
421
|
-
})
|
|
422
|
-
}
|
|
423
|
-
const isActiveTerminal = this.isActiveTerminal()
|
|
424
|
-
if (
|
|
425
|
-
type === 'focus' &&
|
|
426
|
-
isActiveTerminal
|
|
427
|
-
) {
|
|
428
|
-
e.stopPropagation()
|
|
429
|
-
return this.term && this.term.focus()
|
|
430
|
-
}
|
|
431
|
-
if (
|
|
432
|
-
type === 'blur' &&
|
|
433
|
-
isActiveTerminal
|
|
434
|
-
) {
|
|
435
|
-
e.stopPropagation()
|
|
436
|
-
return this.term && this.term.blur()
|
|
437
|
-
}
|
|
308
|
+
runQuickCommand = (cmd, inputOnly = false) => {
|
|
309
|
+
this.term && this.attachAddon._sendData(
|
|
310
|
+
cmd +
|
|
311
|
+
(inputOnly ? '' : '\r')
|
|
312
|
+
)
|
|
313
|
+
this.term.focus()
|
|
438
314
|
}
|
|
439
315
|
|
|
440
316
|
onDrop = e => {
|
|
@@ -760,29 +636,7 @@ clear\r`
|
|
|
760
636
|
}
|
|
761
637
|
}
|
|
762
638
|
|
|
763
|
-
|
|
764
|
-
const {
|
|
765
|
-
action,
|
|
766
|
-
id,
|
|
767
|
-
args = [],
|
|
768
|
-
func
|
|
769
|
-
} = e.data || {}
|
|
770
|
-
if (action === commonActions.closeContextMenuAfter) {
|
|
771
|
-
window.removeEventListener('message', this.onContextAction)
|
|
772
|
-
return false
|
|
773
|
-
}
|
|
774
|
-
if (
|
|
775
|
-
action !== commonActions.clickContextMenu ||
|
|
776
|
-
id !== this.uid ||
|
|
777
|
-
!this[func]
|
|
778
|
-
) {
|
|
779
|
-
return false
|
|
780
|
-
}
|
|
781
|
-
window.removeEventListener('message', this.onContextAction)
|
|
782
|
-
this[func](...args)
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
onContextMenu = e => {
|
|
639
|
+
onContextMenuInner = e => {
|
|
786
640
|
e.preventDefault()
|
|
787
641
|
if (this.state.loading) {
|
|
788
642
|
return
|
|
@@ -790,14 +644,6 @@ clear\r`
|
|
|
790
644
|
if (this.props.config.pasteWhenContextMenu) {
|
|
791
645
|
return this.onPaste()
|
|
792
646
|
}
|
|
793
|
-
const items = this.renderContext()
|
|
794
|
-
this.uid = generate()
|
|
795
|
-
window.store.openContextMenu({
|
|
796
|
-
id: this.uid,
|
|
797
|
-
items,
|
|
798
|
-
pos: computePos(e)
|
|
799
|
-
})
|
|
800
|
-
window.addEventListener('message', this.onContextAction)
|
|
801
647
|
}
|
|
802
648
|
|
|
803
649
|
onCopy = () => {
|
|
@@ -858,61 +704,68 @@ clear\r`
|
|
|
858
704
|
)
|
|
859
705
|
}
|
|
860
706
|
|
|
861
|
-
|
|
862
|
-
|
|
707
|
+
explainWithAi = () => {
|
|
708
|
+
window.store.explainWithAi(
|
|
709
|
+
this.term.getSelection()
|
|
710
|
+
)
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
renderContextMenu = () => {
|
|
714
|
+
const { hasSelection } = this.state
|
|
863
715
|
const copyed = true
|
|
864
716
|
const copyShortcut = this.getShortcut('terminal_copy')
|
|
865
717
|
const pasteShortcut = this.getShortcut('terminal_paste')
|
|
866
718
|
const clearShortcut = this.getShortcut('terminal_clear')
|
|
867
|
-
// const selectAllShortcut = this.getShortcut('terminal_selectAll')
|
|
868
719
|
const searchShortcut = this.getShortcut('terminal_search')
|
|
720
|
+
|
|
869
721
|
return [
|
|
870
722
|
{
|
|
871
|
-
|
|
872
|
-
icon:
|
|
873
|
-
|
|
874
|
-
disabled: !
|
|
875
|
-
|
|
723
|
+
key: 'onCopy',
|
|
724
|
+
icon: <iconsMap.CopyOutlined />,
|
|
725
|
+
label: e('copy'),
|
|
726
|
+
disabled: !hasSelection,
|
|
727
|
+
extra: copyShortcut
|
|
876
728
|
},
|
|
877
729
|
{
|
|
878
|
-
|
|
879
|
-
icon:
|
|
880
|
-
|
|
730
|
+
key: 'onPaste',
|
|
731
|
+
icon: <iconsMap.SwitcherOutlined />,
|
|
732
|
+
label: e('paste'),
|
|
881
733
|
disabled: !copyed,
|
|
882
|
-
|
|
734
|
+
extra: pasteShortcut
|
|
883
735
|
},
|
|
884
736
|
{
|
|
885
|
-
|
|
886
|
-
icon:
|
|
887
|
-
|
|
888
|
-
disabled: !
|
|
737
|
+
key: 'onPasteSelected',
|
|
738
|
+
icon: <iconsMap.SwitcherOutlined />,
|
|
739
|
+
label: e('pasteSelected'),
|
|
740
|
+
disabled: !hasSelection
|
|
889
741
|
},
|
|
890
742
|
{
|
|
891
|
-
|
|
892
|
-
icon:
|
|
893
|
-
|
|
894
|
-
|
|
743
|
+
key: 'explainWithAi',
|
|
744
|
+
icon: <AIIcon />,
|
|
745
|
+
label: e('explainWithAi'),
|
|
746
|
+
disabled: !hasSelection
|
|
895
747
|
},
|
|
896
|
-
// {
|
|
897
|
-
// func: 'onSelectAll',
|
|
898
|
-
// icon: 'SelectOutlined',
|
|
899
|
-
// text: e('selectAll'),
|
|
900
|
-
// subText: selectAllShortcut
|
|
901
|
-
// },
|
|
902
748
|
{
|
|
903
|
-
|
|
904
|
-
icon:
|
|
905
|
-
|
|
906
|
-
|
|
749
|
+
key: 'onClear',
|
|
750
|
+
icon: <iconsMap.ReloadOutlined />,
|
|
751
|
+
label: e('clear'),
|
|
752
|
+
extra: clearShortcut
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
key: 'toggleSearch',
|
|
756
|
+
icon: <iconsMap.SearchOutlined />,
|
|
757
|
+
label: e('search'),
|
|
758
|
+
extra: searchShortcut
|
|
907
759
|
}
|
|
908
760
|
]
|
|
909
761
|
}
|
|
910
762
|
|
|
763
|
+
onContextMenu = ({ key }) => {
|
|
764
|
+
this[key]()
|
|
765
|
+
}
|
|
766
|
+
|
|
911
767
|
notifyOnData = debounce(() => {
|
|
912
|
-
|
|
913
|
-
action: 'terminal-receive-data',
|
|
914
|
-
tabId: this.props.tab.id
|
|
915
|
-
})
|
|
768
|
+
window.store.notifyTabOnData(this.props.tab.id)
|
|
916
769
|
}, 1000)
|
|
917
770
|
|
|
918
771
|
parse (rawText) {
|
|
@@ -1015,9 +868,9 @@ clear\r`
|
|
|
1015
868
|
// term.onTitleChange(this.onTitleChange)
|
|
1016
869
|
term.parent = this
|
|
1017
870
|
term.onSelectionChange(this.onSelection)
|
|
1018
|
-
term.open(
|
|
871
|
+
term.open(this.domRef.current, true)
|
|
1019
872
|
this.loadRenderer(term, config)
|
|
1020
|
-
term.textarea.addEventListener('click', this.setActive)
|
|
873
|
+
// term.textarea.addEventListener('click', this.setActive)
|
|
1021
874
|
// term.onKey(this.onKey)
|
|
1022
875
|
// term.textarea.addEventListener('blur', this.onBlur)
|
|
1023
876
|
|
|
@@ -1037,19 +890,26 @@ clear\r`
|
|
|
1037
890
|
term.loadAddon(this.cmdAddon)
|
|
1038
891
|
term.onData(this.onData)
|
|
1039
892
|
this.term = term
|
|
893
|
+
term.onSelectionChange(this.onSelectionChange)
|
|
1040
894
|
term.attachCustomKeyEventHandler(this.handleKeyboardEvent.bind(this))
|
|
1041
895
|
await this.remoteInit(term)
|
|
1042
896
|
}
|
|
1043
897
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
window.store.storeAssign({
|
|
1048
|
-
activeTabId: tabId,
|
|
1049
|
-
[name]: tabId
|
|
898
|
+
onSelectionChange = () => {
|
|
899
|
+
this.setState({
|
|
900
|
+
hasSelection: this.term.hasSelection()
|
|
1050
901
|
})
|
|
1051
902
|
}
|
|
1052
903
|
|
|
904
|
+
// setActive = () => {
|
|
905
|
+
// const name = `activeTabId${this.props.batch}`
|
|
906
|
+
// const tabId = this.props.tab.id
|
|
907
|
+
// window.store.storeAssign({
|
|
908
|
+
// activeTabId: tabId,
|
|
909
|
+
// [name]: tabId
|
|
910
|
+
// })
|
|
911
|
+
// }
|
|
912
|
+
|
|
1053
913
|
runInitScript = () => {
|
|
1054
914
|
window.store.triggerResize()
|
|
1055
915
|
const {
|
|
@@ -1122,8 +982,7 @@ clear\r`
|
|
|
1122
982
|
this.props.sessionId
|
|
1123
983
|
)
|
|
1124
984
|
}
|
|
1125
|
-
|
|
1126
|
-
return wsUrl
|
|
985
|
+
return `ws://${host}:${port}/terminals/${id}?sessionId=${this.props.sessionId}&token=${tokenElecterm}`
|
|
1127
986
|
}
|
|
1128
987
|
|
|
1129
988
|
remoteInit = async (term = this.term) => {
|
|
@@ -1366,7 +1225,8 @@ clear\r`
|
|
|
1366
1225
|
top,
|
|
1367
1226
|
zIndex: 10
|
|
1368
1227
|
},
|
|
1369
|
-
onDrop: this.onDrop
|
|
1228
|
+
onDrop: this.onDrop,
|
|
1229
|
+
onContextMenu: this.onContextMenuInner
|
|
1370
1230
|
}
|
|
1371
1231
|
// const fileProps = {
|
|
1372
1232
|
// type: 'file',
|
|
@@ -1376,6 +1236,7 @@ clear\r`
|
|
|
1376
1236
|
// }
|
|
1377
1237
|
const prps3 = {
|
|
1378
1238
|
id: this.getDomId(),
|
|
1239
|
+
ref: this.domRef,
|
|
1379
1240
|
className: 'absolute term-wrap-2',
|
|
1380
1241
|
style: {
|
|
1381
1242
|
left: '10px',
|
|
@@ -1384,19 +1245,28 @@ clear\r`
|
|
|
1384
1245
|
bottom: 0
|
|
1385
1246
|
}
|
|
1386
1247
|
}
|
|
1248
|
+
const dropdownProps = {
|
|
1249
|
+
menu: {
|
|
1250
|
+
items: this.renderContextMenu(),
|
|
1251
|
+
onClick: this.onContextMenu
|
|
1252
|
+
},
|
|
1253
|
+
trigger: ['contextMenu']
|
|
1254
|
+
}
|
|
1387
1255
|
return (
|
|
1388
|
-
<
|
|
1389
|
-
{...prps1}
|
|
1390
|
-
>
|
|
1256
|
+
<Dropdown {...dropdownProps}>
|
|
1391
1257
|
<div
|
|
1392
|
-
{...
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1258
|
+
{...prps1}
|
|
1259
|
+
>
|
|
1260
|
+
<div
|
|
1261
|
+
{...prps3}
|
|
1262
|
+
/>
|
|
1263
|
+
<NormalBuffer
|
|
1264
|
+
lines={this.state.lines}
|
|
1265
|
+
close={this.closeNormalBuffer}
|
|
1266
|
+
/>
|
|
1267
|
+
<Spin className='loading-wrapper' spinning={loading} />
|
|
1268
|
+
</div>
|
|
1269
|
+
</Dropdown>
|
|
1400
1270
|
)
|
|
1401
1271
|
}
|
|
1402
1272
|
}
|
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Component } from 'react'
|
|
5
5
|
import { osResolve } from '../../common/resolve'
|
|
6
|
-
import {
|
|
7
|
-
commonActions
|
|
8
|
-
} from '../../common/constants'
|
|
9
6
|
import {
|
|
10
7
|
Switch,
|
|
11
8
|
Space,
|
|
@@ -13,9 +10,16 @@ import {
|
|
|
13
10
|
} from 'antd'
|
|
14
11
|
import ShowItem from '../common/show-item'
|
|
15
12
|
import defaults from '../../common/default-setting'
|
|
16
|
-
import postMsg from '../../common/post-msg'
|
|
17
13
|
import { toggleTerminalLog, toggleTerminalLogTimestamp } from '../terminal/terminal-apis'
|
|
18
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
ClockCircleOutlined,
|
|
16
|
+
BorderlessTableOutlined,
|
|
17
|
+
DatabaseOutlined,
|
|
18
|
+
BarsOutlined,
|
|
19
|
+
ApiOutlined,
|
|
20
|
+
PartitionOutlined
|
|
21
|
+
} from '@ant-design/icons'
|
|
22
|
+
import { refs } from '../common/ref'
|
|
19
23
|
|
|
20
24
|
const e = window.translate
|
|
21
25
|
|
|
@@ -36,11 +40,6 @@ export default class TerminalInfoBase extends Component {
|
|
|
36
40
|
|
|
37
41
|
componentDidMount () {
|
|
38
42
|
this.getState()
|
|
39
|
-
window.addEventListener('message', this.onEvent)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
componentWillUnmount () {
|
|
43
|
-
this.exit()
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
handleToggleTimestamp = () => {
|
|
@@ -57,12 +56,9 @@ export default class TerminalInfoBase extends Component {
|
|
|
57
56
|
this.setState({
|
|
58
57
|
addTimeStampToTermLog: nv
|
|
59
58
|
})
|
|
60
|
-
|
|
61
|
-
action: commonActions.setTermLogState,
|
|
62
|
-
pid,
|
|
59
|
+
refs.get('term-' + pid)?.setState({
|
|
63
60
|
addTimeStampToTermLog: nv,
|
|
64
|
-
saveTerminalLogToFile
|
|
65
|
-
sessionId
|
|
61
|
+
saveTerminalLogToFile
|
|
66
62
|
})
|
|
67
63
|
}
|
|
68
64
|
|
|
@@ -90,44 +86,23 @@ export default class TerminalInfoBase extends Component {
|
|
|
90
86
|
this.setState({
|
|
91
87
|
saveTerminalLogToFile: nv
|
|
92
88
|
})
|
|
93
|
-
|
|
94
|
-
action: commonActions.setTermLogState,
|
|
95
|
-
pid,
|
|
89
|
+
refs.get('term-' + pid)?.setState({
|
|
96
90
|
saveTerminalLogToFile: nv,
|
|
97
|
-
addTimeStampToTermLog
|
|
98
|
-
sessionId
|
|
91
|
+
addTimeStampToTermLog
|
|
99
92
|
})
|
|
100
93
|
}
|
|
101
94
|
|
|
102
|
-
onEvent = (e) => {
|
|
103
|
-
const {
|
|
104
|
-
action,
|
|
105
|
-
state,
|
|
106
|
-
pid: ppid
|
|
107
|
-
} = e.data || {}
|
|
108
|
-
if (
|
|
109
|
-
action === commonActions.returnTermLogState &&
|
|
110
|
-
this.props.pid === ppid
|
|
111
|
-
) {
|
|
112
|
-
this.setState(state)
|
|
113
|
-
window.removeEventListener('message', this.onEvent)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
95
|
getState = () => {
|
|
118
96
|
const {
|
|
119
|
-
pid
|
|
120
|
-
sessionId
|
|
97
|
+
pid
|
|
121
98
|
} = this.props
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
exit = () => {
|
|
130
|
-
window.removeEventListener('message', this.onEvent)
|
|
99
|
+
const term = refs.get('term-' + pid)
|
|
100
|
+
if (term) {
|
|
101
|
+
this.setState({
|
|
102
|
+
saveTerminalLogToFile: term.state.saveTerminalLogToFile,
|
|
103
|
+
addTimeStampToTermLog: term.state.addTimeStampToTermLog
|
|
104
|
+
})
|
|
105
|
+
}
|
|
131
106
|
}
|
|
132
107
|
|
|
133
108
|
renderTimestamp () {
|