@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.
- package/client/common/constants.js +15 -1
- package/client/common/db.js +10 -9
- package/client/common/default-setting.js +0 -1
- package/client/common/is-color-dark.js +15 -11
- package/client/common/new-terminal.js +2 -5
- package/client/common/reverse-color.js +12 -0
- package/client/common/ws.js +4 -1
- package/client/components/batch-op/batch-op.jsx +16 -5
- package/client/components/bookmark-form/index.jsx +1 -1
- package/client/components/bookmark-form/render-connection-hopping.jsx +25 -2
- package/client/components/bookmark-form/ssh-form.jsx +4 -25
- package/client/components/bookmark-form/tree-delete.jsx +5 -10
- package/client/components/bookmark-form/use-submit.jsx +6 -15
- package/client/components/bookmark-form/use-ui.jsx +1 -2
- package/client/components/common/connection-hopping-warning-text.jsx +36 -0
- package/client/components/common/drag-handle.jsx +60 -0
- package/client/components/common/drag-handle.styl +12 -0
- 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/footer-entry.jsx +1 -6
- package/client/components/layout/layout-item.jsx +2 -2
- package/client/components/layout/layout.jsx +3 -2
- package/client/components/main/connection-hopping-warnning.jsx +45 -0
- package/client/components/main/error-wrapper.jsx +120 -5
- package/client/components/main/main.jsx +32 -8
- package/client/components/main/upgrade.jsx +4 -9
- package/client/components/main/wrapper.styl +2 -1
- package/client/components/profile/profile-form-ssh.jsx +1 -1
- package/client/components/rdp/resolution-edit.jsx +3 -5
- package/client/components/session/session.jsx +22 -3
- package/client/components/session/session.styl +3 -2
- 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-common.jsx +28 -7
- package/client/components/setting-panel/setting-modal.jsx +0 -12
- package/client/components/setting-panel/setting-terminal.jsx +7 -4
- package/client/components/sftp/confirm-modal-store.jsx +3 -11
- package/client/components/sftp/file-mode-modal.jsx +2 -2
- package/client/components/sftp/sftp-entry.jsx +4 -7
- package/client/components/sftp/transfer-conflict-store.jsx +70 -69
- package/client/components/sftp/transport-action-store.jsx +42 -49
- package/client/components/sftp/transports-action-store.jsx +15 -15
- package/client/components/sftp/transports-ui-store.jsx +9 -5
- package/client/components/side-panel-r/side-panel-r.jsx +13 -40
- package/client/components/sidebar/bookmark-select.jsx +1 -4
- 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 +5 -40
- package/client/components/sidebar/side-panel.jsx +27 -51
- package/client/components/sidebar/sidebar-panel.jsx +107 -0
- package/client/components/sidebar/sidebar.styl +14 -9
- 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/ssh-config/load-ssh-configs.jsx +106 -0
- package/client/components/ssh-config/ssh-config-item.jsx +26 -0
- package/client/components/ssh-config/ssh-config-load-notify.jsx +60 -0
- package/client/components/tabs/index.jsx +4 -4
- package/client/components/tabs/tab.jsx +28 -20
- package/client/components/tabs/tabs.styl +6 -1
- package/client/components/terminal/index.jsx +4 -18
- package/client/components/tree-list/bookmark-toolbar.jsx +203 -0
- package/client/components/tree-list/bookmark-transport.jsx +2 -0
- package/client/components/tree-list/tree-list.jsx +33 -42
- package/client/entry/worker.js +5 -3
- package/client/store/bookmark-group.js +5 -18
- package/client/store/bookmark.js +43 -1
- package/client/store/common.js +13 -9
- package/client/store/db-upgrade.js +0 -2
- package/client/store/index.js +45 -53
- package/client/store/init-state.js +20 -23
- package/client/store/item.js +0 -19
- package/client/store/load-data.js +7 -10
- package/client/store/setting.js +10 -66
- package/client/store/sidebar.js +7 -8
- package/client/store/sync.js +7 -8
- package/client/store/tab.js +93 -14
- package/client/store/terminal-theme.js +1 -1
- package/client/store/transfer-history.js +3 -9
- package/client/store/transfer-list.js +67 -75
- package/client/store/ui-theme.js +0 -9
- package/client/store/watch.js +17 -9
- package/package.json +1 -1
- package/client/components/setting-panel/tab-history.jsx +0 -43
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BookOutlined,
|
|
3
|
+
FolderOutlined,
|
|
4
|
+
UploadOutlined,
|
|
5
|
+
DownloadOutlined,
|
|
6
|
+
CodeOutlined,
|
|
7
|
+
MenuOutlined,
|
|
8
|
+
EditOutlined
|
|
9
|
+
} from '@ant-design/icons'
|
|
10
|
+
import { Button, Space, Dropdown, Upload } from 'antd'
|
|
11
|
+
import copy from 'json-deep-copy'
|
|
12
|
+
import time from '../../common/time'
|
|
13
|
+
import { find, uniq, isEqual } from 'lodash-es'
|
|
14
|
+
import { fixBookmarks } from '../../common/db-fix'
|
|
15
|
+
import download from '../../common/download'
|
|
16
|
+
|
|
17
|
+
const e = window.translate
|
|
18
|
+
|
|
19
|
+
export default function BookmarkToolbar ({
|
|
20
|
+
onNewBookmark,
|
|
21
|
+
onNewBookmarkGroup,
|
|
22
|
+
onImport,
|
|
23
|
+
onExport,
|
|
24
|
+
onSshConfigs,
|
|
25
|
+
bookmarkGroups,
|
|
26
|
+
bookmarks
|
|
27
|
+
}) {
|
|
28
|
+
const beforeUpload = async (file) => {
|
|
29
|
+
const { store } = window
|
|
30
|
+
const txt = await window.fs.readFile(file.path)
|
|
31
|
+
try {
|
|
32
|
+
const content = JSON.parse(txt)
|
|
33
|
+
const {
|
|
34
|
+
bookmarkGroups: bookmarkGroups1,
|
|
35
|
+
bookmarks: bookmarks1
|
|
36
|
+
} = content
|
|
37
|
+
const { props } = this
|
|
38
|
+
const bookmarkGroups = copy(props.bookmarkGroups)
|
|
39
|
+
const bookmarks = copy(props.bookmarks)
|
|
40
|
+
const bmTree = bookmarks.reduce((p, v) => {
|
|
41
|
+
return {
|
|
42
|
+
...p,
|
|
43
|
+
[v.id]: v
|
|
44
|
+
}
|
|
45
|
+
}, {})
|
|
46
|
+
const bmgTree = bookmarkGroups.reduce((p, v) => {
|
|
47
|
+
return {
|
|
48
|
+
...p,
|
|
49
|
+
[v.id]: v
|
|
50
|
+
}
|
|
51
|
+
}, {})
|
|
52
|
+
const add = []
|
|
53
|
+
const dbAdd = []
|
|
54
|
+
const updates = []
|
|
55
|
+
bookmarks1.forEach(bg => {
|
|
56
|
+
if (!bmTree[bg.id]) {
|
|
57
|
+
bookmarks.push(bg)
|
|
58
|
+
add.push(bg)
|
|
59
|
+
dbAdd.push({
|
|
60
|
+
db: 'bookmarks',
|
|
61
|
+
obj: bg
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
bookmarkGroups1.forEach(bg => {
|
|
66
|
+
if (!bmgTree[bg.id]) {
|
|
67
|
+
bookmarkGroups.push(bg)
|
|
68
|
+
dbAdd.push({
|
|
69
|
+
db: 'bookmarkGroups',
|
|
70
|
+
obj: bg
|
|
71
|
+
})
|
|
72
|
+
} else {
|
|
73
|
+
const bg1 = find(
|
|
74
|
+
bookmarkGroups,
|
|
75
|
+
b => b.id === bg.id
|
|
76
|
+
)
|
|
77
|
+
const old = copy(bg1.bookmarkIds)
|
|
78
|
+
bg1.bookmarkIds = uniq(
|
|
79
|
+
[
|
|
80
|
+
...bg1.bookmarkIds,
|
|
81
|
+
...bg.bookmarkIds
|
|
82
|
+
]
|
|
83
|
+
)
|
|
84
|
+
if (!isEqual(bg1.bookmarkIds, old)) {
|
|
85
|
+
updates.push({
|
|
86
|
+
id: bg1.id,
|
|
87
|
+
db: 'bookmarkGroups',
|
|
88
|
+
update: {
|
|
89
|
+
bookmarkIds: bg1.bookmarkIds
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
store.setBookmarkGroups(bookmarkGroups)
|
|
96
|
+
store.setBookmarks(fixBookmarks(bookmarks))
|
|
97
|
+
store.batchDbAdd(dbAdd)
|
|
98
|
+
store.batchDbUpdate(updates)
|
|
99
|
+
} catch (e) {
|
|
100
|
+
store.onError(e)
|
|
101
|
+
}
|
|
102
|
+
return false
|
|
103
|
+
}
|
|
104
|
+
const handleDownload = () => {
|
|
105
|
+
const { bookmarkGroups, bookmarks } = this.props
|
|
106
|
+
const txt = JSON.stringify({
|
|
107
|
+
bookmarkGroups: copy(bookmarkGroups),
|
|
108
|
+
bookmarks: copy(bookmarks)
|
|
109
|
+
}, null, 2)
|
|
110
|
+
const stamp = time(undefined, 'YYYY-MM-DD-HH-mm-ss')
|
|
111
|
+
download('bookmarks-' + stamp + '.json', txt)
|
|
112
|
+
}
|
|
113
|
+
const handleToggleEdit = () => {
|
|
114
|
+
window.store.bookmarkSelectMode = true
|
|
115
|
+
}
|
|
116
|
+
const titleNew = `${e('new')} ${e('bookmarks')}`
|
|
117
|
+
const titleEdit = `${e('new')} ${e('bookmarkCategory')}`
|
|
118
|
+
const items = [
|
|
119
|
+
{
|
|
120
|
+
label: titleNew,
|
|
121
|
+
onClick: onNewBookmark,
|
|
122
|
+
icon: <BookOutlined />
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: titleEdit,
|
|
126
|
+
onClick: onNewBookmarkGroup,
|
|
127
|
+
icon: <FolderOutlined />
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: e('edit'),
|
|
131
|
+
onClick: handleToggleEdit,
|
|
132
|
+
icon: <EditOutlined />
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
label: e('import'),
|
|
136
|
+
onClick: onImport,
|
|
137
|
+
icon: <UploadOutlined />
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: e('export'),
|
|
141
|
+
onClick: onExport,
|
|
142
|
+
icon: <DownloadOutlined />
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
label: e('loadSshConfigs'),
|
|
146
|
+
onClick: onSshConfigs,
|
|
147
|
+
icon: <CodeOutlined />
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
const ddProps = {
|
|
152
|
+
menu: {
|
|
153
|
+
items
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
|
|
159
|
+
<div className='pd1b pd1r'>
|
|
160
|
+
<div className='fix'>
|
|
161
|
+
<div className='fleft'>
|
|
162
|
+
<Space.Compact>
|
|
163
|
+
<Button onClick={onNewBookmark}>
|
|
164
|
+
<BookOutlined className='with-plus' />
|
|
165
|
+
</Button>
|
|
166
|
+
<Button onClick={onNewBookmarkGroup}>
|
|
167
|
+
<FolderOutlined className='with-plus' />
|
|
168
|
+
</Button>
|
|
169
|
+
<Button
|
|
170
|
+
icon={<EditOutlined />}
|
|
171
|
+
onClick={handleToggleEdit}
|
|
172
|
+
title={e('edit')}
|
|
173
|
+
/>
|
|
174
|
+
<Button
|
|
175
|
+
icon={<DownloadOutlined />}
|
|
176
|
+
onClick={handleDownload}
|
|
177
|
+
title={e('export')}
|
|
178
|
+
className='download-bookmark-icon'
|
|
179
|
+
/>
|
|
180
|
+
<Upload
|
|
181
|
+
beforeUpload={beforeUpload}
|
|
182
|
+
fileList={[]}
|
|
183
|
+
className='upload-bookmark-icon'
|
|
184
|
+
>
|
|
185
|
+
<Button
|
|
186
|
+
icon={<UploadOutlined />}
|
|
187
|
+
title={e('importFromFile')}
|
|
188
|
+
/>
|
|
189
|
+
</Upload>
|
|
190
|
+
<Button onClick={onSshConfigs}>
|
|
191
|
+
<CodeOutlined />
|
|
192
|
+
</Button>
|
|
193
|
+
</Space.Compact>
|
|
194
|
+
</div>
|
|
195
|
+
<div className='fright'>
|
|
196
|
+
<Dropdown {...ddProps}>
|
|
197
|
+
<MenuOutlined />
|
|
198
|
+
</Dropdown>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
)
|
|
203
|
+
}
|
|
@@ -127,11 +127,13 @@ export default class BookmarkTransport extends PureComponent {
|
|
|
127
127
|
icon={<DownloadOutlined />}
|
|
128
128
|
onClick={this.handleDownload}
|
|
129
129
|
title={e('export')}
|
|
130
|
+
className='download-bookmark-icon'
|
|
130
131
|
key='export'
|
|
131
132
|
/>,
|
|
132
133
|
<Upload
|
|
133
134
|
beforeUpload={this.beforeUpload}
|
|
134
135
|
fileList={[]}
|
|
136
|
+
className='upload-bookmark-icon'
|
|
135
137
|
key='Upload'
|
|
136
138
|
>
|
|
137
139
|
<Button
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Component } from 'react'
|
|
6
6
|
import {
|
|
7
|
-
BookOutlined,
|
|
8
7
|
CheckOutlined,
|
|
9
8
|
CloseOutlined,
|
|
10
|
-
FolderOutlined,
|
|
11
9
|
LoadingOutlined
|
|
12
10
|
} from '@ant-design/icons'
|
|
13
11
|
import {
|
|
@@ -15,13 +13,9 @@ import {
|
|
|
15
13
|
cut,
|
|
16
14
|
hasBookmarkOrGroupInClipboardText
|
|
17
15
|
} from '../../common/clipboard'
|
|
18
|
-
import {
|
|
19
|
-
Button,
|
|
20
|
-
Space
|
|
21
|
-
} from 'antd'
|
|
22
16
|
import createName from '../../common/create-title'
|
|
23
17
|
import InputAutoFocus from '../common/input-auto-focus'
|
|
24
|
-
import { find, uniq,
|
|
18
|
+
import { find, uniq, isEqual, filter, pick } from 'lodash-es'
|
|
25
19
|
import {
|
|
26
20
|
maxBookmarkGroupTitleLength,
|
|
27
21
|
defaultBookmarkGroupId,
|
|
@@ -31,8 +25,8 @@ import {
|
|
|
31
25
|
copyBookmarkGroupItemPrefix
|
|
32
26
|
} from '../../common/constants'
|
|
33
27
|
import findParentBySel from '../../common/find-parent'
|
|
34
|
-
import copy from 'json-deep-copy'
|
|
35
|
-
import
|
|
28
|
+
import copy, { deepCopy } from 'json-deep-copy'
|
|
29
|
+
import NewButtonsGroup from './bookmark-toolbar'
|
|
36
30
|
import findBookmarkGroupId from '../../common/find-bookmark-group-id'
|
|
37
31
|
import getInitItem from '../../common/init-setting-item'
|
|
38
32
|
import uid from '../../common/uid'
|
|
@@ -73,7 +67,7 @@ export default class ItemListTree extends Component {
|
|
|
73
67
|
!deepEqual(this.props.expandedKeys, this.state.expandedKeys)
|
|
74
68
|
) {
|
|
75
69
|
this.setState({
|
|
76
|
-
expandedKeys: this.props.expandedKeys
|
|
70
|
+
expandedKeys: deepCopy(this.props.expandedKeys)
|
|
77
71
|
})
|
|
78
72
|
}
|
|
79
73
|
}
|
|
@@ -312,9 +306,7 @@ export default class ItemListTree extends Component {
|
|
|
312
306
|
expandedKeys
|
|
313
307
|
})
|
|
314
308
|
this.closeNewGroupForm()
|
|
315
|
-
window.store.
|
|
316
|
-
'expandedKeys', expandedKeys
|
|
317
|
-
)
|
|
309
|
+
window.store.expandedKeys = deepCopy(expandedKeys)
|
|
318
310
|
}
|
|
319
311
|
|
|
320
312
|
onSelect = (
|
|
@@ -597,13 +589,13 @@ export default class ItemListTree extends Component {
|
|
|
597
589
|
} = window.store
|
|
598
590
|
|
|
599
591
|
if (!pidDragged && !pidDrop) {
|
|
600
|
-
const indexDrag = findIndex(
|
|
592
|
+
const indexDrag = bookmarkGroups.findIndex(item => item.id === idDragged)
|
|
601
593
|
if (indexDrag < 0) {
|
|
602
594
|
return
|
|
603
595
|
}
|
|
604
596
|
const dragItem = bookmarkGroups.splice(indexDrag, 1)[0]
|
|
605
597
|
dragItem.level = 1
|
|
606
|
-
const indexDrop = findIndex(
|
|
598
|
+
const indexDrop = bookmarkGroups.findIndex(item => item.id === idDrop)
|
|
607
599
|
if (indexDrop < 0) {
|
|
608
600
|
return
|
|
609
601
|
}
|
|
@@ -653,7 +645,7 @@ export default class ItemListTree extends Component {
|
|
|
653
645
|
)
|
|
654
646
|
} else {
|
|
655
647
|
const arr = parentDrop.bookmarkGroupIds || []
|
|
656
|
-
let index = findIndex(
|
|
648
|
+
let index = arr.findIndex(item => item === idDrop)
|
|
657
649
|
if (index < 0) {
|
|
658
650
|
index = 0
|
|
659
651
|
}
|
|
@@ -704,7 +696,7 @@ export default class ItemListTree extends Component {
|
|
|
704
696
|
)
|
|
705
697
|
} else {
|
|
706
698
|
const arr = parentDrop.bookmarkIds || []
|
|
707
|
-
let index = findIndex(
|
|
699
|
+
let index = arr.findIndex(item => item === idDrop)
|
|
708
700
|
if (index < 0) {
|
|
709
701
|
index = 0
|
|
710
702
|
}
|
|
@@ -724,7 +716,7 @@ export default class ItemListTree extends Component {
|
|
|
724
716
|
pidDrop &&
|
|
725
717
|
!pidDragged
|
|
726
718
|
) {
|
|
727
|
-
const i = findIndex(
|
|
719
|
+
const i = bookmarkGroups.findIndex(item => item.id === idDragged)
|
|
728
720
|
if (i >= 0) {
|
|
729
721
|
const item = bookmarkGroups[i]
|
|
730
722
|
item.level = 2
|
|
@@ -795,13 +787,11 @@ export default class ItemListTree extends Component {
|
|
|
795
787
|
}
|
|
796
788
|
|
|
797
789
|
updateBookmarkGroups = (bookmarkGroups, bookmark, categoryId) => {
|
|
798
|
-
let index = findIndex(
|
|
799
|
-
bookmarkGroups,
|
|
790
|
+
let index = bookmarkGroups.findIndex(
|
|
800
791
|
bg => bg.id === categoryId
|
|
801
792
|
)
|
|
802
793
|
if (index < 0) {
|
|
803
|
-
index = findIndex(
|
|
804
|
-
bookmarkGroups,
|
|
794
|
+
index = bookmarkGroups.findIndex(
|
|
805
795
|
bg => bg.id === defaultBookmarkGroupId
|
|
806
796
|
)
|
|
807
797
|
}
|
|
@@ -902,28 +892,29 @@ export default class ItemListTree extends Component {
|
|
|
902
892
|
)
|
|
903
893
|
}
|
|
904
894
|
|
|
895
|
+
handleImport = () => {
|
|
896
|
+
document.querySelector('.upload-bookmark-icon input')?.click()
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
handleExport = () => {
|
|
900
|
+
document.querySelector('.download-bookmark-icon')?.click()
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
handleSshConfigs = () => {
|
|
904
|
+
window.store.showSshConfigModal = true
|
|
905
|
+
}
|
|
906
|
+
|
|
905
907
|
renderNewButtons = () => {
|
|
906
908
|
return (
|
|
907
|
-
<
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
onClick={this.handleNewBookmarkGroup}
|
|
917
|
-
title={`${e('new')} ${e('bookmarkCategory')}`}
|
|
918
|
-
>
|
|
919
|
-
<FolderOutlined className='with-plus' />
|
|
920
|
-
</Button>
|
|
921
|
-
<BookmarkTransport
|
|
922
|
-
bookmarkGroups={this.props.bookmarkGroups}
|
|
923
|
-
bookmarks={this.props.bookmarks}
|
|
924
|
-
/>
|
|
925
|
-
</Space.Compact>
|
|
926
|
-
</div>
|
|
909
|
+
<NewButtonsGroup
|
|
910
|
+
onNewBookmark={this.handleNewBookmark}
|
|
911
|
+
onNewBookmarkGroup={this.handleNewBookmarkGroup}
|
|
912
|
+
onImport={this.handleImport}
|
|
913
|
+
onExport={this.handleExport}
|
|
914
|
+
onSshConfigs={this.handleSshConfigs}
|
|
915
|
+
bookmarkGroups={this.props.bookmarkGroups}
|
|
916
|
+
bookmarks={this.props.bookmarks}
|
|
917
|
+
/>
|
|
927
918
|
)
|
|
928
919
|
}
|
|
929
920
|
|
package/client/entry/worker.js
CHANGED
|
@@ -2,26 +2,15 @@
|
|
|
2
2
|
* bookmark group functions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { find
|
|
5
|
+
import { find } from 'lodash-es'
|
|
6
6
|
import {
|
|
7
7
|
defaultBookmarkGroupId,
|
|
8
|
-
settingMap
|
|
9
|
-
terminalSshConfigType
|
|
8
|
+
settingMap
|
|
10
9
|
} from '../common/constants'
|
|
11
10
|
|
|
12
11
|
export default Store => {
|
|
13
12
|
Store.prototype.getBookmarkGroupsTotal = function () {
|
|
14
|
-
|
|
15
|
-
return store.sshConfigItems.length && !store.config.hideSshConfig
|
|
16
|
-
? [
|
|
17
|
-
...store.bookmarkGroups,
|
|
18
|
-
{
|
|
19
|
-
title: terminalSshConfigType,
|
|
20
|
-
id: terminalSshConfigType,
|
|
21
|
-
bookmarkIds: store.sshConfigItems.map(d => d.id)
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
: store.bookmarkGroups
|
|
13
|
+
return window.store.bookmarkGroups
|
|
25
14
|
}
|
|
26
15
|
|
|
27
16
|
Store.prototype.setBookmarkGroups = function (items) {
|
|
@@ -82,12 +71,10 @@ export default Store => {
|
|
|
82
71
|
const groupIds = groups.map(g => g.id)
|
|
83
72
|
const updates = []
|
|
84
73
|
const defaultCatIndex = tobeDel.level !== 2
|
|
85
|
-
? findIndex(
|
|
86
|
-
bookmarkGroups,
|
|
74
|
+
? bookmarkGroups.findIndex(
|
|
87
75
|
g => g.id === defaultBookmarkGroupId
|
|
88
76
|
)
|
|
89
|
-
: findIndex(
|
|
90
|
-
bookmarkGroups,
|
|
77
|
+
: bookmarkGroups.findIndex(
|
|
91
78
|
g => (g.bookmarkGroupIds || []).includes(tobeDel.id)
|
|
92
79
|
)
|
|
93
80
|
for (const g of groups) {
|
package/client/store/bookmark.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* bookmark
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import uid from '../common/uid'
|
|
6
|
+
|
|
5
7
|
export default Store => {
|
|
6
8
|
Store.prototype.handleGetSerials = async function () {
|
|
7
9
|
const { store } = window
|
|
@@ -9,11 +11,51 @@ export default Store => {
|
|
|
9
11
|
const res = await window.pre.runGlobalAsync('listSerialPorts')
|
|
10
12
|
.catch(store.onError)
|
|
11
13
|
if (res) {
|
|
12
|
-
store.
|
|
14
|
+
store.serials = res
|
|
13
15
|
}
|
|
14
16
|
store.loaddingSerials = false
|
|
15
17
|
}
|
|
16
18
|
Store.prototype.setBookmarks = function (items) {
|
|
17
19
|
return window.store.setItems('bookmarks', items)
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
Store.prototype.addSshConfigs = function (items) {
|
|
23
|
+
const { store } = window
|
|
24
|
+
|
|
25
|
+
const bookmarksToAdd = items.map(t => {
|
|
26
|
+
return {
|
|
27
|
+
term: 'xterm-256color',
|
|
28
|
+
id: uid(),
|
|
29
|
+
type: 'local',
|
|
30
|
+
title: 'ssh config: ' + t.title,
|
|
31
|
+
color: '#0088cc',
|
|
32
|
+
runScripts: [
|
|
33
|
+
{
|
|
34
|
+
script: `ssh ${t.title}`,
|
|
35
|
+
delay: 500
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}).filter(d => {
|
|
40
|
+
return !store.bookmarks.find(t => t.title === d.title)
|
|
41
|
+
})
|
|
42
|
+
const ids = bookmarksToAdd.map(d => d.id)
|
|
43
|
+
let sshConfigGroup = store.bookmarkGroups.find(d => d.id === 'sshConfig')
|
|
44
|
+
if (!sshConfigGroup) {
|
|
45
|
+
sshConfigGroup = {
|
|
46
|
+
id: 'sshConfig',
|
|
47
|
+
title: 'ssh configs',
|
|
48
|
+
bookmarkIds: ids
|
|
49
|
+
}
|
|
50
|
+
store.addBookmarkGroup(sshConfigGroup)
|
|
51
|
+
} else {
|
|
52
|
+
store.editItem('sshConfig', {
|
|
53
|
+
bookmarkIds: [
|
|
54
|
+
...ids,
|
|
55
|
+
...(sshConfigGroup.bookmarkIds || [])
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
return store.addItems(bookmarksToAdd, 'bookmarks')
|
|
60
|
+
}
|
|
19
61
|
}
|
package/client/store/common.js
CHANGED
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
leftSidebarWidthKey,
|
|
13
13
|
rightSidebarWidthKey,
|
|
14
14
|
dismissDelKeyTipLsKey,
|
|
15
|
-
connectionMap
|
|
15
|
+
connectionMap,
|
|
16
|
+
terminalActions
|
|
16
17
|
} from '../common/constants'
|
|
17
18
|
import * as ls from '../common/safe-local-storage'
|
|
18
19
|
|
|
@@ -46,6 +47,15 @@ export default Store => {
|
|
|
46
47
|
})
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
Store.prototype.openInfoPanel = function () {
|
|
51
|
+
const { store } = window
|
|
52
|
+
store.rightPanelVisible = true
|
|
53
|
+
postMessage({
|
|
54
|
+
action: terminalActions.showInfoPanel,
|
|
55
|
+
activeTabId: store.activeTabId
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
Store.prototype.onResize = debounce(async function () {
|
|
50
60
|
const { width, height } = await window.pre.runGlobalAsync('getScreenSize')
|
|
51
61
|
const isMaximized = window.pre.runSync('isMaximized')
|
|
@@ -126,17 +136,11 @@ export default Store => {
|
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
Store.prototype.setSettingItem = function (v) {
|
|
129
|
-
window.store.
|
|
139
|
+
window.store.settingItem = v
|
|
130
140
|
}
|
|
131
141
|
|
|
132
142
|
Store.prototype.setTermSearchOption = function (update) {
|
|
133
|
-
|
|
134
|
-
store
|
|
135
|
-
} = window
|
|
136
|
-
store.setState('termSearchOptions', {
|
|
137
|
-
...JSON.parse(window.store._termSearchOptions),
|
|
138
|
-
...update
|
|
139
|
-
})
|
|
143
|
+
Object.assign(window.store._termSearchOptions, update)
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
Store.prototype.setLeftSidePanelWidth = function (v) {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { Modal } from 'antd'
|
|
6
6
|
import delay from '../common/wait'
|
|
7
|
-
import initWatch from './watch'
|
|
8
7
|
|
|
9
8
|
export default (Store) => {
|
|
10
9
|
Store.prototype.checkForDbUpgrade = async function () {
|
|
@@ -14,7 +13,6 @@ export default (Store) => {
|
|
|
14
13
|
}
|
|
15
14
|
const shouldUpgrade = await window.pre.runGlobalAsync('checkDbUpgrade')
|
|
16
15
|
if (!shouldUpgrade) {
|
|
17
|
-
initWatch(store)
|
|
18
16
|
return false
|
|
19
17
|
}
|
|
20
18
|
const {
|