@electerm/electerm-react 1.39.76 → 1.39.88
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 +7 -0
- package/client/common/create-title.jsx +1 -1
- package/client/common/default-setting.js +2 -1
- package/client/components/bookmark-form/color-picker.jsx +1 -1
- package/client/components/bookmark-form/render-delayed-scripts.jsx +35 -33
- package/client/components/footer/footer.styl +1 -1
- package/client/components/session/session.jsx +1 -1
- package/client/components/setting-sync/data-select-item.jsx +25 -0
- package/client/components/setting-sync/data-select.jsx +51 -0
- package/client/components/setting-sync/setting-sync.jsx +12 -1
- package/client/components/sftp/file-item.jsx +2 -2
- package/client/components/sidebar/side-panel.jsx +3 -2
- package/client/components/tabs/tab-title.jsx +1 -1
- package/client/components/tabs/tab.jsx +26 -0
- package/client/components/tabs/tabs.styl +3 -0
- package/client/components/terminal/index.jsx +1 -1
- package/client/components/terminal/term-search.jsx +5 -4
- package/client/components/terminal-info/data-cols-parser.jsx +13 -11
- package/client/components/terminal-info/terminal-info.styl +4 -4
- package/client/components/tree-list/tree-list.styl +3 -2
- package/client/store/sync.js +104 -54
- package/package.json +1 -1
|
@@ -352,3 +352,10 @@ export const instSftpKeys = [
|
|
|
352
352
|
]
|
|
353
353
|
export const cwdId = '=__+__'
|
|
354
354
|
export const zmodemTransferPackSize = 1024 * 1024 * 2
|
|
355
|
+
export const syncDataMaps = {
|
|
356
|
+
settings: ['config'],
|
|
357
|
+
bookmarks: ['bookmarks', 'bookmarkGroups', 'profiles'],
|
|
358
|
+
terminalThemes: ['terminalThemes'],
|
|
359
|
+
quickCommands: ['quickCommands'],
|
|
360
|
+
addressBookmarks: ['addressBookmarks']
|
|
361
|
+
}
|
|
@@ -16,41 +16,43 @@ const e = prefix('form')
|
|
|
16
16
|
export default function renderRunScripts () {
|
|
17
17
|
function renderItem (field, i, add, remove) {
|
|
18
18
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<FormItem
|
|
24
|
-
label=''
|
|
25
|
-
name={[field.name, 'delay']}
|
|
26
|
-
required
|
|
27
|
-
>
|
|
28
|
-
<InputNumber
|
|
29
|
-
min={1}
|
|
30
|
-
step={1}
|
|
31
|
-
max={65535}
|
|
32
|
-
addonBefore={e('loginScriptDelay')}
|
|
33
|
-
className='compact-input'
|
|
34
|
-
/>
|
|
35
|
-
</FormItem>
|
|
36
|
-
<FormItem
|
|
37
|
-
label=''
|
|
38
|
-
name={[field.name, 'script']}
|
|
39
|
-
required
|
|
40
|
-
className='mg2x'
|
|
19
|
+
<div>
|
|
20
|
+
<Space
|
|
21
|
+
align='center'
|
|
22
|
+
key={field.key}
|
|
41
23
|
>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
24
|
+
<FormItem
|
|
25
|
+
label=''
|
|
26
|
+
name={[field.name, 'delay']}
|
|
27
|
+
required
|
|
28
|
+
>
|
|
29
|
+
<InputNumber
|
|
30
|
+
min={1}
|
|
31
|
+
step={1}
|
|
32
|
+
max={65535}
|
|
33
|
+
addonBefore={e('loginScriptDelay')}
|
|
34
|
+
className='compact-input'
|
|
35
|
+
/>
|
|
36
|
+
</FormItem>
|
|
37
|
+
<FormItem
|
|
38
|
+
label=''
|
|
39
|
+
name={[field.name, 'script']}
|
|
40
|
+
required
|
|
41
|
+
className='mg2x'
|
|
42
|
+
>
|
|
43
|
+
<Input.TextArea
|
|
44
|
+
rows={1}
|
|
45
|
+
placeholder={e('loginScript')}
|
|
46
|
+
className='compact-input'
|
|
47
|
+
/>
|
|
48
|
+
</FormItem>
|
|
49
|
+
<Button
|
|
50
|
+
icon={<MinusCircleOutlined />}
|
|
51
|
+
onClick={() => remove(field.name)}
|
|
52
|
+
className='mg24b'
|
|
46
53
|
/>
|
|
47
|
-
</
|
|
48
|
-
|
|
49
|
-
icon={<MinusCircleOutlined />}
|
|
50
|
-
onClick={() => remove(field.name)}
|
|
51
|
-
className='mg24b'
|
|
52
|
-
/>
|
|
53
|
-
</Space>
|
|
54
|
+
</Space>
|
|
55
|
+
</div>
|
|
54
56
|
)
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Checkbox
|
|
3
|
+
} from 'antd'
|
|
4
|
+
|
|
5
|
+
export default function DataSelectItem (props) {
|
|
6
|
+
const {
|
|
7
|
+
title,
|
|
8
|
+
checked,
|
|
9
|
+
value,
|
|
10
|
+
onChange
|
|
11
|
+
} = props
|
|
12
|
+
const boxProps = {
|
|
13
|
+
checked,
|
|
14
|
+
onChange,
|
|
15
|
+
'data-key': value
|
|
16
|
+
}
|
|
17
|
+
return (
|
|
18
|
+
<Checkbox
|
|
19
|
+
key={value}
|
|
20
|
+
{...boxProps}
|
|
21
|
+
>
|
|
22
|
+
{title}
|
|
23
|
+
</Checkbox>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
syncDataMaps
|
|
3
|
+
} from '../../common/constants'
|
|
4
|
+
import DataSelectItem from './data-select-item'
|
|
5
|
+
|
|
6
|
+
const { prefix } = window
|
|
7
|
+
const e = prefix('common')
|
|
8
|
+
const f = prefix('config')
|
|
9
|
+
const t = prefix('terminalThemes')
|
|
10
|
+
const q = prefix('quickCommands')
|
|
11
|
+
|
|
12
|
+
const translateMap = {
|
|
13
|
+
settings: f,
|
|
14
|
+
terminalThemes: t,
|
|
15
|
+
quickCommands: q,
|
|
16
|
+
bookmarks: e,
|
|
17
|
+
addressBookmarks: e
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default function DataSelect (props) {
|
|
21
|
+
const {
|
|
22
|
+
dataSyncSelected
|
|
23
|
+
} = props
|
|
24
|
+
function onChange (e) {
|
|
25
|
+
const key = e.target['data-key']
|
|
26
|
+
window.store.toggleDataSyncSelected(key)
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<div className='pd2y pd1x'>
|
|
30
|
+
{
|
|
31
|
+
Object.keys(syncDataMaps)
|
|
32
|
+
.map(d => {
|
|
33
|
+
const checked = dataSyncSelected.includes(d)
|
|
34
|
+
const title = translateMap[d](d)
|
|
35
|
+
const boxProps = {
|
|
36
|
+
checked,
|
|
37
|
+
onChange,
|
|
38
|
+
title,
|
|
39
|
+
value: d
|
|
40
|
+
}
|
|
41
|
+
return (
|
|
42
|
+
<DataSelectItem
|
|
43
|
+
key={d}
|
|
44
|
+
{...boxProps}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
import { Component } from '../common/react-subx'
|
|
5
5
|
import { Tabs, Spin } from 'antd'
|
|
6
6
|
import SyncForm from './setting-sync-form'
|
|
7
|
-
import { syncTypes } from '../../common/constants'
|
|
7
|
+
import { syncTypes, syncDataMaps } from '../../common/constants'
|
|
8
8
|
import { DataTransport } from './data-import'
|
|
9
|
+
import DataSelect from './data-select'
|
|
9
10
|
import { pick } from 'lodash-es'
|
|
10
11
|
|
|
11
12
|
export default class SyncSettingEntry extends Component {
|
|
@@ -62,6 +63,15 @@ export default class SyncSettingEntry extends Component {
|
|
|
62
63
|
children: null
|
|
63
64
|
}
|
|
64
65
|
})
|
|
66
|
+
const {
|
|
67
|
+
dataSyncSelected
|
|
68
|
+
} = store.config
|
|
69
|
+
const arr = dataSyncSelected && dataSyncSelected !== 'all'
|
|
70
|
+
? dataSyncSelected.split(',')
|
|
71
|
+
: Object.keys(syncDataMaps)
|
|
72
|
+
const dataSelectProps = {
|
|
73
|
+
dataSyncSelected: arr
|
|
74
|
+
}
|
|
65
75
|
return (
|
|
66
76
|
<div className='pd2l'>
|
|
67
77
|
<DataTransport store={store} />
|
|
@@ -74,6 +84,7 @@ export default class SyncSettingEntry extends Component {
|
|
|
74
84
|
{
|
|
75
85
|
this.renderForm()
|
|
76
86
|
}
|
|
87
|
+
<DataSelect {...dataSelectProps} />
|
|
77
88
|
</Spin>
|
|
78
89
|
</div>
|
|
79
90
|
)
|
|
@@ -967,7 +967,7 @@ export default class FileSection extends React.Component {
|
|
|
967
967
|
if (
|
|
968
968
|
isDirectory && id &&
|
|
969
969
|
(
|
|
970
|
-
(hasHost && enableSsh && isRemote) ||
|
|
970
|
+
(hasHost && enableSsh !== false && isRemote) ||
|
|
971
971
|
(isLocal && !hasHost)
|
|
972
972
|
)
|
|
973
973
|
) {
|
|
@@ -1047,7 +1047,7 @@ export default class FileSection extends React.Component {
|
|
|
1047
1047
|
text: m('copyFilePath')
|
|
1048
1048
|
})
|
|
1049
1049
|
}
|
|
1050
|
-
if (enableSsh || isLocal) {
|
|
1050
|
+
if (enableSsh !== false || isLocal) {
|
|
1051
1051
|
res.push({
|
|
1052
1052
|
func: 'newFile',
|
|
1053
1053
|
icon: 'FileAddOutlined',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PureComponent } from 'react'
|
|
2
2
|
export default class SidePanel extends PureComponent {
|
|
3
3
|
handleMousedown = (e) => {
|
|
4
|
+
e.stopPropagation()
|
|
4
5
|
this.dragStart = true
|
|
5
6
|
this.clientX = e.clientX
|
|
6
7
|
window.addEventListener('mouseup', this.handleMouseup)
|
|
@@ -13,8 +14,8 @@ export default class SidePanel extends PureComponent {
|
|
|
13
14
|
clientX
|
|
14
15
|
} = e
|
|
15
16
|
let nw = clientX - this.clientX + this.props.leftSidebarWidth
|
|
16
|
-
if (nw <
|
|
17
|
-
nw =
|
|
17
|
+
if (nw < 150) {
|
|
18
|
+
nw = 150
|
|
18
19
|
} else if (nw > 600) {
|
|
19
20
|
nw = 600
|
|
20
21
|
}
|
|
@@ -40,6 +40,7 @@ class Tab extends Component {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
componentDidMount () {
|
|
43
|
+
console.log(this.props)
|
|
43
44
|
this.dom = document.getElementById('id' + this.state.tab.id)
|
|
44
45
|
window.addEventListener('message', this.onEvent)
|
|
45
46
|
}
|
|
@@ -58,6 +59,31 @@ class Tab extends Component {
|
|
|
58
59
|
clearTimeout(this.handler)
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
shouldComponentUpdate (nextProps, nextState) {
|
|
63
|
+
return this.shouldUpdate(this.props, nextProps) || this.shouldUpdateState(this.state, nextState)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
shouldUpdateState = (prevState, nextState) => {
|
|
67
|
+
return !isEqual(prevState, nextState)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
shouldUpdate = (prevProps, nextProps) => {
|
|
71
|
+
// todo currentTabId still need improve
|
|
72
|
+
const pickKeys = [
|
|
73
|
+
'currentTabId',
|
|
74
|
+
'height',
|
|
75
|
+
'isLast',
|
|
76
|
+
'isMaximized',
|
|
77
|
+
'activeTerminalId',
|
|
78
|
+
'config',
|
|
79
|
+
'tab',
|
|
80
|
+
'width'
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
// compare only the relevant props
|
|
84
|
+
return !isEqual(pick(prevProps, pickKeys), pick(nextProps, pickKeys))
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
modifier = (...args) => {
|
|
62
88
|
runIdle(() => this.setState(...args))
|
|
63
89
|
}
|
|
@@ -197,10 +197,11 @@ class TermSearch extends Component {
|
|
|
197
197
|
termSearchOpen,
|
|
198
198
|
termSearch
|
|
199
199
|
} = store
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
if (
|
|
201
|
+
!termSearchOpen ||
|
|
202
|
+
!currentTab ||
|
|
203
|
+
currentTab.pane === paneMap.fileManager
|
|
204
|
+
) {
|
|
204
205
|
return null
|
|
205
206
|
}
|
|
206
207
|
const props = {
|
|
@@ -2,9 +2,6 @@ import { copy } from '../../common/clipboard'
|
|
|
2
2
|
import filesizeParser from 'filesize-parser'
|
|
3
3
|
import { formatBytes } from '../../common/byte-format'
|
|
4
4
|
|
|
5
|
-
const { prefix } = window
|
|
6
|
-
const m = prefix('menu')
|
|
7
|
-
|
|
8
5
|
const valueParserMaps = {
|
|
9
6
|
size: v => v,
|
|
10
7
|
used: filesizeParser,
|
|
@@ -19,19 +16,24 @@ function valueParse (obj, k) {
|
|
|
19
16
|
return obj[k]
|
|
20
17
|
}
|
|
21
18
|
|
|
19
|
+
function copyValue (event) {
|
|
20
|
+
copy(event.target.getAttribute('data-content'))
|
|
21
|
+
}
|
|
22
|
+
|
|
22
23
|
export default (data) => {
|
|
23
24
|
return Object.keys(data).map(k => {
|
|
24
25
|
const rd = (txt) => {
|
|
25
26
|
const r = k === 'mem' ? formatBytes(parseInt(txt, 10)) : txt
|
|
27
|
+
const itemProps = {
|
|
28
|
+
className: 'activity-item pointer',
|
|
29
|
+
'data-content': r,
|
|
30
|
+
onClick: copyValue
|
|
31
|
+
}
|
|
26
32
|
return (
|
|
27
|
-
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
onClick={() => copy(txt)}
|
|
32
|
-
>
|
|
33
|
-
{m('copy')}
|
|
34
|
-
</span>
|
|
33
|
+
<div
|
|
34
|
+
{...itemProps}
|
|
35
|
+
>
|
|
36
|
+
{r}
|
|
35
37
|
</div>
|
|
36
38
|
)
|
|
37
39
|
}
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
max-height 260px
|
|
30
30
|
overflow-y scroll
|
|
31
31
|
.activity-item
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
&:hover
|
|
35
|
-
|
|
32
|
+
max-height 1.6em
|
|
33
|
+
line-height 1.6
|
|
34
|
+
&:hover
|
|
35
|
+
max-height none
|
|
36
36
|
.info-panel-wrap-pin
|
|
37
37
|
.toggle-info-panel-wrap
|
|
38
38
|
color success
|
package/client/store/sync.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* sync data to github gist related
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { get, pick, debounce, findIndex } from 'lodash-es'
|
|
6
6
|
import copy from 'json-deep-copy'
|
|
7
7
|
import {
|
|
8
|
-
settingMap, packInfo, syncTypes
|
|
8
|
+
settingMap, packInfo, syncTypes, syncDataMaps
|
|
9
9
|
} from '../common/constants'
|
|
10
10
|
import { remove, dbNames, insert, update, getData } from '../common/db'
|
|
11
11
|
import fetch from '../common/fetch-from-server'
|
|
@@ -14,7 +14,6 @@ import { fixBookmarks } from '../common/db-fix'
|
|
|
14
14
|
import dayjs from 'dayjs'
|
|
15
15
|
import parseJsonSafe from '../common/parse-json-safe'
|
|
16
16
|
|
|
17
|
-
const names = without(dbNames, settingMap.history)
|
|
18
17
|
const {
|
|
19
18
|
version: packVer
|
|
20
19
|
} = packInfo
|
|
@@ -162,6 +161,7 @@ export default (Store) => {
|
|
|
162
161
|
}
|
|
163
162
|
const pass = store.getSyncPassword(type)
|
|
164
163
|
const objs = {}
|
|
164
|
+
const { names, syncConfig } = store.getDataSyncNames()
|
|
165
165
|
for (const n of names) {
|
|
166
166
|
let str = store.getItems(n)
|
|
167
167
|
const order = await getData(`${n}:order`)
|
|
@@ -182,14 +182,18 @@ export default (Store) => {
|
|
|
182
182
|
objs[`${n}.order.json`] = {
|
|
183
183
|
content: 'empty'
|
|
184
184
|
}
|
|
185
|
+
if (syncConfig) {
|
|
186
|
+
objs['userConfig.json'] = {
|
|
187
|
+
content: JSON.stringify(
|
|
188
|
+
store.getSyncConfig()
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
185
192
|
}
|
|
186
193
|
const res = await fetchData(type, 'update', [gistId, {
|
|
187
194
|
description: 'sync electerm data',
|
|
188
195
|
files: {
|
|
189
196
|
...objs,
|
|
190
|
-
'userConfig.json': {
|
|
191
|
-
content: JSON.stringify(pick(store.config, ['theme']))
|
|
192
|
-
},
|
|
193
197
|
'electerm-status.json': {
|
|
194
198
|
content: JSON.stringify({
|
|
195
199
|
lastSyncTime: Date.now(),
|
|
@@ -230,6 +234,7 @@ export default (Store) => {
|
|
|
230
234
|
store.getProxySetting()
|
|
231
235
|
)
|
|
232
236
|
const toInsert = []
|
|
237
|
+
const { names, syncConfig } = store.getDataSyncNames()
|
|
233
238
|
for (const n of names) {
|
|
234
239
|
let str = get(gist, `files["${n}.json"].content`)
|
|
235
240
|
if (!str) {
|
|
@@ -267,12 +272,18 @@ export default (Store) => {
|
|
|
267
272
|
})
|
|
268
273
|
store.setItems(n, arr)
|
|
269
274
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
+
if (syncConfig) {
|
|
276
|
+
const userConfig = parseJsonSafe(
|
|
277
|
+
get(gist, 'files["userConfig.json"].content')
|
|
278
|
+
)
|
|
279
|
+
if (userConfig) {
|
|
280
|
+
store.setConfig(userConfig)
|
|
281
|
+
}
|
|
282
|
+
if (userConfig && userConfig.theme) {
|
|
283
|
+
store.setTheme(userConfig.theme)
|
|
284
|
+
}
|
|
275
285
|
}
|
|
286
|
+
|
|
276
287
|
const up = {
|
|
277
288
|
[type + 'LastSyncTime']: Date.now()
|
|
278
289
|
}
|
|
@@ -331,6 +342,7 @@ export default (Store) => {
|
|
|
331
342
|
Store.prototype.handleExportAllData = async function () {
|
|
332
343
|
const { store } = window
|
|
333
344
|
const objs = {}
|
|
345
|
+
const names = store.getDataSyncNames(true)
|
|
334
346
|
for (const n of names) {
|
|
335
347
|
objs[n] = store.getItems(n)
|
|
336
348
|
const order = await getData(`${n}:order`)
|
|
@@ -342,49 +354,7 @@ export default (Store) => {
|
|
|
342
354
|
})
|
|
343
355
|
}
|
|
344
356
|
}
|
|
345
|
-
objs.config =
|
|
346
|
-
'theme',
|
|
347
|
-
'useSystemTitleBar',
|
|
348
|
-
'defaultEditor',
|
|
349
|
-
'checkUpdateOnStart',
|
|
350
|
-
'confirmBeforeExit',
|
|
351
|
-
'ctrlOrMetaOpenTerminalLink',
|
|
352
|
-
'cursorStyle',
|
|
353
|
-
'defaultEditor',
|
|
354
|
-
'disableSshHistory',
|
|
355
|
-
'disableTransferHistory',
|
|
356
|
-
'enableGlobalProxy',
|
|
357
|
-
'execLinux',
|
|
358
|
-
'execLinuxArgs',
|
|
359
|
-
'execMac',
|
|
360
|
-
'execMacArgs',
|
|
361
|
-
'execWindows',
|
|
362
|
-
'execWindowsArgs',
|
|
363
|
-
'fontFamily',
|
|
364
|
-
'fontSize',
|
|
365
|
-
'hotkey',
|
|
366
|
-
'keepaliveCountMax',
|
|
367
|
-
'keepaliveInterval',
|
|
368
|
-
'language',
|
|
369
|
-
'opacity',
|
|
370
|
-
'pasteWhenContextMenu',
|
|
371
|
-
'proxyIp',
|
|
372
|
-
'proxyPassword',
|
|
373
|
-
'proxyPort',
|
|
374
|
-
'proxyType',
|
|
375
|
-
'proxyUsername',
|
|
376
|
-
'rendererType',
|
|
377
|
-
'rightClickSelectsWord',
|
|
378
|
-
'saveTerminalLogToFile',
|
|
379
|
-
'scrollback',
|
|
380
|
-
'sshReadyTimeout',
|
|
381
|
-
'syncSetting',
|
|
382
|
-
'terminalTimeout',
|
|
383
|
-
'terminalType',
|
|
384
|
-
'theme',
|
|
385
|
-
'useSystemTitleBar',
|
|
386
|
-
'zoom'
|
|
387
|
-
])
|
|
357
|
+
objs.config = store.config
|
|
388
358
|
const text = JSON.stringify(objs)
|
|
389
359
|
const name = dayjs().format('YYYY-MM-DD-HH-mm-ss') + '-electerm-all-data.json'
|
|
390
360
|
download(name, text)
|
|
@@ -396,6 +366,7 @@ export default (Store) => {
|
|
|
396
366
|
const { store } = window
|
|
397
367
|
const objs = JSON.parse(txt)
|
|
398
368
|
const toInsert = []
|
|
369
|
+
const { names } = store.getDataSyncNames(true)
|
|
399
370
|
for (const n of names) {
|
|
400
371
|
let arr = objs[n]
|
|
401
372
|
if (n === settingMap.terminalThemes) {
|
|
@@ -423,4 +394,83 @@ export default (Store) => {
|
|
|
423
394
|
autoSync: v
|
|
424
395
|
})
|
|
425
396
|
}
|
|
397
|
+
|
|
398
|
+
Store.prototype.toggleDataSyncSelected = function (key) {
|
|
399
|
+
const { store } = window
|
|
400
|
+
const {
|
|
401
|
+
dataSyncSelected
|
|
402
|
+
} = store.config
|
|
403
|
+
let arr = dataSyncSelected && dataSyncSelected !== 'all'
|
|
404
|
+
? dataSyncSelected.split(',')
|
|
405
|
+
: Object.keys(syncDataMaps)
|
|
406
|
+
if (arr.includes(key)) {
|
|
407
|
+
arr = arr.filter(d => d !== key)
|
|
408
|
+
} else {
|
|
409
|
+
arr.push(key)
|
|
410
|
+
}
|
|
411
|
+
store.setConfig({
|
|
412
|
+
dataSyncSelected: arr.join(',')
|
|
413
|
+
})
|
|
414
|
+
}
|
|
415
|
+
Store.prototype.getDataSyncNames = function (all) {
|
|
416
|
+
const { store } = window
|
|
417
|
+
const {
|
|
418
|
+
dataSyncSelected
|
|
419
|
+
} = store.config
|
|
420
|
+
const syncAll = all || dataSyncSelected === 'all'
|
|
421
|
+
const keys = syncAll
|
|
422
|
+
? Object.keys(syncDataMaps)
|
|
423
|
+
: dataSyncSelected.split(',')
|
|
424
|
+
const names = keys
|
|
425
|
+
.filter(d => d !== 'settings')
|
|
426
|
+
.map(d => syncDataMaps[d]).flat()
|
|
427
|
+
const syncConfig = keys.includes('settings')
|
|
428
|
+
return {
|
|
429
|
+
names,
|
|
430
|
+
syncConfig
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
Store.prototype.getSyncConfig = function () {
|
|
434
|
+
const { store } = window
|
|
435
|
+
const configSyncKeys = [
|
|
436
|
+
'keepaliveInterval',
|
|
437
|
+
'rightClickSelectsWord',
|
|
438
|
+
'pasteWhenContextMenu',
|
|
439
|
+
'ctrlOrMetaOpenTerminalLink',
|
|
440
|
+
'hotkey',
|
|
441
|
+
'sshReadyTimeout',
|
|
442
|
+
'scrollback',
|
|
443
|
+
'fontSize',
|
|
444
|
+
'execWindows',
|
|
445
|
+
'execMac',
|
|
446
|
+
'execLinux',
|
|
447
|
+
'execWindowsArgs',
|
|
448
|
+
'execMacArgs',
|
|
449
|
+
'execLinuxArgs',
|
|
450
|
+
'disableSshHistory',
|
|
451
|
+
'disableTransferHistory',
|
|
452
|
+
'terminalType',
|
|
453
|
+
'keepaliveCountMax',
|
|
454
|
+
'saveTerminalLogToFile',
|
|
455
|
+
'checkUpdateOnStart',
|
|
456
|
+
'cursorBlink',
|
|
457
|
+
'cursorStyle',
|
|
458
|
+
'terminalWordSeparator',
|
|
459
|
+
'confirmBeforeExit',
|
|
460
|
+
'autoRefreshWhenSwitchToSftp',
|
|
461
|
+
'addTimeStampToTermLog',
|
|
462
|
+
'showHiddenFilesOnSftpStart',
|
|
463
|
+
'terminalInfos',
|
|
464
|
+
'filePropsEnabled',
|
|
465
|
+
'hideIP',
|
|
466
|
+
'terminalTimeout',
|
|
467
|
+
'theme',
|
|
468
|
+
'terminalTypes',
|
|
469
|
+
'language',
|
|
470
|
+
'copyWhenSelect',
|
|
471
|
+
'customCss',
|
|
472
|
+
'dataSyncSelected'
|
|
473
|
+
]
|
|
474
|
+
return pick(store.config, configSyncKeys)
|
|
475
|
+
}
|
|
426
476
|
}
|