@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.
- package/client/common/constants.js +57 -7
- package/client/common/new-terminal.js +2 -2
- package/client/components/auth/login.jsx +34 -57
- package/client/components/batch-op/batch-op.jsx +12 -11
- package/client/components/bookmark-form/index.jsx +2 -2
- package/client/components/bookmark-form/ssh-form.jsx +4 -1
- package/client/components/bookmark-form/tree-delete.jsx +5 -5
- package/client/components/context-menu/boomarks.jsx +8 -12
- package/client/components/context-menu/context-menu.jsx +10 -10
- package/client/components/context-menu/history.jsx +21 -24
- package/client/components/context-menu/menu-btn.jsx +11 -11
- package/client/components/context-menu/tabs.jsx +15 -19
- package/client/components/context-menu/zoom.jsx +25 -29
- package/client/components/footer/footer-entry.jsx +56 -56
- package/client/components/icons/split-icons.jsx +77 -0
- package/client/components/layout/layout-alg.js +260 -0
- package/client/components/layout/layout-item.jsx +26 -0
- package/client/components/layout/layout.jsx +167 -0
- package/client/components/layout/layout.styl +5 -0
- package/client/components/layout/layouts.jsx +71 -0
- package/client/components/layout/session-size-alg.js +31 -0
- package/client/components/main/main.jsx +183 -109
- package/client/components/main/wrapper.styl +2 -4
- package/client/components/profile/profile-list.jsx +1 -3
- package/client/components/profile/profile-transport-mod.jsx +1 -1
- package/client/components/profile/profile-transport.jsx +6 -9
- package/client/components/quick-commands/quick-command-transport.jsx +6 -9
- package/client/components/quick-commands/quick-commands-box.jsx +144 -153
- package/client/components/quick-commands/quick-commands-select.jsx +10 -3
- package/client/components/rdp/rdp-session.jsx +3 -23
- package/client/components/rdp/resolution-edit.jsx +40 -42
- package/client/components/session/session.jsx +62 -317
- package/client/components/session/session.styl +1 -5
- package/client/components/session/sessions.jsx +99 -105
- package/client/components/setting-panel/bookmark-tree-list.jsx +1 -1
- package/client/components/setting-panel/setting-common.jsx +6 -4
- package/client/components/setting-panel/setting-modal.jsx +31 -31
- package/client/components/setting-panel/start-session-select.jsx +4 -4
- package/client/components/setting-panel/tab-settings.jsx +27 -5
- package/client/components/setting-sync/data-import.jsx +36 -39
- package/client/components/setting-sync/setting-sync-form.jsx +9 -9
- package/client/components/setting-sync/setting-sync.jsx +50 -52
- package/client/components/sftp/address-bookmark.jsx +57 -58
- package/client/components/sftp/confirm-modal-store.jsx +34 -40
- package/client/components/sftp/file-item.jsx +14 -3
- package/client/components/sftp/file-mode-modal.jsx +3 -0
- package/client/components/sftp/list-table-ui.jsx +4 -4
- package/client/components/sftp/sftp-entry.jsx +2 -2
- package/client/components/sftp/transfer-conflict-store.jsx +13 -17
- package/client/components/sftp/transport-action-store.jsx +38 -31
- package/client/components/sftp/transports-action-store.jsx +3 -3
- package/client/components/sftp/transports-ui-store.jsx +18 -23
- package/client/components/shortcuts/shortcut-handler.js +1 -0
- package/client/components/shortcuts/shortcuts.jsx +9 -12
- package/client/components/side-panel-r/right-side-panel.styl +40 -0
- package/client/components/side-panel-r/side-panel-r.jsx +102 -0
- package/client/components/sidebar/bookmark-select.jsx +40 -40
- package/client/components/sidebar/bookmark.jsx +63 -65
- package/client/components/sidebar/history.jsx +53 -50
- package/client/components/sidebar/index.jsx +195 -184
- package/client/components/sidebar/info-modal.jsx +202 -202
- package/client/components/sidebar/sidebar.styl +8 -2
- package/client/components/sidebar/transfer-history-modal.jsx +95 -100
- package/client/components/sidebar/transfer-list-control.jsx +2 -2
- package/client/components/sidebar/transfer-list.jsx +45 -42
- package/client/components/sidebar/transfer-modal.jsx +49 -52
- package/client/components/sidebar/transport-ui.jsx +1 -1
- package/client/components/tabs/index.jsx +261 -49
- package/client/components/tabs/tab.jsx +60 -65
- package/client/components/tabs/tabs.styl +6 -1
- package/client/components/tabs/window-control.jsx +46 -48
- package/client/components/terminal/index.jsx +101 -104
- package/client/components/terminal/term-search.jsx +26 -24
- package/client/components/terminal-info/run-cmd.jsx +0 -25
- package/client/components/terminal-info/terminal-info.jsx +60 -0
- package/client/components/terminal-info/terminal-info.styl +1 -1
- package/client/components/tree-list/bookmark-transport.jsx +8 -9
- package/client/components/tree-list/tree-list.jsx +36 -26
- package/client/components/vnc/vnc-session.jsx +1 -6
- package/client/store/common.js +1 -1
- package/client/store/event.js +2 -2
- package/client/store/index.js +21 -32
- package/client/store/init-state.js +15 -3
- package/client/store/load-data.js +1 -1
- package/client/store/quick-command.js +4 -4
- package/client/store/session.js +1 -1
- package/client/store/setting.js +9 -5
- package/client/store/system-menu.js +1 -10
- package/client/store/tab.js +66 -1
- package/client/store/transfer-list.js +5 -6
- package/client/store/watch.js +11 -6
- package/package.json +1 -1
- package/client/components/common/react-subx.jsx +0 -1
- package/client/components/common/resize-wrap.jsx +0 -222
- package/client/components/common/resize-wrap.styl +0 -9
- package/client/components/terminal-info/content.jsx +0 -152
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import { Component } from '
|
|
2
|
-
import Session from './session'
|
|
1
|
+
import { Component } from 'react'
|
|
2
|
+
import Session from './session.jsx'
|
|
3
3
|
import WebSession from '../web/web-session.jsx'
|
|
4
4
|
import { findIndex, pick } from 'lodash-es'
|
|
5
5
|
import classNames from 'classnames'
|
|
6
|
-
import generate from '../../common/
|
|
6
|
+
import generate from '../../common/id-with-stamp'
|
|
7
7
|
import copy from 'json-deep-copy'
|
|
8
|
-
import wait from '../../common/wait'
|
|
9
|
-
import Tabs from '../tabs'
|
|
8
|
+
import wait from '../../common/wait.js'
|
|
9
|
+
import Tabs from '../tabs/index.jsx'
|
|
10
10
|
import {
|
|
11
11
|
commonActions,
|
|
12
12
|
tabActions,
|
|
13
|
-
termInitId,
|
|
14
13
|
paneMap,
|
|
15
14
|
statusMap,
|
|
16
15
|
terminalWebType
|
|
17
|
-
} from '../../common/constants'
|
|
18
|
-
import newTerm, { updateCount } from '../../common/new-terminal'
|
|
19
|
-
import postMsg from '../../common/post-msg'
|
|
20
|
-
|
|
21
|
-
import
|
|
22
|
-
import QuickCommandsFooterBox from '../quick-commands/quick-commands-box'
|
|
23
|
-
import LogoElem from '../common/logo-elem'
|
|
16
|
+
} from '../../common/constants.js'
|
|
17
|
+
import newTerm, { updateCount } from '../../common/new-terminal.js'
|
|
18
|
+
import postMsg from '../../common/post-msg.js'
|
|
19
|
+
|
|
20
|
+
import LogoElem from '../common/logo-elem.jsx'
|
|
24
21
|
import { Button } from 'antd'
|
|
25
|
-
import toSimpleObj from '../../common/to-simple-obj'
|
|
22
|
+
import toSimpleObj from '../../common/to-simple-obj.js'
|
|
26
23
|
import { shortcutExtend } from '../shortcuts/shortcut-handler.js'
|
|
24
|
+
import deepEqual from 'fast-deep-equal'
|
|
27
25
|
|
|
28
26
|
const e = window.translate
|
|
29
27
|
|
|
30
28
|
class Sessions extends Component {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
constructor (props) {
|
|
30
|
+
super(props)
|
|
31
|
+
this.state = {
|
|
32
|
+
tabs: copy(props.tabs || []),
|
|
33
|
+
currentTabId: props.currentTabId
|
|
34
|
+
}
|
|
35
|
+
this.bindHandleKeyboardEvent = this.handleKeyboardEvent.bind(this)
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
componentDidMount () {
|
|
@@ -38,8 +40,26 @@ class Sessions extends Component {
|
|
|
38
40
|
this.initShortcuts()
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
componentDidUpdate (prevProps) {
|
|
44
|
+
if (
|
|
45
|
+
this.props.tabs &&
|
|
46
|
+
!deepEqual(prevProps.tabs, this.props.tabs)
|
|
47
|
+
) {
|
|
48
|
+
this.setState({
|
|
49
|
+
tabs: copy(this.props.tabs)
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
componentWillUnmount () {
|
|
55
|
+
window.removeEventListener('message', this.onEvent)
|
|
56
|
+
window.removeEventListener('keydown', this.bindHandleKeyboardEvent)
|
|
57
|
+
this.timer && clearTimeout(this.timer)
|
|
58
|
+
this.timer = null
|
|
59
|
+
}
|
|
60
|
+
|
|
41
61
|
initShortcuts () {
|
|
42
|
-
window.addEventListener('keydown', this.
|
|
62
|
+
window.addEventListener('keydown', this.bindHandleKeyboardEvent)
|
|
43
63
|
}
|
|
44
64
|
|
|
45
65
|
closeCurrentTabShortcut = (e) => {
|
|
@@ -61,19 +81,31 @@ class Sessions extends Component {
|
|
|
61
81
|
}
|
|
62
82
|
|
|
63
83
|
updateStoreTabs = (tabs) => {
|
|
64
|
-
|
|
65
|
-
action: commonActions.updateStore,
|
|
66
|
-
func: 'setTabs',
|
|
67
|
-
args: [copy(tabs)]
|
|
68
|
-
})
|
|
84
|
+
window.store.updateStoreTabs(tabs, this.props.batch)
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
updateStoreCurrentTabId = id => {
|
|
88
|
+
if (id) {
|
|
89
|
+
window.store.storeAssign({
|
|
90
|
+
currentTabId: id,
|
|
91
|
+
[id + this.props.batch]: id
|
|
92
|
+
})
|
|
93
|
+
this.setState({
|
|
94
|
+
currentTabId: id
|
|
95
|
+
})
|
|
96
|
+
} else {
|
|
97
|
+
window.store.focus()
|
|
98
|
+
}
|
|
72
99
|
postMsg({
|
|
73
100
|
action: commonActions.updateStore,
|
|
74
101
|
value: id,
|
|
75
102
|
prop: 'currentTabId'
|
|
76
103
|
})
|
|
104
|
+
postMsg({
|
|
105
|
+
action: commonActions.updateStore,
|
|
106
|
+
value: id,
|
|
107
|
+
prop: 'currentTabId' + this.props.batch
|
|
108
|
+
})
|
|
77
109
|
}
|
|
78
110
|
|
|
79
111
|
getCurrentTab = () => {
|
|
@@ -113,6 +145,7 @@ class Sessions extends Component {
|
|
|
113
145
|
} else {
|
|
114
146
|
updateCount(tab)
|
|
115
147
|
}
|
|
148
|
+
tab.batch = this.props.batch
|
|
116
149
|
tabs.splice(index, 0, tab)
|
|
117
150
|
this.updateStoreTabs(tabs)
|
|
118
151
|
this.updateStoreCurrentTabId(tab.id)
|
|
@@ -134,7 +167,7 @@ class Sessions extends Component {
|
|
|
134
167
|
})
|
|
135
168
|
i = i ? i - 1 : i + 1
|
|
136
169
|
const next = tabs[i] || {}
|
|
137
|
-
up.currentTabId = next.id
|
|
170
|
+
up.currentTabId = next.id || ''
|
|
138
171
|
this.updateStoreCurrentTabId(next.id)
|
|
139
172
|
}
|
|
140
173
|
up.tabs = tabs.filter(t => {
|
|
@@ -147,33 +180,17 @@ class Sessions extends Component {
|
|
|
147
180
|
|
|
148
181
|
initFirstTab = () => {
|
|
149
182
|
const tab = newTerm()
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
position: 0
|
|
153
|
-
}]
|
|
183
|
+
const { batch } = this.props
|
|
184
|
+
tab.batch = batch
|
|
154
185
|
this.addTab(tab)
|
|
155
186
|
}
|
|
156
187
|
|
|
157
|
-
processTerminals = (tab) => {
|
|
158
|
-
if (!tab.terminals) {
|
|
159
|
-
return tab
|
|
160
|
-
}
|
|
161
|
-
tab.terminals = tab.terminals.map(t => {
|
|
162
|
-
return {
|
|
163
|
-
...t,
|
|
164
|
-
stateId: t.id,
|
|
165
|
-
id: generate()
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
|
|
170
188
|
reloadTab = async (tabToReload) => {
|
|
171
189
|
this.setState(async oldState => {
|
|
172
190
|
const tab = copy(
|
|
173
191
|
tabToReload
|
|
174
192
|
)
|
|
175
193
|
tab.pane = paneMap.terminal
|
|
176
|
-
this.processTerminals(tab)
|
|
177
194
|
const { id } = tab
|
|
178
195
|
const tabs = copy(oldState.tabs)
|
|
179
196
|
tab.id = generate()
|
|
@@ -185,12 +202,11 @@ class Sessions extends Component {
|
|
|
185
202
|
})
|
|
186
203
|
}
|
|
187
204
|
|
|
188
|
-
onDuplicateTab =
|
|
189
|
-
this.setState(
|
|
205
|
+
onDuplicateTab = (tabToDup) => {
|
|
206
|
+
this.setState(oldState => {
|
|
190
207
|
const defaultStatus = statusMap.processing
|
|
191
208
|
let tab = copy(tabToDup)
|
|
192
209
|
updateCount(tab)
|
|
193
|
-
this.processTerminals(tab)
|
|
194
210
|
const tabs = copy(oldState.tabs)
|
|
195
211
|
const index = findIndex(
|
|
196
212
|
tabs,
|
|
@@ -208,6 +224,11 @@ class Sessions extends Component {
|
|
|
208
224
|
}
|
|
209
225
|
|
|
210
226
|
onChangeTabId = id => {
|
|
227
|
+
const matchedTab = this.state.tabs.find(t => t.id === id)
|
|
228
|
+
if (!matchedTab) {
|
|
229
|
+
return
|
|
230
|
+
}
|
|
231
|
+
this.timer = setTimeout(window.store.triggerResize, 500)
|
|
211
232
|
this.updateStoreCurrentTabId(id)
|
|
212
233
|
this.setState({
|
|
213
234
|
currentTabId: id
|
|
@@ -260,6 +281,7 @@ class Sessions extends Component {
|
|
|
260
281
|
update,
|
|
261
282
|
tab,
|
|
262
283
|
index,
|
|
284
|
+
batch,
|
|
263
285
|
tabIds
|
|
264
286
|
} = e.data || {}
|
|
265
287
|
if (
|
|
@@ -270,7 +292,7 @@ class Sessions extends Component {
|
|
|
270
292
|
this.onChangeTabId(currentTabId)
|
|
271
293
|
} else if (action === tabActions.updateTabs) {
|
|
272
294
|
this.editTab(id, update)
|
|
273
|
-
} else if (action === tabActions.addTab) {
|
|
295
|
+
} else if (action === tabActions.addTab && (batch ?? tab.batch) === this.props.batch) {
|
|
274
296
|
this.addTab(tab, index)
|
|
275
297
|
} else if (action === tabActions.initFirstTab) {
|
|
276
298
|
this.initFirstTab()
|
|
@@ -284,21 +306,22 @@ class Sessions extends Component {
|
|
|
284
306
|
}
|
|
285
307
|
|
|
286
308
|
postChange = () => {
|
|
287
|
-
this.props.
|
|
309
|
+
window.store.currentLayoutBatch = this.props.batch
|
|
310
|
+
window.store.triggerResize()
|
|
288
311
|
}
|
|
289
312
|
|
|
290
313
|
handleNewTab = () => {
|
|
291
|
-
this.
|
|
314
|
+
this.initFirstTab()
|
|
292
315
|
}
|
|
293
316
|
|
|
294
317
|
handleNewSsh = () => {
|
|
295
|
-
|
|
318
|
+
window.store.onNewSsh()
|
|
296
319
|
}
|
|
297
320
|
|
|
298
321
|
renderNoSession = () => {
|
|
299
322
|
const props = {
|
|
300
323
|
style: {
|
|
301
|
-
height: this.props.
|
|
324
|
+
height: this.props.height + 'px'
|
|
302
325
|
}
|
|
303
326
|
}
|
|
304
327
|
return (
|
|
@@ -306,7 +329,7 @@ class Sessions extends Component {
|
|
|
306
329
|
<Button
|
|
307
330
|
onClick={this.handleNewTab}
|
|
308
331
|
size='large'
|
|
309
|
-
className='mg1r mg1b'
|
|
332
|
+
className='mg1r mg1b add-new-tab-btn'
|
|
310
333
|
>
|
|
311
334
|
{e('newTab')}
|
|
312
335
|
</Button>
|
|
@@ -326,13 +349,13 @@ class Sessions extends Component {
|
|
|
326
349
|
|
|
327
350
|
renderSessions () {
|
|
328
351
|
const {
|
|
329
|
-
|
|
352
|
+
config, width, height
|
|
330
353
|
} = this.props
|
|
331
354
|
const {
|
|
332
355
|
currentTabId,
|
|
333
356
|
tabs
|
|
334
357
|
} = this.state
|
|
335
|
-
if (!tabs.length) {
|
|
358
|
+
if (!tabs || !tabs.length) {
|
|
336
359
|
return this.renderNoSession()
|
|
337
360
|
}
|
|
338
361
|
return tabs.map((tab) => {
|
|
@@ -346,19 +369,17 @@ class Sessions extends Component {
|
|
|
346
369
|
const sessProps = {
|
|
347
370
|
currentTabId,
|
|
348
371
|
tab: toSimpleObj(tab),
|
|
349
|
-
|
|
372
|
+
width,
|
|
373
|
+
height,
|
|
374
|
+
...pick(this.props, [
|
|
375
|
+
'batch',
|
|
350
376
|
'resolutions',
|
|
351
377
|
'hideDelKeyTip',
|
|
352
378
|
'fileOperation',
|
|
353
379
|
'file',
|
|
354
|
-
'height',
|
|
355
|
-
'width',
|
|
356
|
-
'activeTerminalId',
|
|
357
380
|
'pinnedQuickCommandBar',
|
|
358
381
|
'tabsHeight',
|
|
359
382
|
'appPath',
|
|
360
|
-
'topMenuHeight',
|
|
361
|
-
'rightSidebarWidth',
|
|
362
383
|
'leftSidebarWidth',
|
|
363
384
|
'pinned',
|
|
364
385
|
'openedSideBar'
|
|
@@ -397,22 +418,25 @@ class Sessions extends Component {
|
|
|
397
418
|
|
|
398
419
|
renderTabs = () => {
|
|
399
420
|
const {
|
|
400
|
-
|
|
401
|
-
|
|
421
|
+
config,
|
|
422
|
+
width,
|
|
423
|
+
height,
|
|
424
|
+
batch,
|
|
425
|
+
layout,
|
|
426
|
+
isMaximized
|
|
402
427
|
} = this.props
|
|
403
428
|
const {
|
|
404
429
|
tabs,
|
|
405
430
|
currentTabId
|
|
406
431
|
} = this.state
|
|
407
432
|
const tabsProps = {
|
|
433
|
+
batch,
|
|
408
434
|
currentTabId,
|
|
409
435
|
config,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
'isMaximized'
|
|
415
|
-
]),
|
|
436
|
+
width,
|
|
437
|
+
height,
|
|
438
|
+
layout,
|
|
439
|
+
isMaximized,
|
|
416
440
|
tabs,
|
|
417
441
|
...pick(this, [
|
|
418
442
|
'setTabs',
|
|
@@ -426,28 +450,16 @@ class Sessions extends Component {
|
|
|
426
450
|
}
|
|
427
451
|
return (
|
|
428
452
|
<Tabs
|
|
429
|
-
key='main-tabs'
|
|
453
|
+
key={'main-tabs' + batch}
|
|
430
454
|
{...tabsProps}
|
|
431
455
|
/>
|
|
432
456
|
)
|
|
433
457
|
}
|
|
434
458
|
|
|
435
459
|
renderSessionsWrap = () => {
|
|
436
|
-
const { leftSidebarWidth, openedSideBar } = this.props.store
|
|
437
|
-
const w = leftSidebarWidth + 42
|
|
438
|
-
const ptp = openedSideBar
|
|
439
|
-
? {
|
|
440
|
-
className: 'sessions',
|
|
441
|
-
style: {
|
|
442
|
-
marginLeft: `${w}px`
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
: {
|
|
446
|
-
className: 'sessions'
|
|
447
|
-
}
|
|
448
460
|
return (
|
|
449
461
|
<div
|
|
450
|
-
|
|
462
|
+
className='sessions'
|
|
451
463
|
key='main-sess'
|
|
452
464
|
>
|
|
453
465
|
{this.renderSessions()}
|
|
@@ -456,30 +468,12 @@ class Sessions extends Component {
|
|
|
456
468
|
}
|
|
457
469
|
|
|
458
470
|
render () {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
466
|
-
return [
|
|
467
|
-
this.renderTabs(),
|
|
468
|
-
this.renderSessionsWrap(),
|
|
469
|
-
<TermSearch
|
|
470
|
-
key='TermSearch'
|
|
471
|
-
{...termProps}
|
|
472
|
-
/>,
|
|
473
|
-
<QuickCommandsFooterBox
|
|
474
|
-
key='QuickCommandsFooterBox'
|
|
475
|
-
store={store}
|
|
476
|
-
/>,
|
|
477
|
-
<Footer
|
|
478
|
-
key='Footer'
|
|
479
|
-
store={store}
|
|
480
|
-
currentTab={currentTab}
|
|
481
|
-
/>
|
|
482
|
-
]
|
|
471
|
+
return (
|
|
472
|
+
<div>
|
|
473
|
+
{this.renderTabs()}
|
|
474
|
+
{this.renderSessionsWrap()}
|
|
475
|
+
</div>
|
|
476
|
+
)
|
|
483
477
|
}
|
|
484
478
|
}
|
|
485
479
|
|
|
@@ -493,20 +493,22 @@ export default class SettingCommon extends Component {
|
|
|
493
493
|
</div>
|
|
494
494
|
)
|
|
495
495
|
}
|
|
496
|
+
const { props } = this
|
|
496
497
|
const {
|
|
497
498
|
hotkey,
|
|
498
499
|
language,
|
|
499
500
|
theme,
|
|
500
501
|
customCss
|
|
501
|
-
} =
|
|
502
|
+
} = props.config
|
|
502
503
|
const {
|
|
503
504
|
langs
|
|
504
505
|
} = this.props.store
|
|
505
|
-
const terminalThemes =
|
|
506
|
+
const terminalThemes = props.store.getSidebarList(settingMap.terminalThemes)
|
|
506
507
|
const [modifier, key] = hotkey.split('+')
|
|
507
508
|
const pops = {
|
|
508
|
-
onStartSessions:
|
|
509
|
-
|
|
509
|
+
onStartSessions: props.config.onStartSessions,
|
|
510
|
+
bookmarks: props.bookmarks,
|
|
511
|
+
bookmarkGroups: props.bookmarkGroups,
|
|
510
512
|
onChangeStartSessions: this.onChangeStartSessions
|
|
511
513
|
}
|
|
512
514
|
return (
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* hisotry/bookmark/setting modal
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { auto } from 'manate/react'
|
|
6
6
|
import { pick } from 'lodash-es'
|
|
7
7
|
import { Tabs } from 'antd'
|
|
8
8
|
import SettingModal from './setting-wrap'
|
|
@@ -19,14 +19,13 @@ import TabProfiles from './tab-profiles'
|
|
|
19
19
|
|
|
20
20
|
const e = window.translate
|
|
21
21
|
|
|
22
|
-
export default
|
|
23
|
-
selectItem = (item) => {
|
|
24
|
-
|
|
25
|
-
store.setSettingItem(item)
|
|
22
|
+
export default auto(function SettingModalWrap (props) {
|
|
23
|
+
const selectItem = (item) => {
|
|
24
|
+
window.store.setSettingItem(item)
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
renderTabs () {
|
|
29
|
-
const { store } =
|
|
27
|
+
function renderTabs () {
|
|
28
|
+
const { store } = props
|
|
30
29
|
const tabsShouldConfirmDel = [
|
|
31
30
|
settingMap.bookmarks,
|
|
32
31
|
settingMap.terminalThemes
|
|
@@ -36,7 +35,7 @@ export default class SettingModalWrap extends Component {
|
|
|
36
35
|
store,
|
|
37
36
|
activeItemId: settingItem.id,
|
|
38
37
|
type: settingTab,
|
|
39
|
-
onClickItem:
|
|
38
|
+
onClickItem: selectItem,
|
|
40
39
|
shouldConfirmDel: tabsShouldConfirmDel.includes(settingTab),
|
|
41
40
|
list: settingSidebarList
|
|
42
41
|
}
|
|
@@ -62,7 +61,10 @@ export default class SettingModalWrap extends Component {
|
|
|
62
61
|
...pick(store, [
|
|
63
62
|
'currentBookmarkGroupId',
|
|
64
63
|
'autofocustrigger',
|
|
65
|
-
'config'
|
|
64
|
+
'config',
|
|
65
|
+
'checkedKeys',
|
|
66
|
+
'expandedKeys',
|
|
67
|
+
'leftSidebarWidth'
|
|
66
68
|
])
|
|
67
69
|
}
|
|
68
70
|
const items = [
|
|
@@ -153,26 +155,24 @@ export default class SettingModalWrap extends Component {
|
|
|
153
155
|
)
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return null
|
|
166
|
-
}
|
|
167
|
-
return (
|
|
168
|
-
<SettingModal
|
|
169
|
-
onCancel={hideSettingModal}
|
|
170
|
-
visible={show}
|
|
171
|
-
useSystemTitleBar={useSystemTitleBar}
|
|
172
|
-
innerWidth={innerWidth}
|
|
173
|
-
>
|
|
174
|
-
{this.renderTabs()}
|
|
175
|
-
</SettingModal>
|
|
176
|
-
)
|
|
158
|
+
const {
|
|
159
|
+
showModal,
|
|
160
|
+
hideSettingModal,
|
|
161
|
+
innerWidth,
|
|
162
|
+
useSystemTitleBar
|
|
163
|
+
} = props.store
|
|
164
|
+
const show = showModal === modals.setting
|
|
165
|
+
if (!show) {
|
|
166
|
+
return null
|
|
177
167
|
}
|
|
178
|
-
|
|
168
|
+
return (
|
|
169
|
+
<SettingModal
|
|
170
|
+
onCancel={hideSettingModal}
|
|
171
|
+
visible={show}
|
|
172
|
+
useSystemTitleBar={useSystemTitleBar}
|
|
173
|
+
innerWidth={innerWidth}
|
|
174
|
+
>
|
|
175
|
+
{renderTabs()}
|
|
176
|
+
</SettingModal>
|
|
177
|
+
)
|
|
178
|
+
})
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TreeSelect } from 'antd'
|
|
2
|
-
import {
|
|
2
|
+
import { PureComponent } from 'react'
|
|
3
3
|
import copy from 'json-deep-copy'
|
|
4
4
|
import { createTitleWithTag } from '../../common/create-title'
|
|
5
5
|
|
|
6
6
|
const e = window.translate
|
|
7
7
|
const { SHOW_CHILD } = TreeSelect
|
|
8
8
|
|
|
9
|
-
export default class StartSessionSelect extends
|
|
9
|
+
export default class StartSessionSelect extends PureComponent {
|
|
10
10
|
buildData = () => {
|
|
11
|
-
const cats = this.props.
|
|
12
|
-
const tree = this.props.
|
|
11
|
+
const cats = this.props.bookmarkGroups
|
|
12
|
+
const tree = this.props.bookmarks
|
|
13
13
|
.reduce((p, k) => {
|
|
14
14
|
return {
|
|
15
15
|
...p,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { auto } from 'manate/react'
|
|
1
2
|
import SettingCommon from './setting-common'
|
|
2
3
|
import SettingTerminal from './setting-terminal'
|
|
3
4
|
import SettingCol from './col'
|
|
@@ -10,8 +11,9 @@ import {
|
|
|
10
11
|
settingTerminalId,
|
|
11
12
|
settingShortcutsId
|
|
12
13
|
} from '../../common/constants'
|
|
14
|
+
import { pick } from 'lodash-es'
|
|
13
15
|
|
|
14
|
-
export default function TabSettings (props) {
|
|
16
|
+
export default auto(function TabSettings (props) {
|
|
15
17
|
const {
|
|
16
18
|
settingTab
|
|
17
19
|
} = props
|
|
@@ -26,14 +28,34 @@ export default function TabSettings (props) {
|
|
|
26
28
|
let elem = null
|
|
27
29
|
const sid = settingItem.id
|
|
28
30
|
if (sid === settingSyncId) {
|
|
29
|
-
|
|
31
|
+
const syncProps = pick(store, [
|
|
32
|
+
'config',
|
|
33
|
+
'autofocustrigger',
|
|
34
|
+
'isSyncingSetting',
|
|
35
|
+
'isSyncDownload',
|
|
36
|
+
'isSyncUpload',
|
|
37
|
+
'syncType'
|
|
38
|
+
])
|
|
39
|
+
elem = <SyncSetting {...syncProps} />
|
|
30
40
|
} else if (sid === settingTerminalId) {
|
|
31
41
|
elem = <SettingTerminal {...listProps} config={store.config} />
|
|
32
42
|
} else if (sid === settingShortcutsId) {
|
|
33
|
-
|
|
43
|
+
const shortcutsProps = {
|
|
44
|
+
quickCommands: store.quickCommands,
|
|
45
|
+
config: store.config
|
|
46
|
+
}
|
|
47
|
+
elem = <Shortcuts {...shortcutsProps} />
|
|
34
48
|
} else {
|
|
35
|
-
elem =
|
|
49
|
+
elem = (
|
|
50
|
+
<SettingCommon
|
|
51
|
+
{...listProps}
|
|
52
|
+
config={store.config}
|
|
53
|
+
bookmarks={store.bookmarks}
|
|
54
|
+
bookmarkGroups={store.bookmarkGroups}
|
|
55
|
+
/>
|
|
56
|
+
)
|
|
36
57
|
}
|
|
58
|
+
|
|
37
59
|
return (
|
|
38
60
|
<div
|
|
39
61
|
className='setting-tabs-setting'
|
|
@@ -46,4 +68,4 @@ export default function TabSettings (props) {
|
|
|
46
68
|
</SettingCol>
|
|
47
69
|
</div>
|
|
48
70
|
)
|
|
49
|
-
}
|
|
71
|
+
})
|
|
@@ -13,50 +13,47 @@ import {
|
|
|
13
13
|
ExportOutlined,
|
|
14
14
|
InfoCircleOutlined
|
|
15
15
|
} from '@ant-design/icons'
|
|
16
|
-
import { Component } from '../common/react-subx'
|
|
17
16
|
|
|
18
17
|
const e = window.translate
|
|
19
18
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<div className='
|
|
28
|
-
<
|
|
19
|
+
export default function DataTransport (props) {
|
|
20
|
+
const txt = e('autoSync')
|
|
21
|
+
const {
|
|
22
|
+
store
|
|
23
|
+
} = window
|
|
24
|
+
return (
|
|
25
|
+
<div className='pd2 fix'>
|
|
26
|
+
<div className='fleft'>
|
|
27
|
+
<Button
|
|
28
|
+
icon={<ExportOutlined />}
|
|
29
|
+
className='mg1r'
|
|
30
|
+
onClick={store.handleExportAllData}
|
|
31
|
+
>
|
|
32
|
+
{e('export')}
|
|
33
|
+
</Button>
|
|
34
|
+
<Upload
|
|
35
|
+
beforeUpload={store.importAll}
|
|
36
|
+
fileList={[]}
|
|
37
|
+
>
|
|
29
38
|
<Button
|
|
30
|
-
icon={<
|
|
31
|
-
className='mg1r'
|
|
32
|
-
onClick={store.handleExportAllData}
|
|
39
|
+
icon={<ImportOutlined />}
|
|
33
40
|
>
|
|
34
|
-
{e('
|
|
41
|
+
{e('importFromFile')}
|
|
35
42
|
</Button>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
checked={store.config.autoSync || false}
|
|
50
|
-
checkedChildren={txt}
|
|
51
|
-
onChange={store.handleAutoSync}
|
|
52
|
-
unCheckedChildren={txt}
|
|
53
|
-
className='mg3l mg1r'
|
|
54
|
-
/>
|
|
55
|
-
<Tooltip title={e('autoSyncTip')}>
|
|
56
|
-
<InfoCircleOutlined />
|
|
57
|
-
</Tooltip>
|
|
58
|
-
</div>
|
|
43
|
+
</Upload>
|
|
44
|
+
</div>
|
|
45
|
+
<div className='fright'>
|
|
46
|
+
<Switch
|
|
47
|
+
checked={props.config.autoSync || false}
|
|
48
|
+
checkedChildren={txt}
|
|
49
|
+
onChange={store.handleAutoSync}
|
|
50
|
+
unCheckedChildren={txt}
|
|
51
|
+
className='mg3l mg1r'
|
|
52
|
+
/>
|
|
53
|
+
<Tooltip title={e('autoSyncTip')}>
|
|
54
|
+
<InfoCircleOutlined />
|
|
55
|
+
</Tooltip>
|
|
59
56
|
</div>
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
</div>
|
|
58
|
+
)
|
|
62
59
|
}
|