@electerm/electerm-react 1.51.1 → 1.51.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/common/constants.js +1 -2
- package/client/common/db.js +10 -9
- package/client/components/batch-op/batch-op.jsx +16 -5
- package/client/components/bookmark-form/index.jsx +1 -1
- package/client/components/bookmark-form/ssh-form.jsx +3 -23
- package/client/components/bookmark-form/use-submit.jsx +6 -15
- package/client/components/context-menu/context-menu.styl +5 -5
- package/client/components/context-menu/history.jsx +2 -11
- package/client/components/context-menu/sub-tab-menu.jsx +1 -1
- package/client/components/footer/batch-input.jsx +10 -10
- package/client/components/footer/footer-entry.jsx +3 -8
- package/client/components/footer/tab-select.jsx +2 -2
- package/client/components/layout/layout-item.jsx +2 -2
- package/client/components/layout/layout.jsx +7 -7
- package/client/components/main/main.jsx +9 -5
- package/client/components/session/session.jsx +22 -3
- package/client/components/session/session.styl +3 -2
- package/client/components/session/sessions.jsx +4 -4
- package/client/components/setting-panel/list.styl +0 -1
- package/client/components/setting-panel/on-tree-drop.js +5 -5
- package/client/components/setting-panel/setting-modal.jsx +0 -12
- package/client/components/sftp/confirm-modal-store.jsx +0 -7
- package/client/components/sftp/file-mode-modal.jsx +2 -2
- package/client/components/sftp/sftp-entry.jsx +2 -2
- package/client/components/sftp/transfer-conflict-store.jsx +69 -66
- package/client/components/sftp/transport-action-store.jsx +32 -50
- package/client/components/sftp/transports-action-store.jsx +15 -15
- package/client/components/sftp/transports-ui-store.jsx +9 -5
- package/client/components/shortcuts/shortcut-control.jsx +3 -3
- package/client/components/sidebar/bookmark-select.jsx +1 -1
- package/client/components/sidebar/bookmark.jsx +4 -63
- package/client/components/sidebar/history-item.jsx +34 -0
- package/client/components/sidebar/history.jsx +17 -52
- package/client/components/sidebar/index.jsx +4 -34
- package/client/components/sidebar/sidebar-panel.jsx +107 -0
- package/client/components/sidebar/sidebar.styl +14 -0
- package/client/components/sidebar/transfer-list-control.jsx +1 -0
- package/client/components/sidebar/transfer.styl +1 -1
- package/client/components/sidebar/transport-ui.jsx +179 -37
- package/client/components/tabs/index.jsx +12 -12
- package/client/components/tabs/tab.jsx +23 -14
- package/client/components/terminal/index.jsx +12 -15
- package/client/components/terminal/term-search.jsx +4 -4
- package/client/components/tree-list/tree-list.jsx +8 -10
- package/client/entry/worker.js +5 -3
- package/client/store/bookmark-group.js +3 -5
- package/client/store/common.js +11 -1
- package/client/store/db-upgrade.js +0 -2
- package/client/store/event.js +1 -1
- package/client/store/index.js +2 -5
- package/client/store/init-state.js +9 -8
- package/client/store/item.js +0 -19
- package/client/store/load-data.js +2 -0
- package/client/store/quick-command.js +1 -1
- package/client/store/session.js +1 -1
- package/client/store/setting.js +2 -51
- package/client/store/sidebar.js +7 -8
- package/client/store/sync.js +7 -7
- package/client/store/tab.js +102 -34
- package/client/store/transfer-history.js +3 -9
- package/client/store/transfer-list.js +75 -75
- package/client/store/watch.js +13 -5
- package/package.json +1 -1
- package/client/components/setting-panel/tab-history.jsx +0 -43
package/client/store/tab.js
CHANGED
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
* tabs related functions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { debounce } from 'lodash-es'
|
|
5
|
+
import { debounce, isEqual } from 'lodash-es'
|
|
6
6
|
import {
|
|
7
7
|
splitConfig,
|
|
8
8
|
statusMap,
|
|
9
|
-
paneMap
|
|
9
|
+
paneMap,
|
|
10
|
+
maxHistory
|
|
10
11
|
} from '../common/constants'
|
|
11
12
|
import * as ls from '../common/safe-local-storage'
|
|
12
13
|
import deepCopy from 'json-deep-copy'
|
|
13
14
|
import generate from '../common/id-with-stamp'
|
|
15
|
+
import uid from '../common/uid'
|
|
14
16
|
import newTerm from '../common/new-terminal.js'
|
|
17
|
+
import { action } from 'manate'
|
|
15
18
|
|
|
16
19
|
export default Store => {
|
|
17
20
|
Store.prototype.getTabs = function () {
|
|
@@ -60,10 +63,10 @@ export default Store => {
|
|
|
60
63
|
const closingTab = tabs[i]
|
|
61
64
|
if (closingTab.batch === targetBatch) {
|
|
62
65
|
// Handle current tab closure
|
|
63
|
-
if (closingTab.id === store.
|
|
64
|
-
store.
|
|
65
|
-
} else if (closingTab.id === store[`
|
|
66
|
-
store[`
|
|
66
|
+
if (closingTab.id === store.activeTabId) {
|
|
67
|
+
store.activeTabId = id
|
|
68
|
+
} else if (closingTab.id === store[`activeTabId${targetBatch}`]) {
|
|
69
|
+
store[`activeTabId${targetBatch}`] = id
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
tabs.splice(i, 1)
|
|
@@ -71,7 +74,7 @@ export default Store => {
|
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
|
|
74
|
-
Store.prototype.reloadTab = function (tabId = window.store.
|
|
77
|
+
Store.prototype.reloadTab = function (tabId = window.store.activeTabId) {
|
|
75
78
|
const { store } = window
|
|
76
79
|
const { tabs } = store
|
|
77
80
|
const index = tabs.findIndex(t => t.id === tabId)
|
|
@@ -82,6 +85,7 @@ export default Store => {
|
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
const oldTab = tabs[index]
|
|
88
|
+
const oldBatch = oldTab.batch
|
|
85
89
|
|
|
86
90
|
// Create copy of old tab with new ID
|
|
87
91
|
const newTab = {
|
|
@@ -92,17 +96,18 @@ export default Store => {
|
|
|
92
96
|
|
|
93
97
|
// Add new tab at next index
|
|
94
98
|
tabs.splice(index + 1, 0, newTab)
|
|
99
|
+
store.updateHistory(newTab)
|
|
95
100
|
|
|
96
101
|
// Remove old tab
|
|
97
102
|
tabs.splice(index, 1)
|
|
98
103
|
|
|
99
104
|
// Update current tab ID if needed
|
|
100
|
-
if (store.
|
|
101
|
-
store.
|
|
105
|
+
if (store.activeTabId === tabId) {
|
|
106
|
+
store.activeTabId = newTab.id
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
// Update batch current tab ID if needed
|
|
105
|
-
const batchProp = `
|
|
110
|
+
const batchProp = `activeTabId${oldBatch}`
|
|
106
111
|
if (store[batchProp] === tabId) {
|
|
107
112
|
store[batchProp] = newTab.id
|
|
108
113
|
}
|
|
@@ -128,10 +133,11 @@ export default Store => {
|
|
|
128
133
|
|
|
129
134
|
// Insert the duplicated tab after the source tab
|
|
130
135
|
tabs.splice(targetIndex + 1, 0, duplicatedTab)
|
|
136
|
+
store.updateHistory(duplicatedTab)
|
|
131
137
|
|
|
132
138
|
// Set the duplicated tab as current
|
|
133
|
-
store.
|
|
134
|
-
store[`
|
|
139
|
+
store.activeTabId = duplicatedTab.id
|
|
140
|
+
store[`activeTabId${sourceTab.batch}`] = duplicatedTab.id
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
Store.prototype.closeOtherTabs = function (id) {
|
|
@@ -146,11 +152,11 @@ export default Store => {
|
|
|
146
152
|
for (let i = tabs.length - 1; i >= 0; i--) {
|
|
147
153
|
const tab = tabs[i]
|
|
148
154
|
if (tab.batch === currentBatch && tab.id !== id) {
|
|
149
|
-
if (tab.id === store.
|
|
150
|
-
store.
|
|
155
|
+
if (tab.id === store.activeTabId) {
|
|
156
|
+
store.activeTabId = id
|
|
151
157
|
}
|
|
152
|
-
if (tab.id === store[`
|
|
153
|
-
store[`
|
|
158
|
+
if (tab.id === store[`activeTabId${currentBatch}`]) {
|
|
159
|
+
store[`activeTabId${currentBatch}`] = id
|
|
154
160
|
}
|
|
155
161
|
tabs.splice(i, 1)
|
|
156
162
|
}
|
|
@@ -208,7 +214,7 @@ export default Store => {
|
|
|
208
214
|
const store = window.store
|
|
209
215
|
const removedSet = new Set(removedIds)
|
|
210
216
|
const batchFirstTabs = {}
|
|
211
|
-
const currentIdNeedFix = removedSet.has(store.
|
|
217
|
+
const currentIdNeedFix = removedSet.has(store.activeTabId)
|
|
212
218
|
|
|
213
219
|
// Get first valid tab for each batch
|
|
214
220
|
for (const tab of remainingTabs) {
|
|
@@ -220,23 +226,23 @@ export default Store => {
|
|
|
220
226
|
// If current tab was removed, we need to set a new one
|
|
221
227
|
if (currentIdNeedFix) {
|
|
222
228
|
// Try to find current batch's first tab
|
|
223
|
-
const currentTab = remainingTabs.find(t => t.id === store.
|
|
229
|
+
const currentTab = remainingTabs.find(t => t.id === store.activeTabId)
|
|
224
230
|
const currentBatch = currentTab ? currentTab.batch : store.currentLayoutBatch
|
|
225
231
|
const newCurrentId = batchFirstTabs[currentBatch] || batchFirstTabs[0] || ''
|
|
226
232
|
|
|
227
233
|
if (newCurrentId) {
|
|
228
|
-
store.
|
|
234
|
+
store.activeTabId = newCurrentId
|
|
229
235
|
// Also update the batch-specific current tab id
|
|
230
|
-
store[`
|
|
236
|
+
store[`activeTabId${currentBatch}`] = newCurrentId
|
|
231
237
|
} else {
|
|
232
238
|
// No tabs left in any batch
|
|
233
|
-
store.
|
|
239
|
+
store.activeTabId = ''
|
|
234
240
|
}
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
// Fix batch-specific current tab IDs
|
|
238
244
|
for (const batch in batchFirstTabs) {
|
|
239
|
-
const batchTabId = `
|
|
245
|
+
const batchTabId = `activeTabId${batch}`
|
|
240
246
|
const currentBatchId = store[batchTabId]
|
|
241
247
|
|
|
242
248
|
// If the batch's current tab was removed or doesn't exist
|
|
@@ -284,10 +290,10 @@ export default Store => {
|
|
|
284
290
|
store.currentLayoutBatch = batch
|
|
285
291
|
|
|
286
292
|
// Update current tab id
|
|
287
|
-
store.
|
|
293
|
+
store.activeTabId = id
|
|
288
294
|
|
|
289
295
|
// Update batch-specific current tab id
|
|
290
|
-
store[`
|
|
296
|
+
store[`activeTabId${batch}`] = id
|
|
291
297
|
}
|
|
292
298
|
|
|
293
299
|
Store.prototype.addTab = function (
|
|
@@ -304,9 +310,10 @@ export default Store => {
|
|
|
304
310
|
tabs.push(newTab)
|
|
305
311
|
}
|
|
306
312
|
const batchNum = newTab.batch
|
|
307
|
-
store[`
|
|
308
|
-
store.
|
|
313
|
+
store[`activeTabId${batchNum}`] = newTab.id
|
|
314
|
+
store.activeTabId = newTab.id
|
|
309
315
|
store.currentLayoutBatch = batchNum
|
|
316
|
+
store.updateHistory(newTab)
|
|
310
317
|
}
|
|
311
318
|
|
|
312
319
|
Store.prototype.clickNextTab = debounce(function () {
|
|
@@ -319,10 +326,10 @@ export default Store => {
|
|
|
319
326
|
|
|
320
327
|
Store.prototype.clickBioTab = function (diff) {
|
|
321
328
|
const { store } = window
|
|
322
|
-
const { tabs,
|
|
329
|
+
const { tabs, activeTabId } = store
|
|
323
330
|
|
|
324
331
|
// Find the current tab index and its batch
|
|
325
|
-
const currentIndex = tabs.findIndex(t => t.id ===
|
|
332
|
+
const currentIndex = tabs.findIndex(t => t.id === activeTabId)
|
|
326
333
|
if (currentIndex === -1) return // Current tab not found, do nothing
|
|
327
334
|
|
|
328
335
|
const currentBatch = tabs[currentIndex].batch
|
|
@@ -342,9 +349,9 @@ export default Store => {
|
|
|
342
349
|
// Find the next tab index
|
|
343
350
|
const nextIndex = findNextTabIndex(currentIndex, diff)
|
|
344
351
|
|
|
345
|
-
// If a valid next tab is found, update the
|
|
352
|
+
// If a valid next tab is found, update the activeTabId
|
|
346
353
|
if (nextIndex !== -1 && nextIndex !== currentIndex) {
|
|
347
|
-
store.
|
|
354
|
+
store.activeTabId = tabs[nextIndex].id
|
|
348
355
|
}
|
|
349
356
|
}
|
|
350
357
|
|
|
@@ -376,11 +383,11 @@ export default Store => {
|
|
|
376
383
|
Store.prototype.setLayout = function (layout) {
|
|
377
384
|
const { store } = window
|
|
378
385
|
const prevLayout = store.layout
|
|
379
|
-
const {
|
|
386
|
+
const { activeTabId } = store
|
|
380
387
|
|
|
381
388
|
// If layout hasn't changed, do nothing
|
|
382
389
|
if (prevLayout === layout) {
|
|
383
|
-
return
|
|
390
|
+
return store.focus()
|
|
384
391
|
}
|
|
385
392
|
|
|
386
393
|
// Update layout related properties
|
|
@@ -400,8 +407,8 @@ export default Store => {
|
|
|
400
407
|
const tab = store.tabs[i]
|
|
401
408
|
if (tab.batch >= newBatchCount) {
|
|
402
409
|
store.tabs[i].batch = nb
|
|
403
|
-
if (tab.id ===
|
|
404
|
-
store[`
|
|
410
|
+
if (tab.id === activeTabId) {
|
|
411
|
+
store[`activeTabId${nb}`] = activeTabId
|
|
405
412
|
}
|
|
406
413
|
}
|
|
407
414
|
}
|
|
@@ -413,4 +420,65 @@ export default Store => {
|
|
|
413
420
|
}
|
|
414
421
|
store.focus()
|
|
415
422
|
}
|
|
423
|
+
|
|
424
|
+
Store.prototype.changeActiveTabId = function (id) {
|
|
425
|
+
const { store } = window
|
|
426
|
+
const { tabs } = store
|
|
427
|
+
const tab = tabs.find(t => t.id === id)
|
|
428
|
+
if (!tab) {
|
|
429
|
+
return
|
|
430
|
+
}
|
|
431
|
+
store.activeTabId = id
|
|
432
|
+
store[`activeTabId${tab.batch}`] = id
|
|
433
|
+
store.focus()
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
Store.prototype.updateHistory = function (tab) {
|
|
437
|
+
if (!tab.type && !tab.host) {
|
|
438
|
+
return
|
|
439
|
+
}
|
|
440
|
+
const { store } = window
|
|
441
|
+
const tabPropertiesExcludes = [
|
|
442
|
+
'id',
|
|
443
|
+
'from',
|
|
444
|
+
'srcId',
|
|
445
|
+
'status',
|
|
446
|
+
'pane',
|
|
447
|
+
'batch'
|
|
448
|
+
]
|
|
449
|
+
const { history } = store
|
|
450
|
+
const index = history.findIndex(d => {
|
|
451
|
+
for (const key in tab) {
|
|
452
|
+
if (tabPropertiesExcludes.includes(key)) {
|
|
453
|
+
continue
|
|
454
|
+
}
|
|
455
|
+
if (!isEqual(d.tab[key], tab[key])) {
|
|
456
|
+
return false
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return true
|
|
460
|
+
})
|
|
461
|
+
if (index === -1) {
|
|
462
|
+
const copiedTab = deepCopy(tab)
|
|
463
|
+
tabPropertiesExcludes.forEach(d => {
|
|
464
|
+
delete copiedTab[d]
|
|
465
|
+
})
|
|
466
|
+
return history.unshift({
|
|
467
|
+
tab: copiedTab,
|
|
468
|
+
time: Date.now(),
|
|
469
|
+
count: 1,
|
|
470
|
+
id: uid()
|
|
471
|
+
})
|
|
472
|
+
}
|
|
473
|
+
const match = history[index]
|
|
474
|
+
match.count = (match.count || 0) + 1
|
|
475
|
+
match.time = Date.now()
|
|
476
|
+
action(function () {
|
|
477
|
+
const [m] = history.splice(index, 1)
|
|
478
|
+
history.unshift(m)
|
|
479
|
+
if (history.length > maxHistory) {
|
|
480
|
+
history.pop()
|
|
481
|
+
}
|
|
482
|
+
})()
|
|
483
|
+
}
|
|
416
484
|
}
|
|
@@ -4,20 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
export default Store => {
|
|
6
6
|
Store.prototype.clearTransferHistory = function () {
|
|
7
|
-
window.store.
|
|
7
|
+
window.store.transferHistory = []
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
Store.prototype.getTransferHistory = function () {
|
|
11
|
-
return window.store.
|
|
11
|
+
return window.store.transferHistory
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
Store.prototype.addTransferHistory = function (item) {
|
|
15
|
-
|
|
16
|
-
const transferHistory = store.getItems('transferHistory')
|
|
17
|
-
transferHistory.unshift(item)
|
|
18
|
-
store.setItems(
|
|
19
|
-
'transferHistory',
|
|
20
|
-
transferHistory
|
|
21
|
-
)
|
|
15
|
+
window.store.transferHistory.unshift(item)
|
|
22
16
|
}
|
|
23
17
|
}
|
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* file transfer list related functions
|
|
3
|
+
*/
|
|
4
|
+
const { assign } = Object
|
|
5
|
+
|
|
2
6
|
export default Store => {
|
|
3
7
|
Store.prototype.handleTransferTab = function (tab) {
|
|
4
8
|
window.store.transferTab = tab
|
|
5
9
|
}
|
|
6
10
|
|
|
7
|
-
Store.prototype.
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return t.sessionId === sessId
|
|
13
|
-
})
|
|
14
|
-
const idsToRm = arr2.reduce((prev, curr) => {
|
|
15
|
-
if (!list.find(l => l.id === curr.id)) {
|
|
16
|
-
prev.push(curr.id)
|
|
17
|
-
}
|
|
18
|
-
return prev
|
|
19
|
-
}, [])
|
|
20
|
-
if (idsToRm.length) {
|
|
21
|
-
oldList = oldList.filter(t => {
|
|
22
|
-
return !idsToRm.includes(t.id)
|
|
23
|
-
})
|
|
24
|
-
}
|
|
25
|
-
for (const ntm of list) {
|
|
26
|
-
const index = findIndex(oldList, t => {
|
|
27
|
-
return t.id === ntm.id
|
|
28
|
-
})
|
|
29
|
-
if (index >= 0) {
|
|
30
|
-
oldList[index] = ntm
|
|
31
|
-
continue
|
|
32
|
-
} else {
|
|
33
|
-
oldList.unshift(ntm)
|
|
34
|
-
}
|
|
11
|
+
Store.prototype.updateTransfer = function (id, update) {
|
|
12
|
+
const { fileTransfers } = window.store
|
|
13
|
+
const index = fileTransfers.findIndex(t => t.id === id)
|
|
14
|
+
if (index < 0) {
|
|
15
|
+
return
|
|
35
16
|
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
Store.prototype.getTransfers = function () {
|
|
39
|
-
return window.store.getItems('fileTransfers')
|
|
40
|
-
}
|
|
41
|
-
Store.prototype.delTransfers = function (ids) {
|
|
42
|
-
return window.store.delItems(ids, 'fileTransfers')
|
|
43
|
-
}
|
|
44
|
-
Store.prototype.editTransfer = function (id, updates) {
|
|
45
|
-
return window.store.editItem(id, updates, 'fileTransfers')
|
|
46
|
-
}
|
|
47
|
-
Store.prototype.addTransfers = function (objs) {
|
|
48
|
-
return window.store.addItems(objs, 'fileTransfers')
|
|
17
|
+
assign(fileTransfers[index], update)
|
|
49
18
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const { store } = window
|
|
55
|
-
store.setFileTransfers([
|
|
56
|
-
...store.fileTransfers,
|
|
57
|
-
...objs
|
|
58
|
-
])
|
|
19
|
+
|
|
20
|
+
Store.prototype.addTransferList = function (items) {
|
|
21
|
+
const { fileTransfers } = window.store
|
|
22
|
+
fileTransfers.push(...items)
|
|
59
23
|
}
|
|
24
|
+
|
|
60
25
|
Store.prototype.toggleTransfer = function (itemId) {
|
|
61
|
-
const {
|
|
62
|
-
const
|
|
63
|
-
const index = findIndex(fileTransfers, t => t.id === itemId)
|
|
26
|
+
const { fileTransfers } = window.store
|
|
27
|
+
const index = fileTransfers.findIndex(t => t.id === itemId)
|
|
64
28
|
if (index < 0) {
|
|
65
29
|
return
|
|
66
30
|
}
|
|
67
31
|
fileTransfers[index].pausing = !fileTransfers[index].pausing
|
|
68
|
-
store.setFileTransfers(fileTransfers)
|
|
69
32
|
}
|
|
70
33
|
|
|
71
34
|
Store.prototype.pauseAll = function () {
|
|
72
|
-
const {
|
|
73
|
-
store.pauseAllTransfer = true
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
35
|
+
const { fileTransfers } = window.store
|
|
36
|
+
window.store.pauseAllTransfer = true
|
|
37
|
+
const len = fileTransfers.length
|
|
38
|
+
for (let i = 0; i < len; i++) {
|
|
39
|
+
fileTransfers[i].pausing = true
|
|
40
|
+
}
|
|
78
41
|
}
|
|
42
|
+
|
|
79
43
|
Store.prototype.resumeAll = function () {
|
|
80
|
-
const {
|
|
81
|
-
store.pauseAllTransfer = false
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
44
|
+
const { fileTransfers } = window.store
|
|
45
|
+
window.store.pauseAllTransfer = false
|
|
46
|
+
const len = fileTransfers.length
|
|
47
|
+
for (let i = 0; i < len; i++) {
|
|
48
|
+
fileTransfers[i].pausing = false
|
|
49
|
+
}
|
|
86
50
|
}
|
|
51
|
+
|
|
87
52
|
Store.prototype.cancelAll = function () {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
53
|
+
const { fileTransfers } = window.store
|
|
54
|
+
const len = fileTransfers.length
|
|
55
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
56
|
+
fileTransfers[i].cancel = true
|
|
57
|
+
fileTransfers.splice(i, 1)
|
|
58
|
+
}
|
|
92
59
|
}
|
|
60
|
+
|
|
93
61
|
Store.prototype.cancelTransfer = function (itemId) {
|
|
94
|
-
const {
|
|
95
|
-
const
|
|
96
|
-
const index = findIndex(fileTransfers, t => t.id === itemId)
|
|
62
|
+
const { fileTransfers } = window.store
|
|
63
|
+
const index = fileTransfers.findIndex(t => t.id === itemId)
|
|
97
64
|
if (index < 0) {
|
|
98
65
|
return
|
|
99
66
|
}
|
|
100
67
|
fileTransfers[index].cancel = true
|
|
101
|
-
|
|
68
|
+
fileTransfers.splice(index, 1)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Store.prototype.removeTransfer = function (id) {
|
|
72
|
+
const { fileTransfers } = window.store
|
|
73
|
+
const index = fileTransfers.findIndex(t => t.id === id)
|
|
74
|
+
if (index > -1) {
|
|
75
|
+
fileTransfers.splice(index, 1)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Store.prototype.skipAllTransfersSinceIndex = function (index) {
|
|
80
|
+
window.store.fileTransfers.splice(index)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Store.prototype.updateTransfersFromIndex = function (index, update) {
|
|
84
|
+
const { fileTransfers } = window.store
|
|
85
|
+
if (index < 0 || index >= fileTransfers.length) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
const len = fileTransfers.length
|
|
89
|
+
for (let i = index; i < len; i++) {
|
|
90
|
+
assign(fileTransfers[i], update)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Add a new method to find index by ID and then update
|
|
95
|
+
Store.prototype.updateTransfersFromId = function (id, update) {
|
|
96
|
+
const { fileTransfers } = window.store
|
|
97
|
+
const index = fileTransfers.findIndex(t => t.id === id)
|
|
98
|
+
if (index < 0) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
window.store.updateTransfersFromIndex(index, update)
|
|
102
102
|
}
|
|
103
103
|
}
|
package/client/store/watch.js
CHANGED
|
@@ -20,7 +20,7 @@ export default store => {
|
|
|
20
20
|
// store.focus()
|
|
21
21
|
// // store.termSearchOpen = false
|
|
22
22
|
// store.termSearchMatchCount = 0
|
|
23
|
-
// return store.
|
|
23
|
+
// return store.activeTabId
|
|
24
24
|
// }).start()
|
|
25
25
|
|
|
26
26
|
// autoRun(() => {
|
|
@@ -43,7 +43,7 @@ export default store => {
|
|
|
43
43
|
await store.uploadSettingAll()
|
|
44
44
|
}
|
|
45
45
|
return store['_' + name]
|
|
46
|
-
}
|
|
46
|
+
}).start()
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
autoRun(async () => {
|
|
@@ -97,15 +97,23 @@ export default store => {
|
|
|
97
97
|
return store._checkedKeys
|
|
98
98
|
}).start()
|
|
99
99
|
|
|
100
|
+
autoRun(() => {
|
|
101
|
+
ls.setItemJSON('history', store.history)
|
|
102
|
+
return store.history
|
|
103
|
+
}).start()
|
|
104
|
+
|
|
100
105
|
autoRun(() => {
|
|
101
106
|
const tabs = store.getTabs()
|
|
102
|
-
const {
|
|
103
|
-
const tab = tabs.find(t => t.id ===
|
|
107
|
+
const { activeTabId } = store
|
|
108
|
+
const tab = tabs.find(t => t.id === activeTabId)
|
|
104
109
|
if (tab) {
|
|
105
110
|
const title = createTitle(tab)
|
|
106
111
|
window.pre.runGlobalAsync('setTitle', title)
|
|
107
112
|
window.store.currentLayoutBatch = tab.batch
|
|
108
113
|
}
|
|
109
|
-
|
|
114
|
+
if (tab && store.rightPanelVisible) {
|
|
115
|
+
window.store.openInfoPanel()
|
|
116
|
+
}
|
|
117
|
+
return store.activeTabId
|
|
110
118
|
}).start()
|
|
111
119
|
}
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import SettingCol from './col'
|
|
2
|
-
import BookmarkForm from '../bookmark-form'
|
|
3
|
-
import List from './list'
|
|
4
|
-
import {
|
|
5
|
-
settingMap
|
|
6
|
-
} from '../../common/constants'
|
|
7
|
-
|
|
8
|
-
const e = window.translate
|
|
9
|
-
|
|
10
|
-
export default function TabHistory (props) {
|
|
11
|
-
const {
|
|
12
|
-
settingTab
|
|
13
|
-
} = props
|
|
14
|
-
if (settingTab !== settingMap.history) {
|
|
15
|
-
return null
|
|
16
|
-
}
|
|
17
|
-
const {
|
|
18
|
-
settingItem,
|
|
19
|
-
listProps,
|
|
20
|
-
formProps
|
|
21
|
-
} = props
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className='setting-tabs-history'
|
|
25
|
-
>
|
|
26
|
-
<SettingCol>
|
|
27
|
-
<List
|
|
28
|
-
{...listProps}
|
|
29
|
-
/>
|
|
30
|
-
{
|
|
31
|
-
settingItem.id
|
|
32
|
-
? (
|
|
33
|
-
<BookmarkForm
|
|
34
|
-
key={settingItem.id}
|
|
35
|
-
{...formProps}
|
|
36
|
-
/>
|
|
37
|
-
)
|
|
38
|
-
: <div className='form-wrap pd2 aligncenter'>{e('notFoundContent')}</div>
|
|
39
|
-
}
|
|
40
|
-
</SettingCol>
|
|
41
|
-
</div>
|
|
42
|
-
)
|
|
43
|
-
}
|