@electerm/electerm-react 1.40.20 → 1.50.21
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 +26 -0
- package/client/components/layout/layout.jsx +167 -0
- package/client/components/layout/layout.styl +5 -0
- package/client/components/layout/layouts.jsx +71 -0
- package/client/components/layout/session-size-alg.js +31 -0
- package/client/components/main/main.jsx +183 -109
- 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 +62 -317
- package/client/components/session/session.styl +1 -5
- package/client/components/session/sessions.jsx +99 -105
- 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 +9 -9
- 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.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 +60 -65
- package/client/components/tabs/tabs.styl +6 -1
- package/client/components/tabs/window-control.jsx +46 -48
- package/client/components/terminal/index.jsx +101 -104
- 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/store/common.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 +9 -5
- package/client/store/system-menu.js +1 -10
- package/client/store/tab.js +66 -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
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
::-webkit-scrollbar
|
|
8
8
|
width 0
|
|
9
9
|
display none
|
|
10
|
-
.not-system-ui.is-mac.not-webapp
|
|
10
|
+
.not-system-ui.is-mac.not-webapp .layout-item.v1
|
|
11
11
|
.tabs-inner
|
|
12
12
|
margin-left 72px
|
|
13
|
+
.not-system-ui.is-mac.not-webapp.pinned .layout-item.v1
|
|
14
|
+
.tabs-inner
|
|
15
|
+
margin-left 0
|
|
13
16
|
.not-system-ui.not-mac.not-webapp
|
|
14
17
|
.tabs-extra
|
|
15
18
|
right 96px
|
|
@@ -22,7 +25,9 @@
|
|
|
22
25
|
height 36px
|
|
23
26
|
overflow-x scroll
|
|
24
27
|
overflow-y hidden
|
|
28
|
+
.layout-item.v1 .tabs-inner
|
|
25
29
|
margin-left 42px
|
|
30
|
+
|
|
26
31
|
.tabs-wrapper
|
|
27
32
|
z-index 3
|
|
28
33
|
.tab
|
|
@@ -3,59 +3,57 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { CloseOutlined, MinusOutlined } from '@ant-design/icons'
|
|
6
|
-
import {
|
|
6
|
+
import { auto } from 'manate/react'
|
|
7
7
|
import {
|
|
8
8
|
isMacJs
|
|
9
9
|
} from '../../common/constants'
|
|
10
10
|
|
|
11
11
|
const e = window.translate
|
|
12
12
|
|
|
13
|
-
export default
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div className='window-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
export default auto(function WindowControl (props) {
|
|
14
|
+
const {
|
|
15
|
+
isMaximized,
|
|
16
|
+
config
|
|
17
|
+
} = props.store
|
|
18
|
+
if (config.useSystemTitleBar || isMacJs) {
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
const minimize = () => {
|
|
22
|
+
window.pre.runGlobalAsync('minimize')
|
|
23
|
+
}
|
|
24
|
+
const maximize = () => {
|
|
25
|
+
window.pre.runGlobalAsync('maximize')
|
|
26
|
+
}
|
|
27
|
+
const unmaximize = () => {
|
|
28
|
+
window.pre.runGlobalAsync('unmaximize')
|
|
29
|
+
}
|
|
30
|
+
const closeApp = () => {
|
|
31
|
+
window.store.exit()
|
|
32
|
+
}
|
|
33
|
+
return (
|
|
34
|
+
<div className='window-controls'>
|
|
35
|
+
<div className='window-control-box window-control-minimize' onClick={minimize}>
|
|
36
|
+
<MinusOutlined title={e('minimize')} className='iblock font12 widnow-control-icon' />
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
className='window-control-box window-control-maximize'
|
|
40
|
+
onClick={
|
|
41
|
+
isMaximized ? unmaximize : maximize
|
|
42
|
+
}
|
|
43
|
+
>
|
|
44
|
+
<span
|
|
45
|
+
title={
|
|
46
|
+
isMaximized ? e('unmaximize') : e('maximize')
|
|
47
|
+
}
|
|
48
|
+
className={
|
|
49
|
+
'iblock font12 icon-maximize widnow-control-icon ' +
|
|
50
|
+
(isMaximized ? 'is-max' : 'not-max')
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
<span
|
|
46
|
-
title={
|
|
47
|
-
isMaximized ? e('unmaximize') : e('maximize')
|
|
48
|
-
}
|
|
49
|
-
className={
|
|
50
|
-
'iblock font12 icon-maximize widnow-control-icon ' +
|
|
51
|
-
(isMaximized ? 'is-max' : 'not-max')
|
|
52
|
-
}
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
<div className='window-control-box window-control-close' onClick={closeApp}>
|
|
56
|
-
<CloseOutlined title={e('close')} className='iblock font12 widnow-control-icon' />
|
|
57
|
-
</div>
|
|
52
|
+
/>
|
|
58
53
|
</div>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
<div className='window-control-box window-control-close' onClick={closeApp}>
|
|
55
|
+
<CloseOutlined title={e('close')} className='iblock font12 widnow-control-icon' />
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
59
|
+
})
|
|
@@ -66,8 +66,6 @@ class Term extends Component {
|
|
|
66
66
|
constructor (props) {
|
|
67
67
|
super(props)
|
|
68
68
|
this.state = {
|
|
69
|
-
pid: '',
|
|
70
|
-
id: props.id || 'id' + generate(),
|
|
71
69
|
loading: false,
|
|
72
70
|
saveTerminalLogToFile: !!this.props.config.saveTerminalLogToFile,
|
|
73
71
|
addTimeStampToTermLog: !!this.props.config.addTimeStampToTermLog,
|
|
@@ -159,18 +157,20 @@ clear\r`
|
|
|
159
157
|
if (this.zsession) {
|
|
160
158
|
this.onZmodemEnd()
|
|
161
159
|
}
|
|
162
|
-
|
|
160
|
+
this.term.parent = null
|
|
163
161
|
Object.keys(this.timers).forEach(k => {
|
|
164
162
|
clearTimeout(this.timers[k])
|
|
163
|
+
this.timers[k] = null
|
|
165
164
|
})
|
|
165
|
+
this.timers = null
|
|
166
166
|
this.onClose = true
|
|
167
167
|
if (this.socket) {
|
|
168
168
|
this.socket.close()
|
|
169
|
-
|
|
169
|
+
this.socket = null
|
|
170
170
|
}
|
|
171
171
|
if (this.term) {
|
|
172
172
|
this.term.dispose()
|
|
173
|
-
|
|
173
|
+
this.term = null
|
|
174
174
|
}
|
|
175
175
|
window.removeEventListener(
|
|
176
176
|
'resize',
|
|
@@ -179,13 +179,13 @@ clear\r`
|
|
|
179
179
|
window.removeEventListener('message', this.handleEvent)
|
|
180
180
|
this.dom.removeEventListener('contextmenu', this.onContextMenu)
|
|
181
181
|
window.removeEventListener('message', this.onContextAction)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
this.dom = null
|
|
183
|
+
this.attachAddon = null
|
|
184
|
+
this.fitAddon = null
|
|
185
|
+
this.zmodemAddon = null
|
|
186
|
+
this.searchAddon = null
|
|
187
|
+
this.serializeAddon = null
|
|
188
|
+
this.fitAddon = null
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
terminalConfigProps = [
|
|
@@ -239,9 +239,12 @@ clear\r`
|
|
|
239
239
|
|
|
240
240
|
timers = {}
|
|
241
241
|
|
|
242
|
+
getDomId = () => {
|
|
243
|
+
return `term-${this.props.tab.id}`
|
|
244
|
+
}
|
|
245
|
+
|
|
242
246
|
initEvt = () => {
|
|
243
|
-
const
|
|
244
|
-
const dom = document.getElementById(id)
|
|
247
|
+
const dom = document.getElementById(this.getDomId())
|
|
245
248
|
this.dom = dom
|
|
246
249
|
dom.addEventListener('contextmenu', this.onContextMenu)
|
|
247
250
|
window.addEventListener(
|
|
@@ -261,8 +264,7 @@ clear\r`
|
|
|
261
264
|
}
|
|
262
265
|
|
|
263
266
|
isActiveTerminal = () => {
|
|
264
|
-
return this.props.id === this.props.
|
|
265
|
-
this.props.tab.id === this.props.currentTabId &&
|
|
267
|
+
return this.props.tab.id === this.props.currentTabId &&
|
|
266
268
|
this.props.pane === paneMap.terminal
|
|
267
269
|
}
|
|
268
270
|
|
|
@@ -323,43 +325,43 @@ clear\r`
|
|
|
323
325
|
addTimeStampToTermLog,
|
|
324
326
|
type,
|
|
325
327
|
cmd,
|
|
326
|
-
|
|
328
|
+
currentTabId,
|
|
327
329
|
pid,
|
|
328
330
|
toAll,
|
|
329
331
|
inputOnly,
|
|
330
332
|
zoomValue
|
|
331
333
|
} = e?.data || {}
|
|
332
334
|
|
|
333
|
-
const { id:
|
|
334
|
-
const
|
|
335
|
+
const { id: currentTabIdProp } = this.props.tab
|
|
336
|
+
const tabIdMatch = currentTabId === currentTabIdProp
|
|
335
337
|
if (
|
|
336
338
|
action === terminalActions.zoom &&
|
|
337
|
-
|
|
339
|
+
tabIdMatch
|
|
338
340
|
) {
|
|
339
341
|
this.zoom(zoomValue)
|
|
340
342
|
} else if (
|
|
341
343
|
action === terminalActions.changeEncode &&
|
|
342
|
-
|
|
344
|
+
tabIdMatch
|
|
343
345
|
) {
|
|
344
346
|
this.switchEncoding(encode)
|
|
345
347
|
} else if (
|
|
346
348
|
action === terminalActions.batchInput &&
|
|
347
349
|
(
|
|
348
|
-
toAll ||
|
|
350
|
+
toAll || tabIdMatch
|
|
349
351
|
)
|
|
350
352
|
) {
|
|
351
353
|
this.batchInput(cmd)
|
|
352
354
|
} else if (
|
|
353
355
|
action === terminalActions.showInfoPanel &&
|
|
354
356
|
(
|
|
355
|
-
|
|
357
|
+
tabIdMatch
|
|
356
358
|
)
|
|
357
359
|
) {
|
|
358
360
|
this.handleShowInfo()
|
|
359
361
|
} else if (
|
|
360
362
|
action === terminalActions.quickCommand &&
|
|
361
363
|
(
|
|
362
|
-
|
|
364
|
+
tabIdMatch
|
|
363
365
|
)
|
|
364
366
|
) {
|
|
365
367
|
e.stopPropagation()
|
|
@@ -371,34 +373,34 @@ clear\r`
|
|
|
371
373
|
} else if (
|
|
372
374
|
action === terminalActions.openTerminalSearch &&
|
|
373
375
|
(
|
|
374
|
-
|
|
376
|
+
tabIdMatch
|
|
375
377
|
)
|
|
376
378
|
) {
|
|
377
379
|
this.toggleSearch()
|
|
378
380
|
} else if (
|
|
379
381
|
action === terminalActions.doSearchNext &&
|
|
380
382
|
(
|
|
381
|
-
|
|
383
|
+
tabIdMatch
|
|
382
384
|
)
|
|
383
385
|
) {
|
|
384
386
|
this.searchNext(keyword, options)
|
|
385
387
|
} else if (
|
|
386
388
|
action === terminalActions.doSearchPrev &&
|
|
387
389
|
(
|
|
388
|
-
|
|
390
|
+
tabIdMatch
|
|
389
391
|
)
|
|
390
392
|
) {
|
|
391
393
|
this.searchPrev(keyword, options)
|
|
392
394
|
} else if (
|
|
393
395
|
action === terminalActions.clearSearch &&
|
|
394
396
|
(
|
|
395
|
-
|
|
397
|
+
tabIdMatch
|
|
396
398
|
)
|
|
397
399
|
) {
|
|
398
400
|
this.searchAddon.clearDecorations()
|
|
399
401
|
} else if (
|
|
400
402
|
action === commonActions.getTermLogState &&
|
|
401
|
-
pid ===
|
|
403
|
+
pid === currentTabIdProp
|
|
402
404
|
) {
|
|
403
405
|
postMessage({
|
|
404
406
|
action: commonActions.returnTermLogState,
|
|
@@ -406,11 +408,11 @@ clear\r`
|
|
|
406
408
|
saveTerminalLogToFile: this.state.saveTerminalLogToFile,
|
|
407
409
|
addTimeStampToTermLog: this.state.addTimeStampToTermLog
|
|
408
410
|
},
|
|
409
|
-
pid:
|
|
411
|
+
pid: currentTabIdProp
|
|
410
412
|
})
|
|
411
413
|
} else if (
|
|
412
414
|
action === commonActions.setTermLogState &&
|
|
413
|
-
pid ===
|
|
415
|
+
pid === currentTabIdProp
|
|
414
416
|
) {
|
|
415
417
|
this.setState({
|
|
416
418
|
addTimeStampToTermLog,
|
|
@@ -423,7 +425,6 @@ clear\r`
|
|
|
423
425
|
isActiveTerminal
|
|
424
426
|
) {
|
|
425
427
|
e.stopPropagation()
|
|
426
|
-
window.store.termFocused = true
|
|
427
428
|
return this.term && this.term.focus()
|
|
428
429
|
}
|
|
429
430
|
if (
|
|
@@ -713,7 +714,7 @@ clear\r`
|
|
|
713
714
|
}
|
|
714
715
|
|
|
715
716
|
onZmodemEnd = async () => {
|
|
716
|
-
|
|
717
|
+
this.zmodemSavePath = null
|
|
717
718
|
this.onCanceling = true
|
|
718
719
|
if (this.downloadFd) {
|
|
719
720
|
await fs.close(this.downloadFd)
|
|
@@ -723,21 +724,21 @@ clear\r`
|
|
|
723
724
|
console.error
|
|
724
725
|
)
|
|
725
726
|
}
|
|
726
|
-
|
|
727
|
+
this.xfer = null
|
|
727
728
|
if (this.zsession && this.zsession.close) {
|
|
728
729
|
await this.zsession.close().catch(
|
|
729
730
|
console.error
|
|
730
731
|
)
|
|
731
732
|
}
|
|
732
|
-
|
|
733
|
+
this.zsession = null
|
|
733
734
|
this.term.focus()
|
|
734
735
|
this.term.write('\r\n')
|
|
735
736
|
this.onZmodem = false
|
|
736
|
-
|
|
737
|
-
delete this.downloadPath
|
|
738
|
-
delete this.downloadCount
|
|
739
|
-
delete this.downloadSize
|
|
740
|
-
|
|
737
|
+
this.downloadFd = null
|
|
738
|
+
// delete this.downloadPath
|
|
739
|
+
// delete this.downloadCount
|
|
740
|
+
// delete this.downloadSize
|
|
741
|
+
this.DownloadCache = null
|
|
741
742
|
}
|
|
742
743
|
|
|
743
744
|
onZmodemCatch = (e) => {
|
|
@@ -758,10 +759,6 @@ clear\r`
|
|
|
758
759
|
}
|
|
759
760
|
}
|
|
760
761
|
|
|
761
|
-
split = () => {
|
|
762
|
-
this.props.handleSplit(null, this.props.id)
|
|
763
|
-
}
|
|
764
|
-
|
|
765
762
|
onContextAction = e => {
|
|
766
763
|
const {
|
|
767
764
|
action,
|
|
@@ -769,6 +766,10 @@ clear\r`
|
|
|
769
766
|
args = [],
|
|
770
767
|
func
|
|
771
768
|
} = e.data || {}
|
|
769
|
+
if (action === commonActions.closeContextMenuAfter) {
|
|
770
|
+
window.removeEventListener('message', this.onContextAction)
|
|
771
|
+
return false
|
|
772
|
+
}
|
|
772
773
|
if (
|
|
773
774
|
action !== commonActions.clickContextMenu ||
|
|
774
775
|
id !== this.uid ||
|
|
@@ -828,6 +829,12 @@ clear\r`
|
|
|
828
829
|
this.term.focus()
|
|
829
830
|
}
|
|
830
831
|
|
|
832
|
+
onPasteSelected = () => {
|
|
833
|
+
const selected = this.term.getSelection()
|
|
834
|
+
this.term.paste(selected || '')
|
|
835
|
+
this.term.focus()
|
|
836
|
+
}
|
|
837
|
+
|
|
831
838
|
toggleSearch = () => {
|
|
832
839
|
window.store.toggleTerminalSearch()
|
|
833
840
|
}
|
|
@@ -874,6 +881,12 @@ clear\r`
|
|
|
874
881
|
disabled: !copyed,
|
|
875
882
|
subText: pasteShortcut
|
|
876
883
|
},
|
|
884
|
+
{
|
|
885
|
+
func: 'onPasteSelected',
|
|
886
|
+
icon: 'SwitcherOutlined',
|
|
887
|
+
text: e('pasteSelected'),
|
|
888
|
+
disabled: !hasSlected
|
|
889
|
+
},
|
|
877
890
|
{
|
|
878
891
|
func: 'onClear',
|
|
879
892
|
icon: 'ReloadOutlined',
|
|
@@ -891,11 +904,6 @@ clear\r`
|
|
|
891
904
|
icon: 'SearchOutlined',
|
|
892
905
|
text: e('search'),
|
|
893
906
|
subText: searchShortcut
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
func: 'split',
|
|
897
|
-
icon: 'BorderHorizontalOutlined',
|
|
898
|
-
text: e('split')
|
|
899
907
|
}
|
|
900
908
|
]
|
|
901
909
|
}
|
|
@@ -991,7 +999,6 @@ clear\r`
|
|
|
991
999
|
}
|
|
992
1000
|
|
|
993
1001
|
initTerminal = async () => {
|
|
994
|
-
const { id } = this.state
|
|
995
1002
|
// let {password, privateKey, host} = this.props.tab
|
|
996
1003
|
const { themeConfig, tab = {}, config = {} } = this.props
|
|
997
1004
|
const term = new Terminal({
|
|
@@ -1013,9 +1020,9 @@ clear\r`
|
|
|
1013
1020
|
// term.onTitleChange(this.onTitleChange)
|
|
1014
1021
|
term.parent = this
|
|
1015
1022
|
term.onSelectionChange(this.onSelection)
|
|
1016
|
-
term.open(document.getElementById(
|
|
1023
|
+
term.open(document.getElementById(this.getDomId()), true)
|
|
1017
1024
|
this.loadRenderer(term, config)
|
|
1018
|
-
term.textarea.addEventListener('
|
|
1025
|
+
term.textarea.addEventListener('click', this.setActive)
|
|
1019
1026
|
// term.onKey(this.onKey)
|
|
1020
1027
|
// term.textarea.addEventListener('blur', this.onBlur)
|
|
1021
1028
|
|
|
@@ -1040,9 +1047,11 @@ clear\r`
|
|
|
1040
1047
|
}
|
|
1041
1048
|
|
|
1042
1049
|
setActive = () => {
|
|
1043
|
-
this.props.
|
|
1050
|
+
const name = `currentTabId${this.props.batch}`
|
|
1051
|
+
const tabId = this.props.tab.id
|
|
1044
1052
|
window.store.storeAssign({
|
|
1045
|
-
|
|
1053
|
+
currentTabId: tabId,
|
|
1054
|
+
[name]: tabId
|
|
1046
1055
|
})
|
|
1047
1056
|
}
|
|
1048
1057
|
|
|
@@ -1124,13 +1133,14 @@ clear\r`
|
|
|
1124
1133
|
keywords = [],
|
|
1125
1134
|
server = ''
|
|
1126
1135
|
} = config
|
|
1127
|
-
const { sessionId,
|
|
1136
|
+
const { sessionId, logName } = this.props
|
|
1128
1137
|
const tab = window.store.applyProfileToTabs(deepCopy(this.props.tab || {}))
|
|
1129
1138
|
const {
|
|
1130
1139
|
srcId, from = 'bookmarks',
|
|
1131
1140
|
type,
|
|
1132
1141
|
term: terminalType,
|
|
1133
|
-
displayRaw
|
|
1142
|
+
displayRaw,
|
|
1143
|
+
id
|
|
1134
1144
|
} = tab
|
|
1135
1145
|
const { savePassword } = this.state
|
|
1136
1146
|
const isSshConfig = type === terminalSshConfigType
|
|
@@ -1161,8 +1171,8 @@ clear\r`
|
|
|
1161
1171
|
keepaliveInterval: tab.keepaliveInterval === undefined ? config.keepaliveInterval : tab.keepaliveInterval,
|
|
1162
1172
|
sessionId,
|
|
1163
1173
|
tabId: id,
|
|
1174
|
+
uid: id,
|
|
1164
1175
|
srcTabId: tab.id,
|
|
1165
|
-
terminalIndex,
|
|
1166
1176
|
termType,
|
|
1167
1177
|
readyTimeout: config.sshReadyTimeout,
|
|
1168
1178
|
proxy: getProxy(tab, config),
|
|
@@ -1170,14 +1180,13 @@ clear\r`
|
|
|
1170
1180
|
? typeMap.remote
|
|
1171
1181
|
: typeMap.local
|
|
1172
1182
|
})
|
|
1173
|
-
|
|
1174
|
-
let pid = await createTerm(opts)
|
|
1183
|
+
let r = await createTerm(opts)
|
|
1175
1184
|
.catch(err => {
|
|
1176
1185
|
const text = err.message
|
|
1177
1186
|
handleErr({ message: text })
|
|
1178
1187
|
})
|
|
1179
|
-
|
|
1180
|
-
if (
|
|
1188
|
+
r = r || ''
|
|
1189
|
+
if (r.includes('fail')) {
|
|
1181
1190
|
return this.promote()
|
|
1182
1191
|
}
|
|
1183
1192
|
if (savePassword) {
|
|
@@ -1186,24 +1195,18 @@ clear\r`
|
|
|
1186
1195
|
this.setState({
|
|
1187
1196
|
loading: false
|
|
1188
1197
|
})
|
|
1189
|
-
if (!
|
|
1198
|
+
if (!r) {
|
|
1190
1199
|
this.setStatus(statusMap.error)
|
|
1191
1200
|
return
|
|
1192
1201
|
}
|
|
1193
1202
|
this.setStatus(statusMap.success)
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
})
|
|
1197
|
-
term.pid = pid
|
|
1198
|
-
this.pid = pid
|
|
1199
|
-
this.setState({
|
|
1200
|
-
pid
|
|
1201
|
-
})
|
|
1203
|
+
term.pid = id
|
|
1204
|
+
this.pid = id
|
|
1202
1205
|
const hs = server
|
|
1203
1206
|
? server.replace(/https?:\/\//, '')
|
|
1204
1207
|
: `${host}:${port}`
|
|
1205
1208
|
const pre = server.startsWith('https') ? 'wss' : 'ws'
|
|
1206
|
-
const wsUrl = `${pre}://${hs}/terminals/${
|
|
1209
|
+
const wsUrl = `${pre}://${hs}/terminals/${id}?sessionId=${sessionId}&token=${tokenElecterm}`
|
|
1207
1210
|
const socket = new WebSocket(wsUrl)
|
|
1208
1211
|
socket.onclose = this.oncloseSocket
|
|
1209
1212
|
socket.onerror = this.onerrorSocket
|
|
@@ -1268,7 +1271,7 @@ clear\r`
|
|
|
1268
1271
|
return false
|
|
1269
1272
|
}
|
|
1270
1273
|
if (this.userTypeExit) {
|
|
1271
|
-
return this.props.
|
|
1274
|
+
return this.props.delTab(this.props.tab.id)
|
|
1272
1275
|
}
|
|
1273
1276
|
const key = `open${Date.now()}`
|
|
1274
1277
|
function closeMsg () {
|
|
@@ -1285,7 +1288,7 @@ clear\r`
|
|
|
1285
1288
|
type='primary'
|
|
1286
1289
|
onClick={() => {
|
|
1287
1290
|
closeMsg()
|
|
1288
|
-
this.props.
|
|
1291
|
+
this.props.delTab(this.props.tab.id)
|
|
1289
1292
|
}}
|
|
1290
1293
|
>
|
|
1291
1294
|
{e('close')}
|
|
@@ -1331,7 +1334,10 @@ clear\r`
|
|
|
1331
1334
|
isRemote: this.isRemote(),
|
|
1332
1335
|
isActive: this.isActiveTerminal()
|
|
1333
1336
|
}
|
|
1334
|
-
|
|
1337
|
+
window.store.setState(
|
|
1338
|
+
'terminalInfoProps',
|
|
1339
|
+
infoProps
|
|
1340
|
+
)
|
|
1335
1341
|
}
|
|
1336
1342
|
|
|
1337
1343
|
// getPwd = async () => {
|
|
@@ -1354,13 +1360,17 @@ clear\r`
|
|
|
1354
1360
|
}
|
|
1355
1361
|
|
|
1356
1362
|
render () {
|
|
1357
|
-
const {
|
|
1358
|
-
const { height, width, left, top
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
'
|
|
1363
|
-
|
|
1363
|
+
const { loading } = this.state
|
|
1364
|
+
const { height, width, left, top } = this.props
|
|
1365
|
+
const { id } = this.props.tab
|
|
1366
|
+
const isActive = this.isActiveTerminal()
|
|
1367
|
+
const cls = classnames(
|
|
1368
|
+
'term-wrap',
|
|
1369
|
+
'tw-' + id,
|
|
1370
|
+
{
|
|
1371
|
+
'terminal-not-active': !isActive
|
|
1372
|
+
}
|
|
1373
|
+
)
|
|
1364
1374
|
const prps1 = {
|
|
1365
1375
|
className: cls,
|
|
1366
1376
|
style: {
|
|
@@ -1368,7 +1378,7 @@ clear\r`
|
|
|
1368
1378
|
width,
|
|
1369
1379
|
left,
|
|
1370
1380
|
top,
|
|
1371
|
-
zIndex:
|
|
1381
|
+
zIndex: 10
|
|
1372
1382
|
},
|
|
1373
1383
|
onDrop: this.onDrop
|
|
1374
1384
|
}
|
|
@@ -1378,8 +1388,9 @@ clear\r`
|
|
|
1378
1388
|
// id: `${id}-file-sel`,
|
|
1379
1389
|
// className: 'hide'
|
|
1380
1390
|
// }
|
|
1381
|
-
const
|
|
1382
|
-
|
|
1391
|
+
const prps3 = {
|
|
1392
|
+
id: this.getDomId(),
|
|
1393
|
+
className: 'absolute term-wrap-2',
|
|
1383
1394
|
style: {
|
|
1384
1395
|
left: '10px',
|
|
1385
1396
|
top: '10px',
|
|
@@ -1387,31 +1398,17 @@ clear\r`
|
|
|
1387
1398
|
bottom: 0
|
|
1388
1399
|
}
|
|
1389
1400
|
}
|
|
1390
|
-
const prps3 = {
|
|
1391
|
-
id,
|
|
1392
|
-
className: 'absolute term-wrap-2',
|
|
1393
|
-
style: {
|
|
1394
|
-
left: 0,
|
|
1395
|
-
top: 0,
|
|
1396
|
-
height: '100%',
|
|
1397
|
-
width: '100%'
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
1401
|
return (
|
|
1401
1402
|
<div
|
|
1402
1403
|
{...prps1}
|
|
1403
1404
|
>
|
|
1404
1405
|
<div
|
|
1405
|
-
{...
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
lines={this.state.lines}
|
|
1412
|
-
close={this.closeNormalBuffer}
|
|
1413
|
-
/>
|
|
1414
|
-
</div>
|
|
1406
|
+
{...prps3}
|
|
1407
|
+
/>
|
|
1408
|
+
<NormalBuffer
|
|
1409
|
+
lines={this.state.lines}
|
|
1410
|
+
close={this.closeNormalBuffer}
|
|
1411
|
+
/>
|
|
1415
1412
|
<Spin className='loading-wrapper' spinning={loading} />
|
|
1416
1413
|
</div>
|
|
1417
1414
|
)
|