@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.
Files changed (104) hide show
  1. package/client/common/clipboard.js +1 -14
  2. package/client/common/constants.js +0 -43
  3. package/client/common/data-compare.js +55 -0
  4. package/client/common/default-setting.js +2 -10
  5. package/client/common/resolve.js +18 -22
  6. package/client/common/sftp.js +0 -3
  7. package/client/components/ai/ai-chat.jsx +30 -6
  8. package/client/components/ai/ai-config.jsx +17 -6
  9. package/client/components/batch-op/batch-op.jsx +3 -24
  10. package/client/components/bookmark-form/bookmark-group-tree-format.js +7 -9
  11. package/client/components/bookmark-form/form-ssh-common.jsx +0 -2
  12. package/client/components/bookmark-form/ssh-form.jsx +8 -41
  13. package/client/components/bookmark-form/tree-delete.jsx +6 -15
  14. package/client/components/common/animate-text.jsx +3 -4
  15. package/client/components/common/drag-handle.jsx +59 -45
  16. package/client/components/common/drag-handle.styl +2 -1
  17. package/client/components/common/input-auto-focus.jsx +29 -63
  18. package/client/components/common/ref.js +24 -0
  19. package/client/components/footer/batch-input.jsx +1 -6
  20. package/client/components/footer/footer-entry.jsx +13 -16
  21. package/client/components/footer/footer.styl +0 -5
  22. package/client/components/icons/ai-icon.jsx +17 -0
  23. package/client/components/icons/ai-icon.styl +3 -0
  24. package/client/components/layout/layout-item.jsx +14 -0
  25. package/client/components/main/main.jsx +8 -19
  26. package/client/components/main/upgrade.jsx +13 -25
  27. package/client/components/profile/profile-form-elem.jsx +1 -2
  28. package/client/components/quick-commands/on-drop.js +1 -12
  29. package/client/components/quick-commands/quick-command-transport-mod.jsx +3 -13
  30. package/client/components/quick-commands/quick-commands-form-elem.jsx +1 -2
  31. package/client/components/rdp/rdp-session.jsx +4 -4
  32. package/client/components/session/session.jsx +9 -11
  33. package/client/components/setting-panel/on-tree-drop.js +4 -35
  34. package/client/components/setting-panel/setting-common.jsx +4 -1
  35. package/client/components/setting-panel/setting-modal.jsx +7 -5
  36. package/client/components/setting-panel/tab-settings.jsx +0 -1
  37. package/client/components/setting-sync/setting-sync.jsx +0 -1
  38. package/client/components/sftp/address-bookmark-item.jsx +1 -15
  39. package/client/components/sftp/confirm-modal-store.jsx +2 -2
  40. package/client/components/sftp/{file-mode-modal.jsx → file-info-modal.jsx} +137 -37
  41. package/client/components/sftp/file-item.jsx +156 -192
  42. package/client/components/sftp/file-table-header.jsx +98 -0
  43. package/client/components/sftp/list-table-ui.jsx +125 -416
  44. package/client/components/sftp/sftp-entry.jsx +102 -128
  45. package/client/components/sftp/sftp.styl +6 -22
  46. package/client/components/sftp/transfer-conflict-store.jsx +8 -12
  47. package/client/components/sftp/transport-action-store.jsx +7 -15
  48. package/client/components/shortcuts/shortcut-control.jsx +72 -3
  49. package/client/components/shortcuts/shortcut-handler.js +0 -1
  50. package/client/components/side-panel-r/side-panel-r.jsx +7 -4
  51. package/client/components/sidebar/history.jsx +3 -0
  52. package/client/components/sidebar/index.jsx +1 -1
  53. package/client/components/sidebar/info-modal.jsx +3 -0
  54. package/client/components/sidebar/side-panel.jsx +7 -4
  55. package/client/components/sidebar/sidebar-panel.jsx +1 -1
  56. package/client/components/sidebar/sidebar.styl +3 -3
  57. package/client/components/sys-menu/icons-map.jsx +52 -0
  58. package/client/components/{context-menu → sys-menu}/menu-btn.jsx +33 -45
  59. package/client/components/sys-menu/sys-menu.jsx +163 -0
  60. package/client/components/{context-menu/context-menu.styl → sys-menu/sys-menu.styl} +2 -11
  61. package/client/components/tabs/index.jsx +5 -97
  62. package/client/components/tabs/tab.jsx +121 -73
  63. package/client/components/tabs/tabs.styl +4 -1
  64. package/client/components/terminal/term-search.jsx +16 -28
  65. package/client/components/terminal/terminal-interactive.jsx +0 -2
  66. package/client/components/terminal/{index.jsx → terminal.jsx} +110 -240
  67. package/client/components/terminal-info/base.jsx +21 -46
  68. package/client/components/terminal-info/terminal-info.jsx +3 -0
  69. package/client/components/text-editor/text-editor.jsx +38 -53
  70. package/client/components/theme/theme-form.jsx +0 -2
  71. package/client/components/tree-list/bookmark-toolbar.jsx +23 -47
  72. package/client/components/tree-list/bookmark-transport.jsx +2 -90
  73. package/client/components/tree-list/move-item-modal.jsx +101 -0
  74. package/client/components/tree-list/tree-list-item.jsx +6 -8
  75. package/client/components/tree-list/tree-list.jsx +48 -273
  76. package/client/components/vnc/vnc-session.jsx +5 -3
  77. package/client/store/app-upgrade.js +2 -5
  78. package/client/store/bookmark-group.js +74 -28
  79. package/client/store/common.js +36 -54
  80. package/client/store/event.js +4 -37
  81. package/client/store/init-state.js +9 -12
  82. package/client/store/item.js +34 -39
  83. package/client/store/load-data.js +5 -1
  84. package/client/store/quick-command.js +2 -12
  85. package/client/store/session.js +6 -7
  86. package/client/store/setting.js +3 -7
  87. package/client/store/sidebar.js +2 -8
  88. package/client/store/store.js +0 -20
  89. package/client/store/system-menu.js +1 -2
  90. package/client/store/tab.js +29 -1
  91. package/client/store/terminal-theme.js +0 -4
  92. package/client/store/watch.js +26 -4
  93. package/package.json +1 -1
  94. package/client/common/post-msg.js +0 -3
  95. package/client/components/common/native-input.jsx +0 -30
  96. package/client/components/context-menu/context-menu.jsx +0 -339
  97. package/client/components/sftp/file-props-modal.jsx +0 -210
  98. package/client/store/context-menu.js +0 -23
  99. /package/client/components/{context-menu → sys-menu}/boomarks.jsx +0 -0
  100. /package/client/components/{context-menu → sys-menu}/history.jsx +0 -0
  101. /package/client/components/{context-menu → sys-menu}/icon-holder.jsx +0 -0
  102. /package/client/components/{context-menu → sys-menu}/sub-tab-menu.jsx +0 -0
  103. /package/client/components/{context-menu → sys-menu}/tabs.jsx +0 -0
  104. /package/client/components/{context-menu → sys-menu}/zoom.jsx +0 -0
