@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.
Files changed (104) hide show
  1. package/client/common/constants.js +57 -7
  2. package/client/common/new-terminal.js +2 -2
  3. package/client/components/auth/login.jsx +34 -57
  4. package/client/components/batch-op/batch-op.jsx +12 -11
  5. package/client/components/bookmark-form/index.jsx +2 -2
  6. package/client/components/bookmark-form/ssh-form.jsx +4 -1
  7. package/client/components/bookmark-form/tree-delete.jsx +5 -5
  8. package/client/components/context-menu/boomarks.jsx +8 -12
  9. package/client/components/context-menu/context-menu.jsx +10 -10
  10. package/client/components/context-menu/history.jsx +21 -24
  11. package/client/components/context-menu/menu-btn.jsx +11 -11
  12. package/client/components/context-menu/tabs.jsx +15 -19
  13. package/client/components/context-menu/zoom.jsx +25 -29
  14. package/client/components/footer/footer-entry.jsx +56 -56
  15. package/client/components/icons/split-icons.jsx +77 -0
  16. package/client/components/layout/layout-alg.js +260 -0
  17. package/client/components/layout/layout-item.jsx +94 -0
  18. package/client/components/layout/layout.jsx +167 -0
  19. package/client/components/layout/layout.styl +8 -0
  20. package/client/components/layout/layouts.jsx +72 -0
  21. package/client/components/layout/session-size-alg.js +31 -0
  22. package/client/components/main/custom-css.jsx +1 -1
  23. package/client/components/main/main.jsx +184 -110
  24. package/client/components/main/ui-theme.jsx +1 -1
  25. package/client/components/main/wrapper.styl +2 -4
  26. package/client/components/profile/profile-list.jsx +1 -3
  27. package/client/components/profile/profile-transport-mod.jsx +1 -1
  28. package/client/components/profile/profile-transport.jsx +6 -9
  29. package/client/components/quick-commands/quick-command-transport.jsx +6 -9
  30. package/client/components/quick-commands/quick-commands-box.jsx +144 -153
  31. package/client/components/quick-commands/quick-commands-select.jsx +10 -3
  32. package/client/components/rdp/rdp-session.jsx +3 -23
  33. package/client/components/rdp/resolution-edit.jsx +40 -42
  34. package/client/components/session/session.jsx +63 -328
  35. package/client/components/session/session.styl +1 -5
  36. package/client/components/session/sessions.jsx +140 -111
  37. package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
  38. package/client/components/setting-panel/setting-common.jsx +6 -4
  39. package/client/components/setting-panel/setting-modal.jsx +31 -31
  40. package/client/components/setting-panel/start-session-select.jsx +4 -4
  41. package/client/components/setting-panel/tab-settings.jsx +27 -5
  42. package/client/components/setting-sync/data-import.jsx +36 -39
  43. package/client/components/setting-sync/setting-sync-form.jsx +10 -10
  44. package/client/components/setting-sync/setting-sync.jsx +50 -52
  45. package/client/components/sftp/address-bookmark.jsx +57 -58
  46. package/client/components/sftp/confirm-modal-store.jsx +34 -40
  47. package/client/components/sftp/file-item.jsx +14 -3
  48. package/client/components/sftp/file-mode-modal.jsx +3 -0
  49. package/client/components/sftp/list-table-ui.jsx +4 -4
  50. package/client/components/sftp/sftp-entry.jsx +2 -2
  51. package/client/components/sftp/transfer-conflict-store.jsx +13 -17
  52. package/client/components/sftp/transport-action-store.jsx +38 -31
  53. package/client/components/sftp/transports-action-store.jsx +3 -3
  54. package/client/components/sftp/transports-ui-store.jsx +18 -23
  55. package/client/components/shortcuts/shortcut-handler.js +1 -0
  56. package/client/components/shortcuts/shortcuts-defaults.js +5 -5
  57. package/client/components/shortcuts/shortcuts.jsx +9 -12
  58. package/client/components/side-panel-r/right-side-panel.styl +40 -0
  59. package/client/components/side-panel-r/side-panel-r.jsx +102 -0
  60. package/client/components/sidebar/bookmark-select.jsx +40 -40
  61. package/client/components/sidebar/bookmark.jsx +63 -65
  62. package/client/components/sidebar/history.jsx +53 -50
  63. package/client/components/sidebar/index.jsx +195 -184
  64. package/client/components/sidebar/info-modal.jsx +202 -202
  65. package/client/components/sidebar/sidebar.styl +8 -2
  66. package/client/components/sidebar/transfer-history-modal.jsx +95 -100
  67. package/client/components/sidebar/transfer-list-control.jsx +2 -2
  68. package/client/components/sidebar/transfer-list.jsx +45 -42
  69. package/client/components/sidebar/transfer-modal.jsx +49 -52
  70. package/client/components/sidebar/transport-ui.jsx +1 -1
  71. package/client/components/tabs/index.jsx +261 -49
  72. package/client/components/tabs/tab.jsx +48 -66
  73. package/client/components/tabs/tabs.styl +6 -1
  74. package/client/components/tabs/window-control.jsx +46 -48
  75. package/client/components/terminal/attach-addon-custom.js +1 -1
  76. package/client/components/terminal/index.jsx +111 -113
  77. package/client/components/terminal/term-search.jsx +26 -24
  78. package/client/components/terminal-info/run-cmd.jsx +0 -25
  79. package/client/components/terminal-info/terminal-info.jsx +60 -0
  80. package/client/components/terminal-info/terminal-info.styl +1 -1
  81. package/client/components/tree-list/bookmark-transport.jsx +8 -9
  82. package/client/components/tree-list/tree-list.jsx +36 -26
  83. package/client/components/vnc/vnc-session.jsx +1 -6
  84. package/client/components/web/address-bar.jsx +50 -0
  85. package/client/components/web/web-session.jsx +32 -10
  86. package/client/entry/index.jsx +5 -6
  87. package/client/store/common.js +1 -1
  88. package/client/store/db-upgrade.js +1 -1
  89. package/client/store/event.js +2 -2
  90. package/client/store/index.js +21 -32
  91. package/client/store/init-state.js +15 -3
  92. package/client/store/load-data.js +1 -1
  93. package/client/store/quick-command.js +4 -4
  94. package/client/store/session.js +1 -1
  95. package/client/store/setting.js +10 -6
  96. package/client/store/system-menu.js +1 -10
  97. package/client/store/tab.js +91 -1
  98. package/client/store/transfer-list.js +5 -6
  99. package/client/store/watch.js +11 -6
  100. package/package.json +1 -1
  101. package/client/components/common/react-subx.jsx +0 -1
  102. package/client/components/common/resize-wrap.jsx +0 -222
  103. package/client/components/common/resize-wrap.styl +0 -9
  104. 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 { Component } from '../common/react-subx'
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 class WindowControl extends Component {
14
- render () {
15
- const {
16
- isMaximized,
17
- config
18
- } = this.props.store
19
- if (config.useSystemTitleBar || isMacJs) {
20
- return null
21
- }
22
- const minimize = () => {
23
- window.pre.runGlobalAsync('minimize')
24
- }
25
- const maximize = () => {
26
- window.pre.runGlobalAsync('maximize')
27
- }
28
- const unmaximize = () => {
29
- window.pre.runGlobalAsync('unmaximize')
30
- }
31
- const closeApp = () => {
32
- window.store.exit()
33
- }
34
- return (
35
- <div className='window-controls'>
36
- <div className='window-control-box window-control-minimize' onClick={minimize}>
37
- <MinusOutlined title={e('minimize')} className='iblock font12 widnow-control-icon' />
38
- </div>
39
- <div
40
- className='window-control-box window-control-maximize'
41
- onClick={
42
- isMaximized ? unmaximize : maximize
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
+ })
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * customize AttachAddon
3
3
  */
4
- import { AttachAddon } from 'xterm-addon-attach'
4
+ import { AttachAddon } from '@xterm/addon-attach'
5
5
  import regEscape from 'escape-string-regexp'
6
6
 
7
7
  export default class AttachAddonCustom extends AttachAddon {
@@ -31,24 +31,24 @@ import {
31
31
  } from '../../common/constants'
32
32
  import deepCopy from 'json-deep-copy'
33
33
  import { readClipboardAsync, copy } from '../../common/clipboard'
34
- import { FitAddon } from 'xterm-addon-fit'
34
+ import { FitAddon } from '@xterm/addon-fit'
35
35
  import AttachAddon from './attach-addon-custom'
36
- import { SearchAddon } from 'xterm-addon-search'
37
- import { WebLinksAddon } from 'xterm-addon-web-links'
38
- import { CanvasAddon } from 'xterm-addon-canvas'
39
- import { WebglAddon } from 'xterm-addon-webgl'
40
- import { LigaturesAddon } from 'xterm-addon-ligatures'
36
+ import { SearchAddon } from '@xterm/addon-search'
37
+ import { WebLinksAddon } from '@xterm/addon-web-links'
38
+ import { CanvasAddon } from '@xterm/addon-canvas'
39
+ import { WebglAddon } from '@xterm/addon-webgl'
40
+ import { LigaturesAddon } from '@xterm/addon-ligatures'
41
41
  import getProxy from '../../common/get-proxy'
42
42
  import { AddonZmodem } from './xterm-zmodem'
43
- import { Unicode11Addon } from 'xterm-addon-unicode11'
43
+ import { Unicode11Addon } from '@xterm/addon-unicode11'
44
44
  import keyControlPressed from '../../common/key-control-pressed'
45
- import { Terminal } from 'xterm'
45
+ import { Terminal } from '@xterm/xterm'
46
46
  import NormalBuffer from './normal-buffer'
47
47
  import { createTerm, resizeTerm } from './terminal-apis'
48
48
  import { shortcutExtend, shortcutDescExtend } from '../shortcuts/shortcut-handler.js'
49
49
  import { KeywordHighlighterAddon } from './highlight-addon.js'
50
50
  import { getLocalFileInfo } from '../sftp/file-read.js'
51
- import { SerializeAddon } from 'xterm-addon-serialize'
51
+ import { SerializeAddon } from '@xterm/addon-serialize'
52
52
  import strip from '@electerm/strip-ansi'
53
53
  import { formatBytes } from '../../common/byte-format.js'
54
54
  import * as fs from './fs.js'
@@ -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
- delete this.term.parent
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
- delete this.socket
169
+ this.socket = null
170
170
  }
171
171
  if (this.term) {
172
172
  this.term.dispose()
173
- delete this.term
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
- delete this.dom
183
- delete this.attachAddon
184
- delete this.fitAddon
185
- delete this.zmodemAddon
186
- delete this.searchAddon
187
- delete this.serializeAddon
188
- delete this.fitAddon
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 { id } = this.state
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.activeSplitId &&
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
- activeSplitId,
328
+ currentTabId,
327
329
  pid,
328
330
  toAll,
329
331
  inputOnly,
330
332
  zoomValue
331
333
  } = e?.data || {}
332
334
 
333
- const { id: propSplitId } = this.props
334
- const { pid: statePid } = this.state
335
+ const { id: currentTabIdProp } = this.props.tab
336
+ const tabIdMatch = currentTabId === currentTabIdProp
335
337
  if (
336
338
  action === terminalActions.zoom &&
337
- propSplitId === activeSplitId
339
+ tabIdMatch
338
340
  ) {
339
341
  this.zoom(zoomValue)
340
342
  } else if (
341
343
  action === terminalActions.changeEncode &&
342
- propSplitId === activeSplitId
344
+ tabIdMatch
343
345
  ) {
344
346
  this.switchEncoding(encode)
345
347
  } else if (
346
348
  action === terminalActions.batchInput &&
347
349
  (
348
- toAll || propSplitId === activeSplitId
350
+ toAll || tabIdMatch
349
351
  )
350
352
  ) {
351
353
  this.batchInput(cmd)
352
354
  } else if (
353
355
  action === terminalActions.showInfoPanel &&
354
356
  (
355
- propSplitId === activeSplitId
357
+ tabIdMatch
356
358
  )
357
359
  ) {
358
360
  this.handleShowInfo()
359
361
  } else if (
360
362
  action === terminalActions.quickCommand &&
361
363
  (
362
- propSplitId === activeSplitId
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
- propSplitId === activeSplitId
376
+ tabIdMatch
375
377
  )
376
378
  ) {
377
379
  this.toggleSearch()
378
380
  } else if (
379
381
  action === terminalActions.doSearchNext &&
380
382
  (
381
- propSplitId === activeSplitId
383
+ tabIdMatch
382
384
  )
383
385
  ) {
384
386
  this.searchNext(keyword, options)
385
387
  } else if (
386
388
  action === terminalActions.doSearchPrev &&
387
389
  (
388
- propSplitId === activeSplitId
390
+ tabIdMatch
389
391
  )
390
392
  ) {
391
393
  this.searchPrev(keyword, options)
392
394
  } else if (
393
395
  action === terminalActions.clearSearch &&
394
396
  (
395
- propSplitId === activeSplitId
397
+ tabIdMatch
396
398
  )
397
399
  ) {
398
400
  this.searchAddon.clearDecorations()
399
401
  } else if (
400
402
  action === commonActions.getTermLogState &&
401
- pid === statePid
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: statePid
411
+ pid: currentTabIdProp
410
412
  })
411
413
  } else if (
412
414
  action === commonActions.setTermLogState &&
413
- pid === statePid
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
- delete this.zmodemSavePath
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
- delete this.xfer
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
- delete this.zsession
733
+ this.zsession = null
733
734
  this.term.focus()
734
735
  this.term.write('\r\n')
735
736
  this.onZmodem = false
736
- delete this.downloadFd
737
- delete this.downloadPath
738
- delete this.downloadCount
739
- delete this.downloadSize
740
- delete this.DownloadCache
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(id), true)
1023
+ term.open(document.getElementById(this.getDomId()), true)
1017
1024
  this.loadRenderer(term, config)
