@electerm/electerm-react 1.51.3 → 1.51.18

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 (86) hide show
  1. package/client/common/constants.js +15 -1
  2. package/client/common/db.js +10 -9
  3. package/client/common/default-setting.js +0 -1
  4. package/client/common/is-color-dark.js +15 -11
  5. package/client/common/new-terminal.js +2 -5
  6. package/client/common/reverse-color.js +12 -0
  7. package/client/common/ws.js +4 -1
  8. package/client/components/batch-op/batch-op.jsx +16 -5
  9. package/client/components/bookmark-form/index.jsx +1 -1
  10. package/client/components/bookmark-form/render-connection-hopping.jsx +25 -2
  11. package/client/components/bookmark-form/ssh-form.jsx +4 -25
  12. package/client/components/bookmark-form/tree-delete.jsx +5 -10
  13. package/client/components/bookmark-form/use-submit.jsx +6 -15
  14. package/client/components/bookmark-form/use-ui.jsx +1 -2
  15. package/client/components/common/connection-hopping-warning-text.jsx +36 -0
  16. package/client/components/common/drag-handle.jsx +60 -0
  17. package/client/components/common/drag-handle.styl +12 -0
  18. package/client/components/context-menu/context-menu.styl +5 -5
  19. package/client/components/context-menu/history.jsx +2 -11
  20. package/client/components/context-menu/sub-tab-menu.jsx +1 -1
  21. package/client/components/footer/footer-entry.jsx +1 -6
  22. package/client/components/layout/layout-item.jsx +2 -2
  23. package/client/components/layout/layout.jsx +3 -2
  24. package/client/components/main/connection-hopping-warnning.jsx +45 -0
  25. package/client/components/main/error-wrapper.jsx +120 -5
  26. package/client/components/main/main.jsx +32 -8
  27. package/client/components/main/upgrade.jsx +4 -9
  28. package/client/components/main/wrapper.styl +2 -1
  29. package/client/components/profile/profile-form-ssh.jsx +1 -1
  30. package/client/components/rdp/resolution-edit.jsx +3 -5
  31. package/client/components/session/session.jsx +22 -3
  32. package/client/components/session/session.styl +3 -2
  33. package/client/components/setting-panel/list.styl +0 -1
  34. package/client/components/setting-panel/on-tree-drop.js +5 -5
  35. package/client/components/setting-panel/setting-common.jsx +28 -7
  36. package/client/components/setting-panel/setting-modal.jsx +0 -12
  37. package/client/components/setting-panel/setting-terminal.jsx +7 -4
  38. package/client/components/sftp/confirm-modal-store.jsx +3 -11
  39. package/client/components/sftp/file-mode-modal.jsx +2 -2
  40. package/client/components/sftp/sftp-entry.jsx +4 -7
  41. package/client/components/sftp/transfer-conflict-store.jsx +70 -69
  42. package/client/components/sftp/transport-action-store.jsx +42 -49
  43. package/client/components/sftp/transports-action-store.jsx +15 -15
  44. package/client/components/sftp/transports-ui-store.jsx +9 -5
  45. package/client/components/side-panel-r/side-panel-r.jsx +13 -40
  46. package/client/components/sidebar/bookmark-select.jsx +1 -4
  47. package/client/components/sidebar/bookmark.jsx +4 -63
  48. package/client/components/sidebar/history-item.jsx +34 -0
  49. package/client/components/sidebar/history.jsx +17 -52
  50. package/client/components/sidebar/index.jsx +5 -40
  51. package/client/components/sidebar/side-panel.jsx +27 -51
  52. package/client/components/sidebar/sidebar-panel.jsx +107 -0
  53. package/client/components/sidebar/sidebar.styl +14 -9
  54. package/client/components/sidebar/transfer-list-control.jsx +1 -0
  55. package/client/components/sidebar/transfer.styl +1 -1
  56. package/client/components/sidebar/transport-ui.jsx +179 -37
  57. package/client/components/ssh-config/load-ssh-configs.jsx +106 -0
  58. package/client/components/ssh-config/ssh-config-item.jsx +26 -0
  59. package/client/components/ssh-config/ssh-config-load-notify.jsx +60 -0
  60. package/client/components/tabs/index.jsx +4 -4
  61. package/client/components/tabs/tab.jsx +28 -20
  62. package/client/components/tabs/tabs.styl +6 -1
  63. package/client/components/terminal/index.jsx +4 -18
  64. package/client/components/tree-list/bookmark-toolbar.jsx +203 -0
  65. package/client/components/tree-list/bookmark-transport.jsx +2 -0
  66. package/client/components/tree-list/tree-list.jsx +33 -42
  67. package/client/entry/worker.js +5 -3
  68. package/client/store/bookmark-group.js +5 -18
  69. package/client/store/bookmark.js +43 -1
  70. package/client/store/common.js +13 -9
  71. package/client/store/db-upgrade.js +0 -2
  72. package/client/store/index.js +45 -53
  73. package/client/store/init-state.js +20 -23
  74. package/client/store/item.js +0 -19
  75. package/client/store/load-data.js +7 -10
  76. package/client/store/setting.js +10 -66
  77. package/client/store/sidebar.js +7 -8
  78. package/client/store/sync.js +7 -8
  79. package/client/store/tab.js +93 -14
  80. package/client/store/terminal-theme.js +1 -1
  81. package/client/store/transfer-history.js +3 -9
  82. package/client/store/transfer-list.js +67 -75
  83. package/client/store/ui-theme.js +0 -9
  84. package/client/store/watch.js +17 -9
  85. package/package.json +1 -1
  86. package/client/components/setting-panel/tab-history.jsx +0 -43
