@electerm/electerm-react 1.38.65 → 1.38.80
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 +6 -3
- package/client/common/create-title.jsx +9 -1
- package/client/common/sftp.js +3 -0
- package/client/components/batch-op/batch-op.jsx +1 -6
- package/client/components/bookmark-form/bookmark-form.styl +3 -1
- package/client/components/bookmark-form/index.jsx +12 -8
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +210 -88
- package/client/components/bookmark-form/ssh-form-ui.jsx +1 -1
- package/client/components/bookmark-form/web-form-ui.jsx +96 -0
- package/client/components/bookmark-form/web-form.jsx +16 -0
- package/client/components/main/main.jsx +14 -0
- package/client/components/quick-commands/qm.styl +1 -1
- package/client/components/session/session.styl +4 -1
- package/client/components/session/sessions.jsx +16 -2
- package/client/components/session/web-session.jsx +20 -0
- package/client/components/sftp/{confirm-modal.jsx → confirm-modal-store.jsx} +81 -50
- package/client/components/sftp/file-item.jsx +2 -0
- package/client/components/sftp/sftp-entry.jsx +27 -37
- package/client/components/sftp/transfer-conflict-store.jsx +291 -0
- package/client/components/sftp/transport-action-store.jsx +430 -0
- package/client/components/sftp/transports-action-store.jsx +102 -0
- package/client/components/sftp/transports-ui-store.jsx +30 -0
- package/client/components/sidebar/transfer-list-control.jsx +5 -14
- package/client/components/sidebar/transport-ui.jsx +2 -12
- package/client/components/tabs/tab.jsx +43 -2
- package/client/components/tabs/tabs.styl +1 -1
- package/client/components/terminal/index.jsx +14 -1
- package/client/components/terminal/terminal-interactive.jsx +15 -0
- package/client/components/terminal-info/disk.jsx +9 -0
- package/client/entry/worker.js +5 -1
- package/client/store/index.js +16 -1
- package/client/store/init-state.js +2 -3
- package/client/store/sync.js +5 -2
- package/client/store/tab.js +1 -1
- package/client/store/transfer-list.js +55 -2
- package/client/store/watch.js +0 -8
- package/package.json +1 -1
- package/client/components/sftp/transfer-conflict.jsx +0 -323
- package/client/components/sftp/transport-action.jsx +0 -412
- package/client/components/sftp/transport-entry.jsx +0 -108
- package/client/components/sftp/transport-types.js +0 -8
- package/client/components/sftp/transports-action.jsx +0 -111
- package/client/components/sftp/transports-ui.jsx +0 -93
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { PureComponent } from 'react'
|
|
2
|
-
import Confirms from './confirm-modal'
|
|
3
|
-
import ConflictHandler from './transfer-conflict'
|
|
4
|
-
import TransfersHandler from './transports-action'
|
|
5
|
-
import deepCopy from 'json-deep-copy'
|
|
6
|
-
import runIdle from '../../common/run-idle'
|
|
7
|
-
import { commonActions } from '../../common/constants'
|
|
8
|
-
import { pick } from 'lodash-es'
|
|
9
|
-
|
|
10
|
-
export default class TransferEntry extends PureComponent {
|
|
11
|
-
constructor (props) {
|
|
12
|
-
super(props)
|
|
13
|
-
this.state = {
|
|
14
|
-
transferToConfirm: null,
|
|
15
|
-
transferList: [],
|
|
16
|
-
pauseAll: false
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
componentDidMount () {
|
|
21
|
-
window.addEventListener('message', this.onAdd)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentWillUnmount () {
|
|
25
|
-
window.removeEventListener('message', this.onAdd)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
onAdd = e => {
|
|
29
|
-
const {
|
|
30
|
-
sessionId,
|
|
31
|
-
list,
|
|
32
|
-
action
|
|
33
|
-
} = e?.data || {}
|
|
34
|
-
if (
|
|
35
|
-
action !== commonActions.addTransfer ||
|
|
36
|
-
sessionId !== this.props.sessionId
|
|
37
|
-
) {
|
|
38
|
-
return false
|
|
39
|
-
}
|
|
40
|
-
this.addTransferList(list)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
modifier = (...args) => {
|
|
44
|
-
runIdle(() => this.setState(...args))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
addTransferList = list => {
|
|
48
|
-
this.modifier((old) => {
|
|
49
|
-
let transferList = deepCopy(old.transferList)
|
|
50
|
-
transferList = [
|
|
51
|
-
...transferList,
|
|
52
|
-
...list
|
|
53
|
-
]
|
|
54
|
-
window.store.setTransfers(transferList)
|
|
55
|
-
return {
|
|
56
|
-
transferList
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
render () {
|
|
62
|
-
const prps1 = {
|
|
63
|
-
transferToConfirm: this.state.transferToConfirm,
|
|
64
|
-
modifier: this.modifier
|
|
65
|
-
}
|
|
66
|
-
const prps2 = {
|
|
67
|
-
transferList: this.state.transferList,
|
|
68
|
-
modifier: this.modifier,
|
|
69
|
-
addTransferList: this.addTransferList,
|
|
70
|
-
transferToConfirm: this.state.transferToConfirm,
|
|
71
|
-
...pick(this.props, [
|
|
72
|
-
'localList',
|
|
73
|
-
'remoteList',
|
|
74
|
-
'sftp',
|
|
75
|
-
'sessionId',
|
|
76
|
-
'host',
|
|
77
|
-
'tab'
|
|
78
|
-
])
|
|
79
|
-
}
|
|
80
|
-
const prps3 = {
|
|
81
|
-
transferList: this.state.transferList,
|
|
82
|
-
modifier: this.modifier,
|
|
83
|
-
pauseAll: this.state.pauseAll,
|
|
84
|
-
localList: this.props.localListDebounce,
|
|
85
|
-
remoteList: this.props.remoteListDebounce,
|
|
86
|
-
...pick(this.props, [
|
|
87
|
-
'sftp',
|
|
88
|
-
'config',
|
|
89
|
-
'tab',
|
|
90
|
-
'sessionId',
|
|
91
|
-
'pid'
|
|
92
|
-
])
|
|
93
|
-
}
|
|
94
|
-
return (
|
|
95
|
-
<div>
|
|
96
|
-
<ConflictHandler
|
|
97
|
-
{...prps2}
|
|
98
|
-
/>
|
|
99
|
-
<TransfersHandler
|
|
100
|
-
{...prps3}
|
|
101
|
-
/>
|
|
102
|
-
<Confirms
|
|
103
|
-
{...prps1}
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const transportTypes = {
|
|
2
|
-
pauseTransport: 'pause-transport',
|
|
3
|
-
resumeTransport: 'resume-transport',
|
|
4
|
-
cancelTransport: 'cancel-transport',
|
|
5
|
-
pauseOrResumeTransfer: 'pause-or-resume-transfer',
|
|
6
|
-
pauseOrResumeAll: 'pause-or-resume-all',
|
|
7
|
-
cancelAll: 'cancel-all'
|
|
8
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* pass transfer list from props
|
|
3
|
-
* when list changes, do transfer and other op
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useDelta, useConditionalEffect } from 'react-delta'
|
|
7
|
-
import copy from 'json-deep-copy'
|
|
8
|
-
import Transports from './transports-ui'
|
|
9
|
-
import { maxTransport } from '../../common/constants'
|
|
10
|
-
import eq from 'fast-deep-equal'
|
|
11
|
-
import { isUndefined } from 'lodash-es'
|
|
12
|
-
|
|
13
|
-
export default (props) => {
|
|
14
|
-
const { transferList, pauseAll, sessionId } = props
|
|
15
|
-
const delta = useDelta(transferList)
|
|
16
|
-
const pauseControl = useDelta(pauseAll)
|
|
17
|
-
async function control () {
|
|
18
|
-
props.modifier((old) => {
|
|
19
|
-
let transferList = copy(old.transferList)
|
|
20
|
-
transferList = transferList.map(t => {
|
|
21
|
-
const {
|
|
22
|
-
typeTo,
|
|
23
|
-
typeFrom,
|
|
24
|
-
fromFile,
|
|
25
|
-
inited
|
|
26
|
-
} = t
|
|
27
|
-
const ready = !!fromFile
|
|
28
|
-
if (typeTo === typeFrom && ready && !inited) {
|
|
29
|
-
t.inited = true
|
|
30
|
-
}
|
|
31
|
-
return t
|
|
32
|
-
})
|
|
33
|
-
if (old.pauseAll) {
|
|
34
|
-
window.store.setTransfers(transferList, sessionId)
|
|
35
|
-
return {
|
|
36
|
-
transferList
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
let count = transferList.filter(t => {
|
|
40
|
-
const {
|
|
41
|
-
typeTo,
|
|
42
|
-
typeFrom,
|
|
43
|
-
inited
|
|
44
|
-
} = t
|
|
45
|
-
return typeTo !== typeFrom && inited
|
|
46
|
-
}).length
|
|
47
|
-
if (count >= maxTransport) {
|
|
48
|
-
window.store.setTransfers(transferList, sessionId)
|
|
49
|
-
return {
|
|
50
|
-
transferList
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const len = transferList.length
|
|
54
|
-
const ids = []
|
|
55
|
-
for (let i = 0; i < len; i++) {
|
|
56
|
-
const tr = transferList[i]
|
|
57
|
-
const {
|
|
58
|
-
typeTo,
|
|
59
|
-
typeFrom,
|
|
60
|
-
inited,
|
|
61
|
-
fromFile,
|
|
62
|
-
error,
|
|
63
|
-
id,
|
|
64
|
-
action,
|
|
65
|
-
parentId,
|
|
66
|
-
expanded
|
|
67
|
-
} = tr
|
|
68
|
-
if (!error) {
|
|
69
|
-
ids.push(id)
|
|
70
|
-
}
|
|
71
|
-
const isTransfer = typeTo !== typeFrom
|
|
72
|
-
const parentFolderNotFinished = parentId && ids.includes(parentId)
|
|
73
|
-
const ready = (
|
|
74
|
-
(action && fromFile && !fromFile.isDirectory) ||
|
|
75
|
-
(action && fromFile && fromFile.isDirectory && expanded)
|
|
76
|
-
)
|
|
77
|
-
if (
|
|
78
|
-
!ready ||
|
|
79
|
-
inited ||
|
|
80
|
-
!isTransfer ||
|
|
81
|
-
parentFolderNotFinished
|
|
82
|
-
) {
|
|
83
|
-
continue
|
|
84
|
-
}
|
|
85
|
-
// if (isTransfer && tr.fromFile.isDirectory) {
|
|
86
|
-
// i = len
|
|
87
|
-
// continue
|
|
88
|
-
// }
|
|
89
|
-
if (
|
|
90
|
-
fromFile && count < maxTransport
|
|
91
|
-
) {
|
|
92
|
-
count++
|
|
93
|
-
tr.inited = true
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
window.store.setTransfers(transferList, sessionId)
|
|
97
|
-
return {
|
|
98
|
-
transferList
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
useConditionalEffect(() => {
|
|
103
|
-
control()
|
|
104
|
-
}, pauseControl && pauseControl.prev && pauseControl.prev !== pauseControl.curr)
|
|
105
|
-
useConditionalEffect(() => {
|
|
106
|
-
control()
|
|
107
|
-
}, delta && !isUndefined(delta.prev) && !eq(delta.prev, delta.curr))
|
|
108
|
-
return (
|
|
109
|
-
<Transports {...props} />
|
|
110
|
-
)
|
|
111
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* transporter UI component
|
|
3
|
-
*/
|
|
4
|
-
import { useRef, useEffect } from 'react'
|
|
5
|
-
import Transport from './transport-action'
|
|
6
|
-
import postMessage from '../../common/post-msg'
|
|
7
|
-
import { transportTypes } from './transport-types'
|
|
8
|
-
|
|
9
|
-
export default function TransportsUI (props) {
|
|
10
|
-
const {
|
|
11
|
-
transferList
|
|
12
|
-
} = props
|
|
13
|
-
const timer = useRef(null)
|
|
14
|
-
function onDestroy () {
|
|
15
|
-
clearTimeout(timer.current)
|
|
16
|
-
}
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
return onDestroy
|
|
19
|
-
}, [])
|
|
20
|
-
const pauseAll = () => {
|
|
21
|
-
props.modifier({
|
|
22
|
-
pauseAll: true
|
|
23
|
-
})
|
|
24
|
-
postMessage({
|
|
25
|
-
action: transportTypes.pauseTransport,
|
|
26
|
-
ids: []
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
const resumeAll = () => {
|
|
30
|
-
props.modifier({
|
|
31
|
-
pauseAll: false
|
|
32
|
-
})
|
|
33
|
-
postMessage({
|
|
34
|
-
action: transportTypes.resumeTransport,
|
|
35
|
-
ids: []
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
const pauseOrResumeAll = () => {
|
|
39
|
-
if (props.pauseAll) {
|
|
40
|
-
return resumeAll()
|
|
41
|
-
}
|
|
42
|
-
return pauseAll()
|
|
43
|
-
}
|
|
44
|
-
const cancelAll = () => {
|
|
45
|
-
props.modifier({
|
|
46
|
-
pauseAll: false
|
|
47
|
-
})
|
|
48
|
-
postMessage({
|
|
49
|
-
action: transportTypes.cancelTransport,
|
|
50
|
-
ids: []
|
|
51
|
-
}, '*')
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function onMessage (e) {
|
|
55
|
-
const action = e?.data?.action
|
|
56
|
-
const id = e?.data?.id
|
|
57
|
-
if (id === props.sessionId || id === 'all') {
|
|
58
|
-
switch (action) {
|
|
59
|
-
case transportTypes.cancelAll:
|
|
60
|
-
cancelAll()
|
|
61
|
-
break
|
|
62
|
-
case transportTypes.pauseOrResumeAll:
|
|
63
|
-
pauseOrResumeAll()
|
|
64
|
-
break
|
|
65
|
-
default:
|
|
66
|
-
break
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function initEvent () {
|
|
71
|
-
window.addEventListener('message', onMessage)
|
|
72
|
-
}
|
|
73
|
-
function destroyEvents () {
|
|
74
|
-
window.removeEventListener('message', onMessage)
|
|
75
|
-
}
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
initEvent()
|
|
78
|
-
return destroyEvents
|
|
79
|
-
}, [])
|
|
80
|
-
if (!transferList.length) {
|
|
81
|
-
return null
|
|
82
|
-
}
|
|
83
|
-
return transferList.map((t, i) => {
|
|
84
|
-
const { id } = t
|
|
85
|
-
return (
|
|
86
|
-
<Transport
|
|
87
|
-
{...props}
|
|
88
|
-
transfer={t}
|
|
89
|
-
key={id + ':tr:' + i}
|
|
90
|
-
/>
|
|
91
|
-
)
|
|
92
|
-
})
|
|
93
|
-
}
|