@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.
Files changed (96) 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 +26 -0
  18. package/client/components/layout/layout.jsx +167 -0
  19. package/client/components/layout/layout.styl +5 -0
  20. package/client/components/layout/layouts.jsx +71 -0
  21. package/client/components/layout/session-size-alg.js +31 -0
  22. package/client/components/main/main.jsx +183 -109
  23. package/client/components/main/wrapper.styl +2 -4
  24. package/client/components/profile/profile-list.jsx +1 -3
  25. package/client/components/profile/profile-transport-mod.jsx +1 -1
  26. package/client/components/profile/profile-transport.jsx +6 -9
  27. package/client/components/quick-commands/quick-command-transport.jsx +6 -9
  28. package/client/components/quick-commands/quick-commands-box.jsx +144 -153
  29. package/client/components/quick-commands/quick-commands-select.jsx +10 -3
  30. package/client/components/rdp/rdp-session.jsx +3 -23
  31. package/client/components/rdp/resolution-edit.jsx +40 -42
  32. package/client/components/session/session.jsx +62 -317
  33. package/client/components/session/session.styl +1 -5
  34. package/client/components/session/sessions.jsx +99 -105
  35. package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
  36. package/client/components/setting-panel/setting-common.jsx +6 -4
  37. package/client/components/setting-panel/setting-modal.jsx +31 -31
  38. package/client/components/setting-panel/start-session-select.jsx +4 -4
  39. package/client/components/setting-panel/tab-settings.jsx +27 -5
  40. package/client/components/setting-sync/data-import.jsx +36 -39
  41. package/client/components/setting-sync/setting-sync-form.jsx +9 -9
  42. package/client/components/setting-sync/setting-sync.jsx +50 -52
  43. package/client/components/sftp/address-bookmark.jsx +57 -58
  44. package/client/components/sftp/confirm-modal-store.jsx +34 -40
  45. package/client/components/sftp/file-item.jsx +14 -3
  46. package/client/components/sftp/file-mode-modal.jsx +3 -0
  47. package/client/components/sftp/list-table-ui.jsx +4 -4
  48. package/client/components/sftp/sftp-entry.jsx +2 -2
  49. package/client/components/sftp/transfer-conflict-store.jsx +13 -17
  50. package/client/components/sftp/transport-action-store.jsx +38 -31
  51. package/client/components/sftp/transports-action-store.jsx +3 -3
  52. package/client/components/sftp/transports-ui-store.jsx +18 -23
  53. package/client/components/shortcuts/shortcut-handler.js +1 -0
  54. package/client/components/shortcuts/shortcuts.jsx +9 -12
  55. package/client/components/side-panel-r/right-side-panel.styl +40 -0
  56. package/client/components/side-panel-r/side-panel-r.jsx +102 -0
  57. package/client/components/sidebar/bookmark-select.jsx +40 -40
  58. package/client/components/sidebar/bookmark.jsx +63 -65
  59. package/client/components/sidebar/history.jsx +53 -50
  60. package/client/components/sidebar/index.jsx +195 -184
  61. package/client/components/sidebar/info-modal.jsx +202 -202
  62. package/client/components/sidebar/sidebar.styl +8 -2
  63. package/client/components/sidebar/transfer-history-modal.jsx +95 -100
  64. package/client/components/sidebar/transfer-list-control.jsx +2 -2
  65. package/client/components/sidebar/transfer-list.jsx +45 -42
  66. package/client/components/sidebar/transfer-modal.jsx +49 -52
  67. package/client/components/sidebar/transport-ui.jsx +1 -1
  68. package/client/components/tabs/index.jsx +261 -49
  69. package/client/components/tabs/tab.jsx +60 -65
  70. package/client/components/tabs/tabs.styl +6 -1
  71. package/client/components/tabs/window-control.jsx +46 -48
  72. package/client/components/terminal/index.jsx +101 -104
  73. package/client/components/terminal/term-search.jsx +26 -24
  74. package/client/components/terminal-info/run-cmd.jsx +0 -25
  75. package/client/components/terminal-info/terminal-info.jsx +60 -0
  76. package/client/components/terminal-info/terminal-info.styl +1 -1
  77. package/client/components/tree-list/bookmark-transport.jsx +8 -9
  78. package/client/components/tree-list/tree-list.jsx +36 -26
  79. package/client/components/vnc/vnc-session.jsx +1 -6
  80. package/client/store/common.js +1 -1
  81. package/client/store/event.js +2 -2
  82. package/client/store/index.js +21 -32
  83. package/client/store/init-state.js +15 -3
  84. package/client/store/load-data.js +1 -1
  85. package/client/store/quick-command.js +4 -4
  86. package/client/store/session.js +1 -1
  87. package/client/store/setting.js +9 -5
  88. package/client/store/system-menu.js +1 -10
  89. package/client/store/tab.js +66 -1
  90. package/client/store/transfer-list.js +5 -6
  91. package/client/store/watch.js +11 -6
  92. package/package.json +1 -1
  93. package/client/components/common/react-subx.jsx +0 -1
  94. package/client/components/common/resize-wrap.jsx +0 -222
  95. package/client/components/common/resize-wrap.styl +0 -9
  96. package/client/components/terminal-info/content.jsx +0 -152