@@ -4,18 +4,16 @@
4
4
 
5
5
  import handleError from '../common/error-handler'
6
6
  import { Modal } from 'antd'
7
- import { debounce, some } from 'lodash-es'
8
- import postMessage from '../common/post-msg'
7
+ import { debounce, some, get } from 'lodash-es'
9
8
  import {
10
- commonActions,
11
9
  modals,
12
10
  leftSidebarWidthKey,
13
11
  rightSidebarWidthKey,
14
12
  dismissDelKeyTipLsKey,
15
- connectionMap,
16
- terminalActions
13
+ connectionMap
17
14
  } from '../common/constants'
18
15
  import * as ls from '../common/safe-local-storage'
16
+ import { refs, refsStatic } from '../components/common/ref'
19
17
  import { action } from 'manate'
20
18
 
21
19
  const e = window.translate
@@ -34,21 +32,6 @@ export default Store => {
34
32
  window.store.setConfig(ext)
35
33
  }
36
34
 
37
- Store.prototype.openFileInfoModal = function (data) {
38
- postMessage({
39
- data,
40
- action: commonActions.showFileInfoModal
41
- })
42
- }
43
-
44
- Store.prototype.openFileModeModal = function (data, file) {
45
- postMessage({
46
- data,
47
- file,
48
- action: commonActions.showFileModeModal
49
- })
50
- }
51
-
52
35
  Store.prototype.openInfoPanel = action(function () {
53
36
  const { store } = window
54
37
  store.rightPanelVisible = true
@@ -56,13 +39,13 @@ export default Store => {
56
39
  store.openInfoPanelAction()
57
40
  })
58
41
 
59
- Store.prototype.openInfoPanelAction = action(function () {
42
+ Store.prototype.openInfoPanelAction = function () {
60
43
  const { store } = window
61
- postMessage({
62
- action: terminalActions.showInfoPanel,
63
- activeTabId: store.activeTabId
64
- })
65
- })
44
+ setTimeout(() => {
45
+ const term = refs.get('term-' + store.activeTabId)
46
+ term && term.handleShowInfo()
47
+ }, 300)
48
+ }
66
49
 
67
50
  Store.prototype.toggleAIConfig = function () {
68
51
  window.store.showAIConfig = !window.store.showAIConfig
@@ -108,35 +91,15 @@ export default Store => {
108
91
  window.store.showModal = modals.batchOps
109
92
  async function updateText () {
110
93
  const text = await window.fs.readFile(path)
111
- postMessage({
112
- action: commonActions.batchOp,
113
- batchOp: {
114
- func: 'setState',
115
- args: [
116
- {
117
- text
118
- }
119
- ]
120
- }
94
+ refsStatic.get('batch-op')?.setState({
95
+ text
121
96
  })
122
97
  }
123
98
  function queue () {
124
- postMessage({
125
- action: commonActions.batchOp,
126
- batchOp: {
127
- func: 'handleClick',
128
- args: []
129
- }
130
- })
99
+ refsStatic.get('batch-op')?.handleClick()
131
100
  }
132
101
  function run () {
133
- postMessage({
134
- action: commonActions.batchOp,
135
- batchOp: {
136
- func: 'handleExec',
137
- args: []
138
- }
139
- })
102
+ refsStatic.get('batch-op')?.handleExec()
140
103
  }
141
104
  try {
142
105
  setTimeout(updateText, 2000)
@@ -281,11 +244,20 @@ export default Store => {
281
244
  store.rightPanelTab = 'ai'
282
245
  }
283
246
 
247
+ Store.prototype.explainWithAi = function (txt) {
248
+ const { store } = window
249
+ store.handleOpenAIPanel()
250
+ setTimeout(() => {
251
+ refsStatic.get('AIChat')?.setPrompt(`explain terminal output: ${txt}`)
252
+ }, 500)
253
+ setTimeout(() => {
254
+ refsStatic.get('AIChat')?.handleSubmit()
255
+ }, 1200)
256
+ }
257
+
284
258
  Store.prototype.runCommandInTerminal = function (cmd) {
285
- postMessage({
286
- action: terminalActions.quickCommand,
287
- cmd,
288
- selectedTabIds: window.store.batchInputSelectedTabIds
259
+ window.store.batchInputSelectedTabIds.forEach(id => {
260
+ refs.get('term-' + id)?.runQuickCommand(cmd)
289
261
  })
290
262
  }
291
263
 
@@ -297,4 +269,14 @@ export default Store => {
297
269
  }
298
270
  window.store.aiChatHistory.splice(index, 1)
299
271
  }
272
+
273
+ Store.prototype.getLangName = function (
274
+ lang = window.store?.config.language || 'en_us'
275
+ ) {
276
+ return get(window.langMap, `[${lang}].name`)
277
+ }
278
+
279
+ Store.prototype.getLangNames = function () {
280
+ return window.et.langs.map(d => d.name)
281
+ }
300
282
  }
@@ -2,48 +2,18 @@
2
2
  * extend store
3
3
  */
4
4
 
5
- import postMessage from '../common/post-msg'
6
- import { commonActions } from '../common/constants'
5
+ import { refs } from '../components/common/ref'
7
6
 
8
7
  export default Store => {
9
- Store.prototype.initStoreEvents = function () {
10
- window.addEventListener('message', window.store.onStoreEvent)
11
- }
12
-
13
- Store.prototype.onStoreEvent = function (e) {
14
- const { store } = window
15
- const {
16
- action
17
- } = e.data || {}
18
- if (action !== commonActions.updateStore) {
19
- return false
20
- }
21
- const {
22
- func,
23
- prop,
24
- value,
25
- args = []
26
- } = e.data || {}
27
- if (func) {
28
- store[func](...args)
29
- } else if (prop) {
30
- store[prop] = value
31
- }
32
- }
33
-
34
8
  Store.prototype.focus = function () {
35
9
  window.focused = true
36
- postMessage({
37
- type: 'focus'
38
- })
10
+ refs.get('term-' + window.store.activeTabId)?.term?.focus()
39
11
  }
40
12
 
41
13
  Store.prototype.blur = function () {
42
14
  window.focused = false
43
15
  window.pre.runSync('windowMove', false)
44
- postMessage({
45
- type: 'blur'
46
- })
16
+ refs.get('term-' + window.store.activeTabId)?.term?.blur()
47
17
  }
48
18
 
49
19
  Store.prototype.onBlur = function () {
@@ -55,10 +25,7 @@ export default Store => {
55
25
  document.activeElement &&
56
26
  document.activeElement.select &&
57
27
  document.activeElement.select()
58
- postMessage({
59
- event: 'selectall',
60
- id: window.store.activeTabId
61
- })
28
+ refs.get('term-' + window.store.activeTabId)?.term?.selectAll()
62
29
  }
63
30
 
64
31
  Store.prototype.triggerResize = function () {
@@ -51,16 +51,14 @@ export default () => {
51
51
  activeTabId: '',
52
52
  history: ls.getItemJSON('history', []),
53
53
  sshConfigs: [],
54
- _bookmarks: '[]',
54
+ bookmarks: [],
55
55
  sidebarPanelTab: 'bookmarks',
56
- _profiles: '[]',
57
- _bookmarkGroups: JSON.stringify(
58
- getDefaultBookmarkGroups([])
59
- ),
56
+ profiles: [],
57
+ bookmarkGroups: getDefaultBookmarkGroups([]),
60
58
  _config: {},
61
- _terminalThemes: JSON.stringify([
59
+ terminalThemes: [
62
60
  buildDefaultThemes()
63
- ]),
61
+ ],
64
62
  itermThemes: exclude([]),
65
63
  currentBookmarkGroupId: defaultBookmarkGroupId,
66
64
  expandedKeys: ls.getItemJSON(expandedKeysLsKey, [
@@ -68,8 +66,8 @@ export default () => {
68
66
  ]),
69
67
  bookmarkSelectMode: false,
70
68
  checkedKeys: ls.getItemJSON(checkedKeysLsKey, []),
71
- _addressBookmarks: '[]',
72
- _addressBookmarksLocal: ls.getItem(localAddrBookmarkLsKey) || '[]',
69
+ addressBookmarks: [],
70
+ addressBookmarksLocal: ls.getItemJSON(localAddrBookmarkLsKey, []),
73
71
  openResolutionEdit: false,
74
72
  resolutions: ls.getItemJSON(resolutionsLsKey, []),
75
73
 
@@ -92,7 +90,7 @@ export default () => {
92
90
  sftpSortSetting: ls.getItemJSON(sftpDefaultSortSettingKey, {
93
91
  local: {
94
92
  prop: 'modifyTime',
95
- direction: 'asc'
93
+ direction: 'desc'
96
94
  },
97
95
  remote: {
98
96
  prop: 'modifyTime',
@@ -117,7 +115,6 @@ export default () => {
117
115
  _setting: '',
118
116
  settingItem: initSettingItem([], settingMap.bookmarks),
119
117
  settingTab: settingMap.bookmarks, // setting tab
120
- autofocustrigger: Date.now(),
121
118
  bookmarkId: undefined,
122
119
  showModal: 0,
123
120
 
@@ -142,7 +139,7 @@ export default () => {
142
139
  },
143
140
 
144
141
  // quick commands
145
- _quickCommands: '[]',
142
+ quickCommands: [],
146
143
  quickCommandId: '',
147
144
  openQuickCommandBar: false,
148
145
  pinnedQuickCommandBar: false,
@@ -3,11 +3,11 @@
3
3
  */
4
4
 
5
5
  import { find } from 'lodash-es'
6
+ import deepCopy from 'json-deep-copy'
6
7
  import {
7
8
  settingMap
8
9
  } from '../common/constants'
9
10
  import getInitItem from '../common/init-setting-item'
10
- import { update, remove, dbNames } from '../common/db'
11
11
 
12
12
  export default Store => {
13
13
  Store.prototype.addItem = function (item, type) {
@@ -16,22 +16,8 @@ export default Store => {
16
16
 
17
17
  Store.prototype.addItems = function (objs, type) {
18
18
  const { store } = window
19
- let items = store.getItems(type)
20
- items = [
21
- ...objs,
22
- ...items
23
- ]
24
- store.setItems(type, items)
25
- if (dbNames.includes(type)) {
26
- store.batchDbAdd(
27
- objs.map(obj => {
28
- return {
29
- db: type,
30
- obj
31
- }
32
- })
33
- )
34
- }
19
+ const items = store.getItems(type)
20
+ items.push(...objs)
35
21
  }
36
22
 
37
23
  Store.prototype.editItem = function (id, updates, type) {
@@ -42,31 +28,25 @@ export default Store => {
42
28
  return
43
29
  }
44
30
  Object.assign(item, updates)
45
- store.setItems(type, items)
46
- if (dbNames.includes(type)) {
47
- update(id, updates, type, false)
48
- }
49
31
  }
50
32
 
51
33
  Store.prototype.delItem = function ({ id }, type) {
52
34
  const { store } = window
53
- const items = store.getItems(type).filter(t => {
54
- return t.id !== id
55
- })
56
- store.setItems(type, items)
57
- if (dbNames.includes(type)) {
58
- remove(type, id)
35
+ const items = store.getItems(type)
36
+ const index = items.findIndex(t => t.id === id)
37
+ if (index < 0) {
38
+ return
59
39
  }
40
+ items.splice(index, 1)
60
41
  }
61
42
 
62
43
  Store.prototype.delItems = function (ids, type) {
63
44
  const { store } = window
64
- const items = store.getItems(type).filter(t => {
65
- return !ids.includes(t.id)
66
- })
67
- store.setItems(type, items)
68
- if (dbNames.includes(type)) {
69
- ids.map(id => remove(type, id))
45
+ const items = store.getItems(type)
46
+ for (let i = items.length - 1; i >= 0; i--) {
47
+ if (ids.includes(items[i].id)) {
48
+ items.splice(i, 1)
49
+ }
70
50
  }
71
51
  }
72
52
 
@@ -83,22 +63,37 @@ export default Store => {
83
63
  Store.prototype.getSidebarList = function (type) {
84
64
  const { store } = window
85
65
  if (type === settingMap.terminalThemes) {
86
- return [
66
+ return deepCopy([
87
67
  ...store.getTerminalThemes(),
88
68
  ...store.itermThemes
89
- ].sort(window.store.sortTheme)
69
+ ]).sort(window.store.sortTheme)
90
70
  }
91
- return store.getItems(type)
71
+ return deepCopy(store.getItems(type))
92
72
  }
93
73
 
94
74
  Store.prototype.getItems = function (type) {
95
75
  if (type === 'setting') {
96
76
  return window.store.setting
97
77
  }
98
- return JSON.parse(this['_' + type] || [])
78
+ return window.store[type]
99
79
  }
100
80
 
101
- Store.prototype.setItems = function (type, items) {
102
- this['_' + type] = JSON.stringify(items)
81
+ Store.prototype.setItems = function (type, arr) {
82
+ window.store[type] = arr
83
+ }
84
+
85
+ Store.prototype.adjustOrder = function (type, fromId, toId) {
86
+ const { store } = window
87
+ const items = store.getItems(type)
88
+ const fromIndex = items.findIndex(t => t.id === fromId)
89
+ let toIndex = items.findIndex(t => t.id === toId)
90
+ if (fromIndex < 0 || toIndex < 0 || fromIndex === toIndex) {
91
+ return
92
+ }
93
+ if (fromIndex < toIndex) {
94
+ toIndex = toIndex - 1
95
+ }
96
+ const [removed] = items.splice(fromIndex, 1)
97
+ items.splice(toIndex, 0, removed)
103
98
  }
104
99
  }
@@ -13,6 +13,7 @@ import runIdle from '../common/run-idle'
13
13
  import { initWsCommon } from '../common/fetch-from-server'
14
14
  import safeParse from '../common/parse-json-safe'
15
15
  import initWatch from './watch'
16
+ import { refsStatic } from '../components/common/ref'
16
17
 
17
18
  function getHost (argv, opts) {
18
19
  const arr = argv
@@ -185,11 +186,14 @@ export default (Store) => {
185
186
  await Promise.all(all)
186
187
  .then(arr => {
187
188
  for (const { name, data } of arr) {
188
- ext['_' + name] = data || '[]'
189
+ const dt = JSON.parse(data || '[]')
190
+ refsStatic.add('oldState-' + name, dt)
191
+ ext[name] = dt
189
192
  }
190
193
  })
191
194
  ext.lastDataUpdateTime = await getData('lastDataUpdateTime') || 0
192
195
  Object.assign(store, ext)
196
+ await store.fixBookmarkGroups()
193
197
 
194
198
  store.checkDefaultTheme()
195
199
  store.loadFontList()
@@ -5,20 +5,15 @@
5
5
  import {
6
6
  settingMap,
7
7
  qmSortByFrequencyKey,
8
- terminalActions,
9
8
  isWin
10
9
  } from '../common/constants'
11
10
  import delay from '../common/wait'
12
11
  import generate from '../common/uid'
13
- import postMessage from '../common/post-msg'
14
12
  import * as ls from '../common/safe-local-storage'
15
13
  import { debounce } from 'lodash-es'
14
+ import { refs } from '../components/common/ref'
16
15
 
17
16
  export default Store => {
18
- Store.prototype.setQuickCommands = function (list) {
19
- return window.store.setItems(settingMap.quickCommands, list)
20
- }
21
-
22
17
  Store.prototype.addQuickCommand = function (
23
18
  qm
24
19
  ) {
@@ -34,12 +29,7 @@ export default Store => {
34
29
  }
35
30
 
36
31
  Store.prototype.runQuickCommand = function (cmd, inputOnly = false) {
37
- postMessage({
38
- action: terminalActions.quickCommand,
39
- cmd,
40
- inputOnly,
41
- activeTabId: window.store.activeTabId
42
- })
32
+ refs.get('term-' + window.store.activeTabId)?.runQuickCommand(cmd, inputOnly)
43
33
  }
44
34
 
45
35
  Store.prototype.runQuickCommandItem = debounce(async (id) => {
@@ -2,16 +2,15 @@
2
2
  * sessions not proper closed related functions
3
3
  */
4
4
 
5
- import { terminalActions } from '../common/constants'
6
5
  import { debounce } from 'lodash-es'
7
- import postMsg from '../common/post-msg'
6
+ import { refs } from '../components/common/ref'
8
7
 
9
8
  export default Store => {
10
9
  Store.prototype.zoomTerminal = debounce(function (delta) {
11
- postMsg({
12
- action: terminalActions.zoom,
13
- zoomValue: delta > 0 ? 1 : -1,
14
- activeTabId: window.store.activeTabId
15
- })
10
+ const term = refs.get('term-' + window.store.activeTabId)
11
+ if (!term) {
12
+ return
13
+ }
14
+ term.zoom(delta > 0 ? 1 : -1)
16
15
  }, 500)
17
16
  }
@@ -37,8 +37,7 @@ export default Store => {
37
37
  Store.prototype.openBookmarkEdit = function (item) {
38
38
  const { store } = window
39
39
  store.storeAssign({
40
- settingTab: settingMap.bookmarks,
41
- autofocustrigger: Date.now()
40
+ settingTab: settingMap.bookmarks
42
41
  })
43
42
  store.setSettingItem(item)
44
43
  store.openSettingModal()
@@ -47,8 +46,7 @@ export default Store => {
47
46
  Store.prototype.handleOpenQuickCommandsSetting = function () {
48
47
  const { store } = window
49
48
  store.storeAssign({
50
- settingTab: settingMap.quickCommands,
51
- autofocustrigger: Date.now()
49
+ settingTab: settingMap.quickCommands
52
50
  })
53
51
  store.setSettingItem(getInitItem([], settingMap.quickCommands))
54
52
  store.openSettingModal()
@@ -125,8 +123,7 @@ export default Store => {
125
123
  return store.hideSettingModal()
126
124
  }
127
125
  store.storeAssign({
128
- settingTab: settingMap.terminalThemes,
129
- autofocustrigger: Date.now()
126
+ settingTab: settingMap.terminalThemes
130
127
  })
131
128
  store.setSettingItem(buildNewTheme())
132
129
  store.openSettingModal()
@@ -162,7 +159,6 @@ export default Store => {
162
159
  const arr = store.getItems(settingTab)
163
160
  const item = getInitItem(arr, settingTab)
164
161
  store.storeAssign({
165
- autofocustrigger: Date.now(),
166
162
  settingTab
167
163
  })
168
164
  store.setSettingItem(item)
@@ -11,18 +11,12 @@ import * as ls from '../common/safe-local-storage'
11
11
  export default Store => {
12
12
  Store.prototype.expandBookmarks = function () {
13
13
  const { store } = window
14
- window.store.setState(
15
- 'expandedKeys',
16
- store.getBookmarkGroupsTotal().map(g => g.id)
17
- )
14
+ window.store.expandedKeys = store.getBookmarkGroupsTotal().map(g => g.id)
18
15
  }
19
16
 
20
17
  Store.prototype.collapseBookmarks = function () {
21
18
  const { store } = window
22
- store.setState(
23
- 'expandedKeys',
24
- []
25
- )
19
+ store.expandedKeys = []
26
20
  }
27
21
 
28
22
  Store.prototype.handlePin = function (pinned) {
@@ -11,7 +11,6 @@ import appUpgradeExtend from './app-upgrade'
11
11
  import bookmarkGroupExtend from './bookmark-group'
12
12
  import bookmarkExtend from './bookmark'
13
13
  import commonExtend from './common'
14
- import contextMenuExtend from './context-menu'
15
14
  import itemExtend from './item'
16
15
  import quickCommandExtend from './quick-command'
17
16
  import sessionExtend from './session'
@@ -269,24 +268,6 @@ class Store {
269
268
  }
270
269
  }
271
270
 
272
- const arrGetterProps = [
273
- 'addressBookmarks',
274
- 'addressBookmarksLocal',
275
- 'bookmarks',
276
- 'bookmarkGroups',
277
- 'profiles',
278
- 'quickCommands',
279
- 'terminalThemes'
280
- ]
281
-
282
- for (const prop of arrGetterProps) {
283
- Object.defineProperty(Store.prototype, prop, {
284
- get: function () {
285
- return JSON.parse(window.store[`_${prop}`] || '[]').filter(d => d)
286
- }
287
- })
288
- }
289
-
290
271
  loadDataExtend(Store)
291
272
  eventExtend(Store)
292
273
  dbUpgradeExtend(Store)
@@ -295,7 +276,6 @@ appUpgradeExtend(Store)
295
276
  bookmarkGroupExtend(Store)
296
277
  bookmarkExtend(Store)
297
278
  commonExtend(Store)
298
- contextMenuExtend(Store)
299
279
  itemExtend(Store)
300
280
  quickCommandExtend(Store)
301
281
  sessionExtend(Store)
@@ -55,8 +55,7 @@ export default Store => {
55
55
  Store.prototype.onNewSsh = function () {
56
56
  const { store } = window
57
57
  store.storeAssign({
58
- settingTab: settingMap.bookmarks,
59
- autofocustrigger: Date.now()
58
+ settingTab: settingMap.bookmarks
60
59
  })
61
60
  store.setSettingItem(getInitItem([], settingMap.bookmarks))
62
61
  store.openSettingModal()
@@ -9,6 +9,7 @@ import {
9
9
  paneMap,
10
10
  maxHistory
11
11
  } from '../common/constants'
12
+ import { refs } from '../components/common/ref'
12
13
  import * as ls from '../common/safe-local-storage'
13
14
  import deepCopy from 'json-deep-copy'
14
15
  import generate from '../common/id-with-stamp'
@@ -449,10 +450,16 @@ export default Store => {
449
450
  }
450
451
 
451
452
  Store.prototype.updateHistory = function (tab) {
452
- if (!tab.type && !tab.host) {
453
+ if (
454
+ !tab.type &&
455
+ !tab.host
456
+ ) {
453
457
  return
454
458
  }
455
459
  const { store } = window
460
+ if (store.config.disableConnectionHistory) {
461
+ return
462
+ }
456
463
  const tabPropertiesExcludes = [
457
464
  'id',
458
465
  'from',
@@ -546,4 +553,25 @@ export default Store => {
546
553
  // Ensure at least the active tab is selected
547
554
  store._batchInputSelectedTabIds.add(store.activeTabId)
548
555
  })
556
+
557
+ Store.prototype.notifyTabOnData = function (tabId) {
558
+ const tab = refs.get('tab-' + tabId)
559
+ if (tab) {
560
+ tab.notifyOnData()
561
+ }
562
+ }
563
+
564
+ Store.prototype.remoteList = function (sessionId) {
565
+ const sftp = refs.get('sftp-' + sessionId)
566
+ if (sftp) {
567
+ sftp.remoteListDebounce()
568
+ }
569
+ }
570
+
571
+ Store.prototype.localList = function (sessionId) {
572
+ const sftp = refs.get('sftp-' + sessionId)
573
+ if (sftp) {
574
+ sftp.localListDebounce()
575
+ }
576
+ }
549
577
  }
@@ -19,10 +19,6 @@ export default Store => {
19
19
  return window.store.getItems(settingMap.terminalThemes)
20
20
  }
21
21
 
22
- Store.prototype.setTerminalThemes = function (arr) {
23
- return window.store.setItems(settingMap.terminalThemes, arr)
24
- }
25
-
26
22
  Store.prototype.setTheme = function (id) {
27
23
  window.store.updateConfig({
28
24
  theme: id