@@ -27,15 +27,16 @@ import batchInputHistory from './batch-input-history'
27
27
  import transferExtend from './transfer-list'
28
28
  import addressBookmarkExtend from './address-bookmark'
29
29
  import isColorDark from '../common/is-color-dark'
30
-
30
+ import { getReverseColor } from '../common/reverse-color'
31
31
  import { uniq } from 'lodash-es'
32
- import copy from 'json-deep-copy'
32
+ import deepCopy from 'json-deep-copy'
33
33
  import {
34
34
  settingMap,
35
35
  paneMap,
36
36
  settingSyncId,
37
37
  settingShortcutsId,
38
- settingTerminalId
38
+ settingTerminalId,
39
+ terminalSshConfigType
39
40
  } from '../common/constants'
40
41
  import getInitItem from '../common/init-setting-item'
41
42
  import {
@@ -44,19 +45,6 @@ import {
44
45
 
45
46
  const e = window.translate
46
47
 
47
- function getReverseColor (hex) {
48
- // Check if the input is a valid hex color code
49
- if (!/^#[0-9a-fA-F]{6}$/.test(hex)) {
50
- return '#0088cc'
51
- }
52
- // Convert the hex color code to an integer
53
- const num = parseInt(hex.slice(1), 16)
54
- // Bitwise XOR the integer with 0xFFFFFF to get the reverse color
55
- const reverse = num ^ 0xFFFFFF
56
- // Convert the reverse color to a hex string and pad with zeros if needed
57
- return '#' + reverse.toString(16).padStart(6, '0')
58
- }
59
-
60
48
  class Store {
61
49
  constructor () {
62
50
  Object.assign(
@@ -69,6 +57,10 @@ class Store {
69
57
  return window.store.innerWidth
70
58
  }
71
59
 
60
+ get config () {
61
+ return deepCopy(window.store._config)
62
+ }
63
+
72
64
  get currentQuickCommands () {
73
65
  const { currentTab } = this
74
66
  const { quickCommands } = window.store
@@ -100,12 +92,24 @@ class Store {
100
92
 
101
93
  get inActiveTerminal () {
102
94
  const { store } = window
103
- return !store.showModal &&
104
- store.currentTab &&
105
- (
106
- store.currentTab.pane === paneMap.ssh ||
107
- store.currentTab.pane === paneMap.terminal
108
- )
95
+ if (store.showModal) {
96
+ return false
97
+ }
98
+ const {
99
+ currentTab
100
+ } = store
101
+ if (!currentTab) {
102
+ return false
103
+ }
104
+ const {
105
+ type,
106
+ pane
107
+ } = currentTab
108
+ if (type === 'rdp' || type === 'vnc' || type === 'web') {
109
+ return false
110
+ }
111
+ return pane === paneMap.ssh ||
112
+ pane === paneMap.terminal
109
113
  }
110
114
 
111
115
  get quickCommandTags () {
@@ -124,6 +128,10 @@ class Store {
124
128
  return window.store.tabs.some(t => t.isTransporting)
125
129
  }
126
130
 
131
+ get transferCount () {
132
+ return window.store.fileTransfers.length
133
+ }
134
+
127
135
  get settingSidebarList () {
128
136
  const {
129
137
  settingTab
@@ -133,7 +141,7 @@ class Store {
133
141
  return settingTab === settingMap.history
134
142
  ? arr
135
143
  : [
136
- copy(initItem),
144
+ deepCopy(initItem),
137
145
  ...arr
138
146
  ]
139
147
  }
@@ -144,7 +152,7 @@ class Store {
144
152
  } = window
145
153
  const theme = store.getThemeConfig()
146
154
  return {
147
- ...JSON.parse(window.store._termSearchOptions),
155
+ ...window.store._termSearchOptions,
148
156
  decorations: {
149
157
  activeMatchBorder: theme.yellow,
150
158
  activeMatchBackground: theme.selectionBackground,
@@ -218,6 +226,12 @@ class Store {
218
226
  }, {})
219
227
  }
220
228
 
229
+ hasSshConfig () {
230
+ return !!window.store
231
+ .bookmarkGroups
232
+ .find(b => b.id === terminalSshConfigType)
233
+ }
234
+
221
235
  get bookmarkGroupTree () {
222
236
  const {
223
237
  bookmarkGroups
@@ -229,26 +243,22 @@ class Store {
229
243
  }
230
244
  }, {})
231
245
  }
246
+
247
+ get hasOldConnectionHoppingBookmark () {
248
+ return window.store.bookmarks.some(b => {
249
+ return b.connectionHoppings?.length && !b.hasHopping
250
+ })
251
+ }
232
252
  }
233
253
 
234
254
  const arrGetterProps = [
235
- 'expandedKeys',
236
- 'checkedKeys',
237
255
  'addressBookmarks',
238
256
  'addressBookmarksLocal',
239
- 'sshConfigItems',
240
- 'itermThemes',
241
- 'history',
242
257
  'bookmarks',
243
258
  'bookmarkGroups',
244
259
  'profiles',
245
- 'fileTransfers',
246
- 'transferHistory',
247
260
  'quickCommands',
248
- 'terminalThemes',
249
- 'serials',
250
- 'fonts',
251
- 'resolutions'
261
+ 'terminalThemes'
252
262
  ]
253
263
 
254
264
  for (const prop of arrGetterProps) {
@@ -259,24 +269,6 @@ for (const prop of arrGetterProps) {
259
269
  })
260
270
  }
261
271
 
262
- const getterProps = [
263
- 'langs',
264
- 'config',
265
- 'sftpSortSetting',
266
- 'upgradeInfo',
267
- 'transferToConfirm',
268
- 'terminalInfoProps',
269
- 'settingItem'
270
- ]
271
-
272
- for (const prop of getterProps) {
273
- Object.defineProperty(Store.prototype, prop, {
274
- get: function () {
275
- return JSON.parse(window.store[`_${prop}`] || '{}')
276
- }
277
- })
278
- }
279
-
280
272
  loadDataExtend(Store)
281
273
  eventExtend(Store)
282
274
  dbUpgradeExtend(Store)
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * init static state
3
3
  */
4
-
5
4
  import {
6
5
  settingMap,
7
6
  defaultBookmarkGroupId,
@@ -24,6 +23,7 @@ import {
24
23
  } from '../common/constants'
25
24
  import { buildDefaultThemes } from '../common/terminal-theme'
26
25
  import * as ls from '../common/safe-local-storage'
26
+ import { exclude } from 'manate'
27
27
  import initSettingItem from '../common/init-setting-item'
28
28
 
29
29
  const e = window.translate
@@ -48,27 +48,29 @@ export default () => {
48
48
  lastDataUpdateTime: 0,
49
49
  tabs: [],
50
50
  activeTabId: '',
51
- _history: '[]',
51
+ history: ls.getItemJSON('history', []),
52
+ sshConfigs: [],
52
53
  _bookmarks: '[]',
54
+ sidebarPanelTab: 'bookmarks',
53
55
  _profiles: '[]',
54
56
  _bookmarkGroups: JSON.stringify(
55
57
  getDefaultBookmarkGroups([])
56
58
  ),
57
- _config: '{}',
59
+ _config: {},
58
60
  _terminalThemes: JSON.stringify([
59
61
  buildDefaultThemes()
60
62
  ]),
61
- _itermThemes: '[]',
63
+ itermThemes: exclude([]),
62
64
  currentBookmarkGroupId: defaultBookmarkGroupId,
63
- _expandedKeys: ls.getItem(expandedKeysLsKey) || JSON.stringify([
65
+ expandedKeys: ls.getItemJSON(expandedKeysLsKey, [
64
66
  defaultBookmarkGroupId
65
67
  ]),
66
68
  bookmarkSelectMode: false,
67
- _checkedKeys: ls.getItem(checkedKeysLsKey) || '[]',
69
+ checkedKeys: ls.getItemJSON(checkedKeysLsKey, []),
68
70
  _addressBookmarks: '[]',
69
71
  _addressBookmarksLocal: ls.getItem(localAddrBookmarkLsKey) || '[]',
70
72
  openResolutionEdit: false,
71
- _resolutions: ls.getItem(resolutionsLsKey) || '[]',
73
+ resolutions: ls.getItemJSON(resolutionsLsKey, []),
72
74
 
73
75
  // init session control
74
76
  selectedSessions: [],
@@ -78,10 +80,10 @@ export default () => {
78
80
  fileOperation: fileOperationsMap.cp, // cp or mv
79
81
  pauseAllTransfer: false,
80
82
  transferTab: 'transfer',
81
- _transferHistory: '[]',
82
- _fileTransfers: '[]',
83
- _transferToConfirm: '{}',
84
- _sftpSortSetting: ls.getItem(sftpDefaultSortSettingKey) || JSON.stringify({
83
+ transferHistory: [],
84
+ fileTransfers: [],
85
+ transferToConfirm: {},
86
+ sftpSortSetting: ls.getItemJSON(sftpDefaultSortSettingKey, {
85
87
  local: {
86
88
  prop: 'modifyTime',
87
89
  direction: 'asc'
@@ -99,14 +101,14 @@ export default () => {
99
101
  activeTabId1: '',
100
102
  activeTabId2: '',
101
103
  activeTabId3: '',
102
- _terminalInfoProps: '{}',
104
+ terminalInfoProps: {},
103
105
  rightPanelVisible: false,
104
106
  rightPanelPinned: false,
105
107
  rightPanelWidth: parseInt(ls.getItem(rightSidebarWidthKey), 10) || 500,
106
108
 
107
109
  // for settings related
108
110
  _setting: '',
109
- _settingItem: JSON.stringify(initSettingItem([], settingMap.bookmarks)),
111
+ settingItem: initSettingItem([], settingMap.bookmarks),
110
112
  settingTab: settingMap.bookmarks, // setting tab
111
113
  autofocustrigger: Date.now(),
112
114
  bookmarkId: undefined,
@@ -116,23 +118,21 @@ export default () => {
116
118
  isSyncingSetting: false,
117
119
  isSyncUpload: false,
118
120
  isSyncDownload: false,
119
- syncSetting: {},
120
121
  syncType: syncTypes.github,
121
- _fonts: '[]',
122
122
 
123
123
  // term search
124
124
  termSearchOpen: false,
125
125
  termSearch: '',
126
126
  termSearchMatchCount: 0,
127
127
  termSearchMatchIndex: 0,
128
- _termSearchOptions: JSON.stringify({
128
+ _termSearchOptions: {
129
129
  caseSensitive: false,
130
130
  wholeWord: false,
131
131
  regex: false,
132
132
  decorations: {
133
133
  activeMatchColorOverviewRuler: 'yellow'
134
134
  }
135
- }),
135
+ },
136
136
 
137
137
  // quick commands
138
138
  _quickCommands: '[]',
@@ -160,20 +160,17 @@ export default () => {
160
160
  showFileModal: false,
161
161
 
162
162
  // update
163
- _upgradeInfo: '{}',
163
+ upgradeInfo: {},
164
164
 
165
165
  // serial list related
166
- _serials: '[]',
166
+ serials: [],
167
167
  loaddingSerials: false,
168
168
 
169
- _sshConfigItems: '[]',
170
-
171
169
  appPath: '',
172
170
  exePath: '',
173
171
  isPortable: false,
174
172
  installSrc: '',
175
-
176
- _langs: '[]',
173
+ showSshConfigModal: false,
177
174
 
178
175
  // batch inputs
179
176
  batchInputs: ls.getItemJSON(batchInputLsKey, []),
@@ -4,24 +4,12 @@
4
4
 
5
5
  import { find } from 'lodash-es'
6
6
  import {
7
- maxHistory,
8
7
  settingMap
9
8
  } from '../common/constants'
10
9
  import getInitItem from '../common/init-setting-item'
11
10
  import { update, remove, dbNames } from '../common/db'
12
- import copy from 'json-deep-copy'
13
11
 
14
12
  export default Store => {
15
- Store.prototype.removeOldHistoryFromDb = function (items) {
16
- const arr = items.slice(maxHistory).map(k => {
17
- return {
18
- db: 'history',
19
- id: k.id
20
- }
21
- })
22
- window.store.batchDbDel(arr)
23
- }
24
-
25
13
  Store.prototype.addItem = function (item, type) {
26
14
  return window.store.addItems([item], type)
27
15
  }
@@ -33,12 +21,6 @@ export default Store => {
33
21
  ...objs,
34
22
  ...items
35
23
  ]
36
- if (type === settingMap.history && items.length > maxHistory) {
37
- store.removeOldHistoryFromDb(
38
- copy(items)
39
- )
40
- items.slice(0, maxHistory)
41
- }
42
24
  store.setItems(type, items)
43
25
  if (dbNames.includes(type)) {
44
26
  store.batchDbAdd(
@@ -59,7 +41,6 @@ export default Store => {
59
41
  if (!item) {
60
42
  return
61
43
  }
62
- // let index = findIndex(items, t => t.id === id)
63
44
  Object.assign(item, updates)
64
45
  store.setItems(type, items)
65
46
  if (dbNames.includes(type)) {
@@ -12,6 +12,7 @@ import encodes from '../components/bookmark-form/encodes'
12
12
  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
+ import initWatch from './watch'
15
16
 
16
17
  function getHost (argv, opts) {
17
18
  const arr = argv
@@ -151,7 +152,8 @@ export default (Store) => {
151
152
  console.log('fetchSshConfigItems error', err)
152
153
  return []
153
154
  })
154
- window.store._sshConfigItems = JSON.stringify(arr)
155
+ window.store.sshConfigs = arr
156
+ return arr
155
157
  }
156
158
  Store.prototype.confirmLoad = function () {
157
159
  window.store.configLoaded = true
@@ -164,12 +166,8 @@ export default (Store) => {
164
166
  store.appPath = globs.appPath
165
167
  store.exePath = globs.exePath
166
168
  store.isPortable = globs.isPortable
167
- store._config = JSON.stringify(
168
- globs.config
169
- )
170
- store._langs = JSON.stringify(
171
- globs.langs
172
- )
169
+ store._config = globs.config
170
+ window.et.langs = globs.langs
173
171
  store.zoom(store.config.zoom, false, true)
174
172
  await initWsCommon()
175
173
  }
@@ -197,10 +195,9 @@ export default (Store) => {
197
195
  store.loadFontList()
198
196
  store.fetchItermThemes()
199
197
  store.openInitSessions()
200
- if (!store.config.hideSshConfig) {
201
- store.fetchSshConfigItems()
202
- }
198
+ store.fetchSshConfigItems()
203
199
  store.initCommandLine().catch(store.onError)
200
+ initWatch(store)
204
201
  if (store.config.checkUpdateOnStart) {
205
202
  store.onCheckUpdate(false)
206
203
  }
@@ -6,7 +6,6 @@ import { find } from 'lodash-es'
6
6
  import {
7
7
  message
8
8
  } from 'antd'
9
- import generate from '../common/uid'
10
9
  import copy from 'json-deep-copy'
11
10
  import {
12
11
  settingMap,
@@ -23,33 +22,17 @@ const e = window.translate
23
22
  export default Store => {
24
23
  Store.prototype.setConfig = function (conf) {
25
24
  const { store } = window
26
- store._config = JSON.stringify(
27
- {
28
- ...store.config,
29
- ...conf
30
- }
25
+ Object.assign(
26
+ store._config,
27
+ copy(conf)
31
28
  )
32
29
  }
33
30
  Store.prototype.setSftpSortSetting = function (conf) {
34
- const { store } = window
35
- const base = copy(store.sftpSortSetting)
36
- store._sftpSortSetting = JSON.stringify(
37
- {
38
- ...base,
39
- ...conf
40
- }
31
+ Object.assign(
32
+ window.store.sftpSortSetting,
33
+ conf
41
34
  )
42
35
  }
43
- Store.prototype.handleEditHistory = function () {
44
- const { store } = window
45
- const all = store.history
46
- store.storeAssign({
47
- settingTab: settingMap.history,
48
- autofocustrigger: Date.now()
49
- })
50
- store.setSettingItem(all[0] || getInitItem([], settingMap.history))
51
- store.openSettingModal()
52
- }
53
36
 
54
37
  Store.prototype.openBookmarkEdit = function (item) {
55
38
  const { store } = window
@@ -71,14 +54,10 @@ export default Store => {
71
54
  store.openSettingModal()
72
55
  }
73
56
 
74
- Store.prototype.onSelectHistory = function (id) {
57
+ Store.prototype.onSelectHistory = function (tab) {
75
58
  const { store } = window
76
- const history = store.history
77
- const item = find(history, it => it.id === id)
78
59
  store.addTab({
79
- ...copy(item),
80
- from: 'history',
81
- srcId: item.id,
60
+ ...copy(tab),
82
61
  ...newTerm(true, true),
83
62
  batch: window.openTabBatch ?? store.currentLayoutBatch
84
63
  })
@@ -87,11 +66,9 @@ export default Store => {
87
66
 
88
67
  Store.prototype.onSelectBookmark = function (id) {
89
68
  const { store } = window
90
- const history = store.history
91
69
  const bookmarks = store.bookmarks
92
70
  const item = copy(
93
- find(bookmarks, it => it.id === id) ||
94
- find(store.sshConfigItems, it => it.id === id)
71
+ find(bookmarks, it => it.id === id)
95
72
  )
96
73
  if (!item) {
97
74
  return
@@ -105,39 +82,6 @@ export default Store => {
105
82
  })
106
83
 
107
84
  delete window.openTabBatch
108
-
109
- if (store.config.disableSshHistory) {
110
- return
111
- }
112
-
113
- // Critical Change: Use bookmarkId for matching instead of history id
114
- const bookmarkId = item.id
115
- const existingIndex = history.findIndex(h => h.bookmarkId === bookmarkId)
116
- if (existingIndex >= 0) {
117
- history[existingIndex].count = (history[existingIndex].count || 0) + 1
118
- history[existingIndex].lastUse = Date.now()
119
- const updatedItem = history.splice(existingIndex, 1)[0]
120
- history.unshift(updatedItem)
121
- } else {
122
- const historyItem = {
123
- ...item,
124
- id: generate(),
125
- bookmarkId,
126
- count: 1,
127
- lastUse: Date.now()
128
- }
129
- history.unshift(historyItem)
130
- }
131
-
132
- history.sort((a, b) => b.count - a.count || b.lastUse - a.lastUse)
133
-
134
- // Optional: Consider max history length
135
- const maxHistoryLength = store.config.maxHistoryLength || 50
136
- if (history.length > maxHistoryLength) {
137
- history.length = maxHistoryLength
138
- }
139
-
140
- store.setItems('history', history)
141
85
  }
142
86
 
143
87
  Store.prototype.openSetting = function () {
@@ -210,7 +154,7 @@ export default Store => {
210
154
  console.log('loadFontList error', err)
211
155
  return []
212
156
  })
213
- window.store._fonts = JSON.stringify(fonts)
157
+ window.et.fonts = fonts
214
158
  }
215
159
 
216
160
  Store.prototype.handleChangeSettingTab = function (settingTab) {
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import {
6
- settingMap,
7
6
  openedSidebarKey,
8
7
  sidebarPinnedKey
9
8
  } from '../common/constants'
@@ -26,11 +25,6 @@ export default Store => {
26
25
  )
27
26
  }
28
27
 
29
- Store.prototype.setOpenedSideBar = function (bar) {
30
- ls.setItem(openedSidebarKey, bar)
31
- window.store.openedSideBar = bar
32
- }
33
-
34
28
  Store.prototype.handlePin = function (pinned) {
35
29
  const { store } = window
36
30
  const current = !store.pinned
@@ -42,7 +36,12 @@ export default Store => {
42
36
  window.store.onNewSsh()
43
37
  }
44
38
 
45
- Store.prototype.onClickHistory = function () {
46
- window.store.handleChangeSettingTab(settingMap.history)
39
+ Store.prototype.handleSidebarPanelTab = function (tab) {
40
+ window.store.sidebarPanelTab = tab
41
+ }
42
+
43
+ Store.prototype.setOpenedSideBar = function (v) {
44
+ ls.setItem(openedSidebarKey, v)
45
+ window.store.openedSideBar = v
47
46
  }
48
47
  }
@@ -2,7 +2,7 @@
2
2
  * sync data to github gist related
3
3
  */
4
4
 
5
- import { get, pick, debounce, findIndex } from 'lodash-es'
5
+ import { get, pick, debounce } from 'lodash-es'
6
6
  import copy from 'json-deep-copy'
7
7
  import {
8
8
  settingMap, packInfo, syncTypes, syncDataMaps
@@ -186,8 +186,8 @@ export default (Store) => {
186
186
  const order = await getData(`${n}:order`)
187
187
  if (order && order.length) {
188
188
  str.sort((a, b) => {
189
- const ai = findIndex(order, r => r === a.id)
190
- const bi = findIndex(order, r => r === b.id)
189
+ const ai = order.findIndex(r => r === a.id)
190
+ const bi = order.findIndex(r => r === b.id)
191
191
  return ai - bi
192
192
  })
193
193
  }
@@ -285,8 +285,8 @@ export default (Store) => {
285
285
  if (isJSON(strOrder)) {
286
286
  strOrder = JSON.parse(strOrder)
287
287
  arr.sort((a, b) => {
288
- const ai = findIndex(strOrder, r => r === a.id)
289
- const bi = findIndex(strOrder, r => r === b.id)
288
+ const ai = strOrder.findIndex(r => r === a.id)
289
+ const bi = strOrder.findIndex(r => r === b.id)
290
290
  return ai - bi
291
291
  })
292
292
  }
@@ -372,8 +372,8 @@ export default (Store) => {
372
372
  const order = await getData(`${n}:order`)
373
373
  if (order && order.length) {
374
374
  objs[n].sort((a, b) => {
375
- const ai = findIndex(order, r => r === a.id)
376
- const bi = findIndex(order, r => r === b.id)
375
+ const ai = order.findIndex(r => r === a.id)
376
+ const bi = order.findIndex(r => r === b.id)
377
377
  return ai - bi
378
378
  })
379
379
  }
@@ -489,7 +489,6 @@ export default (Store) => {
489
489
  'hideIP',
490
490
  'terminalTimeout',
491
491
  'theme',
492
- 'terminalTypes',
493
492
  'language',
494
493
  'copyWhenSelect',
495
494
  'customCss',