@@ -53,34 +53,34 @@ export default function SyncForm (props) {
53
53
  up[syncType + 'ApiUrl'] = 'https://electerm-cloud.html5beta.com/api/sync'
54
54
  // up[syncType + 'ApiUrl'] = 'http://127.0.0.1:5678/api/sync'
55
55
  }
56
- props.store.updateSyncSetting(up)
57
- const test = await props.store.testSyncToken(syncType, res.gistId)
56
+ window.store.updateSyncSetting(up)
57
+ const test = await window.store.testSyncToken(syncType, res.gistId)
58
58
  if (!test) {
59
59
  return notification.error({
60
60
  message: 'token invalid'
61
61
  })
62
62
  }
63
63
  if (!res.gistId && syncType !== syncTypes.custom && syncType !== syncTypes.cloud) {
64
- props.store.createGist(syncType)
64
+ window.store.createGist(syncType)
65
65
  }
66
66
  }
67
67
 
68
68
  function upload () {
69
- props
69
+ window
70
70
  .store
71
71
  .uploadSetting(props.syncType)
72
- .catch(props.store.onError)
72
+ .catch(window.store.onError)
73
73
  }
74
74
 
75
75
  function download () {
76
- props
76
+ window
77
77
  .store
78
78
  .downloadSetting(props.syncType)
79
- .catch(props.store.onError)
79
+ .catch(window.store.onError)
80
80
  }
81
81
 
82
82
  // onChangeAutoSync = checked => {
83
- // this.props.store.updateSyncSetting({
83
+ // this.window.store.updateSyncSetting({
84
84
  // autoSync: checked
85
85
  // })
86
86
  // }