1018
- term.textarea.addEventListener('focus', this.setActive)
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.setActive(this.props.id)
1050
+ const name = `currentTabId${this.props.batch}`
1051
+ const tabId = this.props.tab.id
1044
1052
  window.store.storeAssign({
1045
- activeTerminalId: this.props.id
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, terminalIndex, id, logName } = this.props
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
- delete opts.terminals
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
- pid = pid || ''
1180
- if (pid.includes('fail')) {
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 (!pid) {
1198
+ if (!r) {
1190
1199
  this.setStatus(statusMap.error)
1191
1200
  return
1192
1201
  }
1193
1202
  this.setStatus(statusMap.success)
1194
- this.props.setSessionState({
1195
- pid
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/${pid}?sessionId=${sessionId}&token=${tokenElecterm}`
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
@@ -1234,6 +1237,7 @@ clear\r`
1234
1237
  new KeywordHighlighterAddon(keywords)
1235
1238
  )
1236
1239
  window.store.triggerResize()
1240
+ window.store.focus()
1237
1241
  }
1238
1242
 
1239
1243
  onResize = throttle(() => {
@@ -1268,7 +1272,7 @@ clear\r`
1268
1272
  return false
1269
1273
  }
1270
1274
  if (this.userTypeExit) {
1271
- return this.props.delSplit(this.state.id)
1275
+ return this.props.delTab(this.props.tab.id)
1272
1276
  }
1273
1277
  const key = `open${Date.now()}`
1274
1278
  function closeMsg () {
@@ -1285,7 +1289,7 @@ clear\r`
1285
1289
  type='primary'
1286
1290
  onClick={() => {
1287
1291
  closeMsg()
1288
- this.props.delSplit(this.state.id)
1292
+ this.props.delTab(this.props.tab.id)
1289
1293
  }}
1290
1294
  >
1291
1295
  {e('close')}
@@ -1331,7 +1335,10 @@ clear\r`
1331
1335
  isRemote: this.isRemote(),
1332
1336
  isActive: this.isActiveTerminal()
1333
1337
  }
1334
- this.props.handleShowInfo(infoProps)
1338
+ window.store.setState(
1339
+ 'terminalInfoProps',
1340
+ infoProps
1341
+ )
1335
1342
  }
1336
1343
 
1337
1344
  // getPwd = async () => {
@@ -1354,13 +1361,17 @@ clear\r`
1354
1361
  }
1355
1362
 
1356
1363
  render () {
1357
- const { id, loading } = this.state
1358
- const { height, width, left, top, position, id: pid, activeSplitId } = this.props
1359
- const cls = classnames('term-wrap', {
1360
- 'not-first-term': !!position
1361
- }, 'tw-' + pid, {
1362
- 'terminal-not-active': activeSplitId !== pid
1363
- })
1364
+ const { loading } = this.state
1365
+ const { height, width, left, top } = this.props
1366
+ const { id } = this.props.tab
1367
+ const isActive = this.isActiveTerminal()
1368
+ const cls = classnames(
1369
+ 'term-wrap',
1370
+ 'tw-' + id,
1371
+ {
1372
+ 'terminal-not-active': !isActive
1373
+ }
1374
+ )
1364
1375
  const prps1 = {
1365
1376
  className: cls,
1366
1377
  style: {
@@ -1368,7 +1379,7 @@ clear\r`
1368
1379
  width,
1369
1380
  left,
1370
1381
  top,
1371
- zIndex: position / 10
1382
+ zIndex: 10
1372
1383
  },
1373
1384
  onDrop: this.onDrop
1374
1385
  }
@@ -1378,8 +1389,9 @@ clear\r`
1378
1389
  // id: `${id}-file-sel`,
1379
1390
  // className: 'hide'
1380
1391
  // }
1381
- const prps2 = {
1382
- className: 'absolute term-wrap-1',
1392
+ const prps3 = {
1393
+ id: this.getDomId(),
1394
+ className: 'absolute term-wrap-2',
1383
1395
  style: {
1384
1396
  left: '10px',
1385
1397
  top: '10px',
@@ -1387,31 +1399,17 @@ clear\r`
1387
1399
  bottom: 0
1388
1400
  }
1389
1401
  }
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
1402
  return (
1401
1403
  <div
1402
1404
  {...prps1}
1403
1405
  >
1404
1406
  <div
1405
- {...prps2}
1406
- >
1407
- <div
1408
- {...prps3}
1409
- />
1410
- <NormalBuffer
1411
- lines={this.state.lines}
1412
- close={this.closeNormalBuffer}
1413
- />
1414
- </div>
1407
+ {...prps3}
1408
+ />
1409
+ <NormalBuffer
1410
+ lines={this.state.lines}
1411
+ close={this.closeNormalBuffer}
1412
+ />
1415
1413
  <Spin className='loading-wrapper' spinning={loading} />
1416
1414
  </div>
1417
1415
  )