@@ -273,7 +273,7 @@ export default function SyncForm (props) {
273
273
  </Button>
274
274
  <Button
275
275
  type='dashed'
276
- onClick={props.store.handleClearSyncSetting}
276
+ onClick={window.store.handleClearSyncSetting}
277
277
  disabled={disabled()}
278
278
  className='mg1r mg1b sync-btn-clear'
279
279
  icon={<ClearOutlined />}
@@ -1,30 +1,31 @@
1
1
  /**
2
2
  * sync setting module entry
3
3
  */
4
- import { Component } from '../common/react-subx'
4
+
5
5
  import { Tabs, Spin } from 'antd'
6
6
  import SyncForm from './setting-sync-form'
7
7
  import { syncTypes, syncDataMaps } from '../../common/constants'
8
- import { DataTransport } from './data-import'
8
+ import DataTransport from './data-import'
9
9
  import DataSelect from './data-select'
10
10
  import { pick } from 'lodash-es'
11
11
 
12
- export default class SyncSettingEntry extends Component {
13
- handleChange = (key) => {
14
- this.props.store.syncType = key
12
+ export default function SyncSettingEntry (props) {
13
+ const handleChange = (key) => {
14
+ window.store.syncType = key
15
15
  }
16
-
17
- renderForm () {
18
- const {
19
- store
20
- } = this.props
21
- const {
22
- syncSetting
23
- } = store.config
16
+ const {
17
+ config
18
+ } = props
19
+ const {
20
+ syncSetting
21
+ } = config
22
+ const {
23
+ store
24
+ } = window
25
+ function renderForm () {
24
26
  const syncProps = {
25
- store,
26
27
  ...syncSetting,
27
- ...pick(store, [
28
+ ...pick(props, [
28
29
  'autofocustrigger',
29
30
  'isSyncingSetting',
30
31
  'isSyncDownload',
@@ -32,7 +33,7 @@ export default class SyncSettingEntry extends Component {
32
33
  'syncType'
33
34
  ])
34
35
  }
35
- const type = store.syncType
36
+ const type = props.syncType
36
37
  const formData = {
37
38
  gistId: syncSetting[type + 'GistId'],
38
39
  token: syncSetting[type + 'AccessToken'],
@@ -51,42 +52,39 @@ export default class SyncSettingEntry extends Component {
51
52
  )
52
53
  }
53
54
 
54
- render () {
55
- const {
56
- store
57
- } = this.props
58
-
59
- const syncItems = Object.keys(syncTypes).map(type => {
60
- return {
61
- key: type,
62
- label: type,
63
- children: null
64
- }
65
- })
66
- const {
67
- dataSyncSelected
68
- } = store.config
69
- const arr = dataSyncSelected && dataSyncSelected !== 'all'
70
- ? dataSyncSelected.split(',')
71
- : Object.keys(syncDataMaps)
72
- const dataSelectProps = {
73
- dataSyncSelected: arr
55
+ const syncItems = Object.keys(syncTypes).map(type => {
56
+ return {
57
+ key: type,
58
+ label: type,
59
+ children: null
74
60
  }
75
- return (
76
- <div className='pd2l'>
77
- <DataTransport store={store} />
78
- <Spin spinning={store.isSyncingSetting}>
79
- <Tabs
80
- activeKey={store.syncType}
81
- onChange={this.handleChange}
82
- items={syncItems}
83
- />
84
- {
85
- this.renderForm()
86
- }
87
- <DataSelect {...dataSelectProps} />
88
- </Spin>
89
- </div>
90
- )
61
+ })
62
+ const {
63
+ dataSyncSelected
64
+ } = props.config
65
+ const arr = dataSyncSelected && dataSyncSelected !== 'all'
66
+ ? dataSyncSelected.split(',')
67
+ : Object.keys(syncDataMaps)
68
+ const dataSelectProps = {
69
+ dataSyncSelected: arr
70
+ }
71
+ const dataImportProps = {
72
+ config
91
73
  }
74
+ return (
75
+ <div className='pd2l'>
76
+ <DataTransport {...dataImportProps} />
77
+ <Spin spinning={store.isSyncingSetting}>
78
+ <Tabs
79
+ activeKey={store.syncType}
80
+ onChange={handleChange}
81
+ items={syncItems}
82
+ />
83
+ {
84
+ renderForm()
85
+ }
86
+ <DataSelect {...dataSelectProps} />
87
+ </Spin>
88
+ </div>
89
+ )
92
90
  }
@@ -1,4 +1,4 @@
1
- import { Component } from '../common/react-subx'
1
+ import { auto } from 'manate/react'
2
2
  import {
3
3
  StarOutlined,
4
4
  PlusSquareOutlined
@@ -11,16 +11,16 @@ import { typeMap } from '../../common/constants'
11
11
  import uid from '../../common/uid'
12
12
  import './address-bookmark.styl'
13
13
 
14
- export default class AddrBookmark extends Component {
15
- onDel = (item) => {
16
- this.props.store.delAddressBookmark(item)
14
+ export default auto(function AddrBookmark (props) {
15
+ function onDel (item) {
16
+ window.store.delAddressBookmark(item)
17
17
  }
18
18
 
19
- handleAddAddr = () => {
19
+ function handleAddAddr () {
20
20
  const {
21
- store, host, realPath, type
22
- } = this.props
23
- store.addAddressBookmark(
21
+ host, realPath, type
22
+ } = props
23
+ window.store.addAddressBookmark(
24
24
  {
25
25
  addr: realPath,
26
26
  host: type === typeMap.local ? '' : host,
@@ -29,55 +29,54 @@ export default class AddrBookmark extends Component {
29
29
  )
30
30
  }
31
31
 
32
- render () {
33
- const { type, onClickHistory, store, host } = this.props
34
- // const cls = classnames(
35
- // 'sftp-history',
36
- // 'animated',
37
- // `sftp-history-${type}`
38
- // )
39
- const addrs = type === typeMap.local
40
- ? store.addressBookmarksLocal
41
- : store.addressBookmarks.filter(
42
- g => g.host === host
43
- )
44
- const inner = addrs.length
45
- ? addrs.map(o => {
46
- return (
47
- <AddrBookmarkItem
48
- handleClick={onClickHistory}
49
- type={type}
50
- key={o.id}
51
- handleDel={this.onDel}
52
- item={o}
53
- />
54
- )
55
- })
56
- : null
57
- const content = (
58
- <div
59
- className='addr-bookmark-list'
60
- >
61
- {inner}
62
- </div>
32
+ const { type, onClickHistory, host } = props
33
+ const { store } = window
34
+ // const cls = classnames(
35
+ // 'sftp-history',
36
+ // 'animated',
37
+ // `sftp-history-${type}`
38
+ // )
39
+ const addrs = type === typeMap.local
40
+ ? store.addressBookmarksLocal
41
+ : store.addressBookmarks.filter(
42
+ g => g.host === host
63
43
  )
64
- const title = (
65
- <div>
66
- <PlusSquareOutlined
67
- className='add-addr-bookmark'
68
- onClick={this.handleAddAddr}
44
+ const inner = addrs.length
45
+ ? addrs.map(o => {
46
+ return (
47
+ <AddrBookmarkItem
48
+ handleClick={onClickHistory}
49
+ type={type}
50
+ key={o.id}
51
+ handleDel={onDel}
52
+ item={o}
69
53
  />
70
- </div>
71
- )
72
- return (
73
- <Popover
74
- content={content}
75
- title={title}
76
- placement='bottom'
77
- trigger='click'
78
- >
79
- <StarOutlined />
80
- </Popover>
81
- )
82
- }
83
- }
54
+ )
55
+ })
56
+ : null
57
+ const content = (
58
+ <div
59
+ className='addr-bookmark-list'
60
+ >
61
+ {inner}
62
+ </div>
63
+ )
64
+ const title = (
65
+ <div>
66
+ <PlusSquareOutlined
67
+ className='add-addr-bookmark'
68
+ onClick={handleAddAddr}
69
+ />
70
+ </div>
71
+ )
72
+ return (
73
+ <Popover
74
+ content={content}
75
+ title={title}
76
+ placement='bottom'
77
+ trigger='click'
78
+ >
79
+ <StarOutlined />
80
+ </Popover>
81
+ )
82
+ })
@@ -3,7 +3,6 @@
3
3
  *
4
4
  */
5
5
 
6
- import { Component } from '../common/react-subx'
7
6
  import { Modal, Button } from 'antd'
8
7
  import { isString } from 'lodash-es'
9
8
  import AnimateText from '../common/animate-text'
@@ -23,13 +22,10 @@ function formatTimeAuto (strOrDigit) {
23
22
  return formatTime(strOrDigit * 1000)
24
23
  }
25
24
 
26
- export default class ConfirmModalStore extends Component {
27
- act (action) {
28
- const { store } = this.props
29
- const {
30
- transferToConfirm
31
- } = store
32
- store.setState(
25
+ export default function ConfirmModalStore (props) {
26
+ function act (action) {
27
+ const { transferToConfirm } = props
28
+ window.store.setState(
33
29
  'transferToConfirm', {}
34
30
  )
35
31
  const {
@@ -48,10 +44,10 @@ export default class ConfirmModalStore extends Component {
48
44
  })
49
45
  }
50
46
 
51
- renderContent () {
47
+ function renderContent () {
52
48
  const {
53
49
  transferToConfirm
54
- } = this.props.store
50
+ } = props
55
51
  const {
56
52
  fromPath,
57
53
  toPath,
@@ -105,10 +101,10 @@ export default class ConfirmModalStore extends Component {
105
101
  )
106
102
  }
107
103
 
108
- renderFooter () {
104
+ function renderFooter () {
109
105
  const {
110
106
  transferToConfirm
111
- } = this.props.store
107
+ } = props
112
108
  if (!transferToConfirm) {
113
109
  return null
114
110
  }
@@ -122,21 +118,21 @@ export default class ConfirmModalStore extends Component {
122
118
  <Button
123
119
  type='dashed'
124
120
  className='mg1l'
125
- onClick={() => this.act(fileActions.cancel)}
121
+ onClick={() => act(fileActions.cancel)}
126
122
  >
127
123
  {e('cancel')}
128
124
  </Button>
129
125
  <Button
130
126
  type='dashed'
131
127
  className='mg1l'
132
- onClick={() => this.act(fileActions.skip)}
128
+ onClick={() => act(fileActions.skip)}
133
129
  >
134
130
  {e('skip')}
135
131
  </Button>
136
132
  <Button
137
133
  type='dashed'
138
134
  className='mg1l'
139
- onClick={() => this.act(fileActions.skipAll)}
135
+ onClick={() => act(fileActions.skipAll)}
140
136
  >
141
137
  {e('skipAll')}
142
138
  </Button>
@@ -144,7 +140,7 @@ export default class ConfirmModalStore extends Component {
144
140
  danger
145
141
  className='mg1l'
146
142
  onClick={
147
- () => this.act(fileActions.mergeOrOverwrite)
143
+ () => act(fileActions.mergeOrOverwrite)
148
144
  }
149
145
  >
150
146
  {isDirectory ? e('merge') : e('overwrite')}
@@ -153,7 +149,7 @@ export default class ConfirmModalStore extends Component {
153
149
  type='primary'
154
150
  className='mg1l'
155
151
  onClick={
156
- () => this.act(fileActions.rename)
152
+ () => act(fileActions.rename)
157
153
  }
158
154
  >
159
155
  {e('rename')}
@@ -169,7 +165,7 @@ export default class ConfirmModalStore extends Component {
169
165
  : e('overwriteDesc')
170
166
  }
171
167
  onClick={
172
- () => this.act(fileActions.mergeOrOverwriteAll)
168
+ () => act(fileActions.mergeOrOverwriteAll)
173
169
  }
174
170
  >
175
171
  {isDirectory ? e('mergeAll') : e('overwriteAll')}
@@ -179,7 +175,7 @@ export default class ConfirmModalStore extends Component {
179
175
  className='mg1l'
180
176
  title={e('renameDesc')}
181
177
  onClick={
182
- () => this.act(fileActions.renameAll)
178
+ () => act(fileActions.renameAll)
183
179
  }
184
180
  >
185
181
  {e('renameAll')}
@@ -189,26 +185,24 @@ export default class ConfirmModalStore extends Component {
189
185
  )
190
186
  }
191
187
 
192
- render () {
193
- const {
194
- transferToConfirm
195
- } = this.props.store
196
- if (!transferToConfirm.id) {
197
- return null
198
- }
199
- const modalProps = {
200
- open: true,
201
- width: 500,
202
- title: e('fileConflict'),
203
- footer: this.renderFooter(),
204
- onCancel: () => this.act(fileActions.cancel)
205
- }
206
- return (
207
- <Modal
208
- {...modalProps}
209
- >
210
- {this.renderContent()}
211
- </Modal>
212
- )
188
+ const {
189
+ transferToConfirm
190
+ } = props
191
+ if (!transferToConfirm.id) {
192
+ return null
193
+ }
194
+ const modalProps = {
195
+ open: true,
196
+ width: 500,
197
+ title: e('fileConflict'),
198
+ footer: renderFooter(),
199
+ onCancel: () => act(fileActions.cancel)
213
200
  }
201
+ return (
202
+ <Modal
203
+ {...modalProps}
204
+ >
205
+ {renderContent()}
206
+ </Modal>
207
+ )
214
208
  }
@@ -10,7 +10,7 @@ import {
10
10
  } from '@ant-design/icons'
11
11
  import classnames from 'classnames'
12
12
  import copy from 'json-deep-copy'
13
- import { pick, some, without } from 'lodash-es'
13
+ import { pick, some } from 'lodash-es'
14
14
  import Input from '../common/input-auto-focus'
15
15
  import resolve from '../../common/resolve'
16
16
  import { addClass, removeClass } from '../../common/class'
@@ -76,6 +76,9 @@ export default class FileSection extends React.Component {
76
76
 
77
77
  componentWillUnmount () {
78
78
  clearTimeout(this.timer)
79
+ this.timer = null
80
+ this.dom = null
81
+ this.dropTarget = null
79
82
  this.removeFileEditEvent()
80
83
  window.removeEventListener('message', this.changeFileMode)
81
84
  window.removeEventListener('message', this.onContextAction)
@@ -380,7 +383,7 @@ export default class FileSection extends React.Component {
380
383
  const { type } = this.props
381
384
  window.store.openFileInfoModal({
382
385
  file: this.state.file,
383
- tab: without(this.props.tab, 'terminals'),
386
+ tab: this.props.tab,
384
387
  visible: true,
385
388
  pid: this.props.pid,
386
389
  sessionId: this.props.sessionId,
@@ -507,6 +510,10 @@ export default class FileSection extends React.Component {
507
510
  file = {},
508
511
  action
509
512
  } = e.data || {}
513
+ if (action === commonActions.submitFileModeClose) {
514
+ window.removeEventListener('message', this.changeFileMode)
515
+ return false
516
+ }
510
517
  if (
511
518
  action !== commonActions.submitFileModeEdit ||
512
519
  file.id !== this.state.file.id
@@ -529,7 +536,7 @@ export default class FileSection extends React.Component {
529
536
  'message', this.changeFileMode
530
537
  )
531
538
  window.store.openFileModeModal({
532
- tab: without(this.props.tab, 'terminals'),
539
+ tab: this.props.tab,
533
540
  visible: true,
534
541
  uidTree: this.props[`${type}UidTree`],
535
542
  gidTree: this.props[`${type}GidTree`]
@@ -1092,6 +1099,10 @@ export default class FileSection extends React.Component {
1092
1099
  args = [],
1093
1100
  func
1094
1101
  } = e.data || {}
1102
+ if (action === commonActions.closeContextMenuAfter) {
1103
+ window.removeEventListener('message', this.onContextAction)
1104
+ return false
1105
+ }
1095
1106
  if (
1096
1107
  action !== commonActions.clickContextMenu ||
1097
1108
  id !== this.uid ||
@@ -83,6 +83,9 @@ export default class FileMode extends React.PureComponent {
83
83
  }
84
84
 
85
85
  onClose = () => {
86
+ postMessage({
87
+ action: commonActions.submitFileModeClose
88
+ })
86
89
  this.setStateProxy({
87
90
  file: {},
88
91
  data: {}
@@ -6,7 +6,7 @@
6
6
  * - click header to sort
7
7
  */
8
8
 
9
- import { Component } from '../common/react-subx'
9
+ import { PureComponent } from 'react'
10
10
  import classnames from 'classnames'
11
11
  import { isEqual, pick, find, isNull, isArray, isUndefined } from 'lodash-es'
12
12
  import generate from '../../common/uid'
@@ -31,7 +31,7 @@ import IconHolder from '../context-menu/icon-holder'
31
31
 
32
32
  const e = window.translate
33
33
 
34
- export default class FileListTable extends Component {
34
+ export default class FileListTable extends PureComponent {
35
35
  constructor (props) {
36
36
  super(props)
37
37
  this.state = {
@@ -162,7 +162,7 @@ export default class FileListTable extends Component {
162
162
  }
163
163
 
164
164
  getPropsDefault = () => {
165
- return this.props.store.config.filePropsEnabled || [
165
+ return this.props.config.filePropsEnabled || [
166
166
  'name',
167
167
  'size',
168
168
  'modifyTime'
@@ -275,7 +275,7 @@ export default class FileListTable extends Component {
275
275
  : [...names, name]
276
276
  const props = all.filter(g => newProps.includes(g))
277
277
  const update = this.initFromProps(props)
278
- this.props.store.setConfig({
278
+ window.store.setConfig({
279
279
  filePropsEnabled: props
280
280
  })
281
281
  this.setState(update)
@@ -117,8 +117,9 @@ export default class Sftp extends Component {
117
117
  componentWillUnmount () {
118
118
  this.destroyEvent()
119
119
  this.sftp && this.sftp.destroy()
120
- delete this.sftp
120
+ this.sftp = null
121
121
  clearTimeout(this.timer4)
122
+ this.timer4 = null
122
123
  }
123
124
 
124
125
  directions = [
@@ -624,7 +625,6 @@ export default class Sftp extends Component {
624
625
  proxy: getProxy(tab, config),
625
626
  ...sessionOptions
626
627
  })
627
- delete opts.terminals
628
628
  const r = await sftp.connect(opts)
629
629
  .catch(e => {
630
630
  if (
@@ -3,7 +3,7 @@
3
3
  * when list changes, do transfer and other op
4
4
  */
5
5
 
6
- import { Component } from '../common/react-subx'
6
+ import { PureComponent } from 'react'
7
7
  import { typeMap } from '../../common/constants'
8
8
  import {
9
9
  getLocalFileInfo,
@@ -16,7 +16,7 @@ import { findIndex, find } from 'lodash-es'
16
16
  import generate from '../../common/uid'
17
17
  import resolve from '../../common/resolve'
18
18
 
19
- export default class TransferConflictStore extends Component {
19
+ export default class TransferConflictStore extends PureComponent {
20
20
  state = {
21
21
  currentId: ''
22
22
  }
@@ -79,10 +79,8 @@ export default class TransferConflictStore extends Component {
79
79
  fromFile
80
80
  } = transfer
81
81
  this.clear()
82
- const { store } = this.props
83
- let {
84
- fileTransfers
85
- } = store
82
+ let { fileTransfers } = this.props
83
+ const { store } = window
86
84
  const index = findIndex(fileTransfers, d => d.id === id)
87
85
  if (index < 0) {
88
86
  return store.setFileTransfers(fileTransfers)
@@ -114,15 +112,13 @@ export default class TransferConflictStore extends Component {
114
112
  }
115
113
 
116
114
  tagTransferError = (id, errorMsg) => {
117
- const { store } = this.props
118
- const {
119
- fileTransfers
120
- } = store
115
+ const { fileTransfers } = this.props
121
116
  const tr = find(fileTransfers, d => d.id === id)
122
117
  if (!tr) {
123
118
  return
124
119
  }
125
- window.store.addTransferHistory({
120
+ const { store } = window
121
+ store.addTransferHistory({
126
122
  ...tr,
127
123
  host: tr.host,
128
124
  error: errorMsg,
@@ -136,7 +132,7 @@ export default class TransferConflictStore extends Component {
136
132
  }
137
133
 
138
134
  setConflict (tr) {
139
- if (window.store.transferToConfirm.id) {
135
+ if (this.props.transferToConfirm.id) {
140
136
  return
141
137
  }
142
138
  window.store.setState(
@@ -165,10 +161,10 @@ export default class TransferConflictStore extends Component {
165
161
  this.clear()
166
162
  const {
167
163
  store
168
- } = this.props
164
+ } = window
169
165
  const {
170
166
  fileTransfers
171
- } = store
167
+ } = this.props
172
168
  const index = findIndex(fileTransfers, t => {
173
169
  return t.id === tr.id
174
170
  })
@@ -178,7 +174,7 @@ export default class TransferConflictStore extends Component {
178
174
  fromFile
179
175
  }
180
176
  Object.assign(fileTransfers[index], up)
181
- } else {
177
+ } else if (fileTransfers[0]) {
182
178
  fileTransfers[0].r = Math.random()
183
179
  }
184
180
  store.setFileTransfers(fileTransfers)
@@ -189,10 +185,10 @@ export default class TransferConflictStore extends Component {
189
185
  }
190
186
 
191
187
  watchFile = async () => {
192
- const { store } = this.props
188
+ const { store } = window
193
189
  const {
194
190
  fileTransfers
195
- } = store
191
+ } = this.props
196
192
  if (!fileTransfers.length && this.currentId) {
197
193
  return this.clear()
198
194
  }