@electerm/electerm-react 3.2.0 → 3.5.6
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 -8
- package/client/common/fs.js +84 -0
- package/client/components/batch-op/batch-op-alert.jsx +23 -0
- package/client/components/batch-op/batch-op-editor.jsx +206 -0
- package/client/components/batch-op/batch-op-logs.jsx +53 -0
- package/client/components/batch-op/batch-op-runner.jsx +315 -0
- package/client/components/bookmark-form/ai-bookmark-form.jsx +2 -1
- package/client/components/bookmark-form/bookmark-from-history-modal.jsx +2 -1
- package/client/components/bookmark-form/common/fields.jsx +15 -0
- package/client/components/bookmark-form/config/rdp.js +5 -0
- package/client/components/common/auto-check-update.jsx +31 -0
- package/client/components/common/notification.styl +1 -1
- package/client/components/file-transfer/conflict-resolve.jsx +3 -0
- package/client/components/footer/batch-input.jsx +10 -7
- package/client/components/main/error-wrapper.jsx +18 -7
- package/client/components/main/main.jsx +6 -7
- package/client/components/main/upgrade.jsx +133 -104
- package/client/components/main/upgrade.styl +2 -2
- package/client/components/rdp/file-transfer.js +375 -0
- package/client/components/rdp/rdp-session.jsx +169 -76
- package/client/components/rdp/rdp.styl +27 -0
- package/client/components/setting-sync/auto-sync.jsx +53 -0
- package/client/components/setting-sync/data-import.jsx +69 -8
- package/client/components/sftp/address-bar.jsx +23 -3
- package/client/components/sidebar/bookmark-select.jsx +3 -2
- package/client/components/sidebar/history-item.jsx +3 -1
- package/client/components/sidebar/index.jsx +0 -9
- package/client/components/sidebar/info-modal.jsx +7 -2
- package/client/components/tabs/add-btn-menu.jsx +1 -1
- package/client/components/tabs/add-btn.jsx +9 -15
- package/client/components/tabs/quick-connect.jsx +6 -10
- package/client/components/terminal/terminal.jsx +4 -5
- package/client/components/tree-list/tree-list.jsx +115 -10
- package/client/components/tree-list/tree-list.styl +3 -0
- package/client/components/tree-list/tree-search.jsx +9 -1
- package/client/components/widgets/widget-form.jsx +6 -0
- package/client/store/app-upgrade.js +2 -2
- package/client/store/common.js +0 -28
- package/client/store/load-data.js +3 -3
- package/client/store/mcp-handler.js +2 -2
- package/client/store/sync.js +25 -1
- package/client/store/tab.js +1 -1
- package/client/store/watch.js +10 -18
- package/client/views/index.pug +1 -2
- package/package.json +1 -1
- package/client/components/batch-op/batch-op.jsx +0 -694
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PureComponent } from 'react'
|
|
2
2
|
import { CloseOutlined, MinusSquareOutlined, UpCircleOutlined } from '@ant-design/icons'
|
|
3
|
-
import { Button } from 'antd'
|
|
3
|
+
import { Button, Select, Space } from 'antd'
|
|
4
4
|
import { getLatestReleaseInfo, getLatestReleaseVersion } from '../../common/update-check'
|
|
5
5
|
import upgrade from '../../common/upgrade'
|
|
6
6
|
import compare from '../../common/version-compare'
|
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
isMac,
|
|
10
10
|
isWin,
|
|
11
11
|
packInfo,
|
|
12
|
-
downloadUpgradeTimeout
|
|
13
|
-
mirrors
|
|
12
|
+
downloadUpgradeTimeout
|
|
14
13
|
} from '../../common/constants'
|
|
15
14
|
import { checkSkipSrc } from '../../common/check-skip-src'
|
|
16
15
|
import { debounce } from 'lodash-es'
|
|
@@ -18,6 +17,7 @@ import newTerm from '../../common/new-terminal'
|
|
|
18
17
|
import Markdown from '../common/markdown'
|
|
19
18
|
import downloadMirrors from '../../common/download-mirrors'
|
|
20
19
|
import { refsStatic } from '../common/ref'
|
|
20
|
+
import message from '../common/message'
|
|
21
21
|
import './upgrade.styl'
|
|
22
22
|
|
|
23
23
|
const e = window.translate
|
|
@@ -25,10 +25,15 @@ const {
|
|
|
25
25
|
homepage
|
|
26
26
|
} = packInfo
|
|
27
27
|
|
|
28
|
+
const downloadMirrorList = [
|
|
29
|
+
'github',
|
|
30
|
+
'gh-proxy',
|
|
31
|
+
'sourceforge'
|
|
32
|
+
]
|
|
33
|
+
|
|
28
34
|
export default class Upgrade extends PureComponent {
|
|
29
35
|
state = {
|
|
30
|
-
|
|
31
|
-
mirror: mirrors.github
|
|
36
|
+
mirror: downloadMirrorList[1]
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
downloadTimer = null
|
|
@@ -39,15 +44,23 @@ export default class Upgrade extends PureComponent {
|
|
|
39
44
|
}
|
|
40
45
|
this.id = 'upgrade'
|
|
41
46
|
refsStatic.add(this.id, this)
|
|
47
|
+
this.cleanupTimer = setInterval(() => {
|
|
48
|
+
const { noUpdateMessageExpires } = window.store.upgradeInfo
|
|
49
|
+
if (noUpdateMessageExpires && Date.now() > noUpdateMessageExpires) {
|
|
50
|
+
window.store.upgradeInfo.noUpdateMessage = ''
|
|
51
|
+
window.store.upgradeInfo.noUpdateMessageExpires = 0
|
|
52
|
+
}
|
|
53
|
+
}, 1000)
|
|
42
54
|
}
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
componentWillUnmount () {
|
|
57
|
+
if (this.cleanupTimer) {
|
|
58
|
+
clearInterval(this.cleanupTimer)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
appUpdateCheck = (isManual) => {
|
|
63
|
+
this.getLatestRelease(isManual)
|
|
51
64
|
}
|
|
52
65
|
|
|
53
66
|
changeProps = (update) => {
|
|
@@ -67,6 +80,12 @@ export default class Upgrade extends PureComponent {
|
|
|
67
80
|
window.store.upgradeInfo = {}
|
|
68
81
|
}
|
|
69
82
|
|
|
83
|
+
handleMirrorChange = (mirror) => {
|
|
84
|
+
this.setState({
|
|
85
|
+
mirror
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
70
89
|
onData = (upgradePercent) => {
|
|
71
90
|
clearTimeout(this.downloadTimer)
|
|
72
91
|
if (upgradePercent >= 100) {
|
|
@@ -93,17 +112,8 @@ export default class Upgrade extends PureComponent {
|
|
|
93
112
|
}
|
|
94
113
|
|
|
95
114
|
timeout = () => {
|
|
96
|
-
const { mirror } = this.state
|
|
97
115
|
this.cancel()
|
|
98
|
-
|
|
99
|
-
? this.doUpgrade
|
|
100
|
-
: undefined
|
|
101
|
-
const nextMirror = mirror === mirrors['download-electerm']
|
|
102
|
-
? mirrors.sourceforge
|
|
103
|
-
: mirrors['download-electerm']
|
|
104
|
-
this.setState({
|
|
105
|
-
mirror: nextMirror
|
|
106
|
-
}, next)
|
|
116
|
+
message.error('Download timeout, please try again')
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
onEnd = () => {
|
|
@@ -146,7 +156,7 @@ export default class Upgrade extends PureComponent {
|
|
|
146
156
|
this.handleClose()
|
|
147
157
|
}
|
|
148
158
|
|
|
149
|
-
getLatestRelease = async (
|
|
159
|
+
getLatestRelease = async (isManual = false) => {
|
|
150
160
|
const { installSrc } = this.props
|
|
151
161
|
if (checkSkipSrc(installSrc)) {
|
|
152
162
|
return
|
|
@@ -167,10 +177,19 @@ export default class Upgrade extends PureComponent {
|
|
|
167
177
|
const { skipVersion = 'v0.0.0' } = this.props
|
|
168
178
|
const currentVer = 'v' + window.et.version.split('-')[0]
|
|
169
179
|
const latestVer = releaseVer.tag_name
|
|
170
|
-
if (!
|
|
180
|
+
if (!isManual && compare(skipVersion, latestVer) >= 0) {
|
|
171
181
|
return
|
|
172
182
|
}
|
|
173
183
|
const shouldUpgrade = compare(currentVer, latestVer) < 0
|
|
184
|
+
if (!shouldUpgrade) {
|
|
185
|
+
if (isManual) {
|
|
186
|
+
this.changeProps({
|
|
187
|
+
noUpdateMessage: e('noNeed'),
|
|
188
|
+
noUpdateMessageExpires: Date.now() + 3000
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
return
|
|
192
|
+
}
|
|
174
193
|
const canAutoUpgrade = installSrc || isWin || isMac
|
|
175
194
|
let releaseInfo
|
|
176
195
|
if (canAutoUpgrade) {
|
|
@@ -208,28 +227,6 @@ export default class Upgrade extends PureComponent {
|
|
|
208
227
|
)
|
|
209
228
|
}
|
|
210
229
|
|
|
211
|
-
renderCanNotUpgrade = () => {
|
|
212
|
-
const {
|
|
213
|
-
showUpgradeModal
|
|
214
|
-
} = this.props.upgradeInfo
|
|
215
|
-
const cls = `animate upgrade-panel${showUpgradeModal ? '' : ' upgrade-panel-hide'}`
|
|
216
|
-
return (
|
|
217
|
-
<div className={cls}>
|
|
218
|
-
<div className='upgrade-panel-title fix'>
|
|
219
|
-
<span className='fleft'>
|
|
220
|
-
{e('noNeed')}
|
|
221
|
-
</span>
|
|
222
|
-
<span className='fright'>
|
|
223
|
-
<CloseOutlined className='pointer font16 close-upgrade-panel' onClick={this.handleClose} />
|
|
224
|
-
</span>
|
|
225
|
-
</div>
|
|
226
|
-
<div className='upgrade-panel-body'>
|
|
227
|
-
{e('noNeedDesc')}
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
)
|
|
231
|
-
}
|
|
232
|
-
|
|
233
230
|
renderChangeLog = () => {
|
|
234
231
|
const {
|
|
235
232
|
releaseInfo
|
|
@@ -261,38 +258,8 @@ export default class Upgrade extends PureComponent {
|
|
|
261
258
|
)
|
|
262
259
|
}
|
|
263
260
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
showCount
|
|
267
|
-
} = this.state
|
|
268
|
-
const { installSrc } = this.props
|
|
269
|
-
const {
|
|
270
|
-
remoteVersion,
|
|
271
|
-
upgrading,
|
|
272
|
-
checkingRemoteVersion,
|
|
273
|
-
showUpgradeModal,
|
|
274
|
-
upgradePercent,
|
|
275
|
-
shouldUpgrade,
|
|
276
|
-
releaseInfo,
|
|
277
|
-
error
|
|
278
|
-
} = this.props.upgradeInfo
|
|
279
|
-
if (error) {
|
|
280
|
-
return this.renderError(error)
|
|
281
|
-
}
|
|
282
|
-
if (!shouldUpgrade && showCount < 2) {
|
|
283
|
-
return null
|
|
284
|
-
}
|
|
285
|
-
if (!shouldUpgrade && showCount > 1) {
|
|
286
|
-
return this.renderCanNotUpgrade()
|
|
287
|
-
}
|
|
288
|
-
if (checkingRemoteVersion) {
|
|
289
|
-
return null
|
|
290
|
-
}
|
|
291
|
-
const cls = `animate upgrade-panel${showUpgradeModal ? '' : ' upgrade-panel-hide'}`
|
|
292
|
-
const func = upgrading
|
|
293
|
-
? this.cancel
|
|
294
|
-
: this.doUpgrade
|
|
295
|
-
const getLink = (
|
|
261
|
+
renderLinks = () => {
|
|
262
|
+
return (
|
|
296
263
|
<div>
|
|
297
264
|
<p>
|
|
298
265
|
{e('manuallyDownloadFrom')}:
|
|
@@ -307,7 +274,80 @@ export default class Upgrade extends PureComponent {
|
|
|
307
274
|
{this.renderChangeLog()}
|
|
308
275
|
</div>
|
|
309
276
|
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
renderMirrorSelector = () => {
|
|
280
|
+
return (
|
|
281
|
+
<Select
|
|
282
|
+
value={this.state.mirror}
|
|
283
|
+
onChange={this.handleMirrorChange}
|
|
284
|
+
getPopupContainer={() => document.body}
|
|
285
|
+
size='small'
|
|
286
|
+
style={{ height: 32 }}
|
|
287
|
+
>
|
|
288
|
+
{downloadMirrorList.map((opt) => (
|
|
289
|
+
<Select.Option key={opt} value={opt}>{opt}</Select.Option>
|
|
290
|
+
))}
|
|
291
|
+
</Select>
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
renderUpgradeButton = () => {
|
|
296
|
+
const { upgrading, upgradePercent, checkingRemoteVersion } = this.props.upgradeInfo
|
|
297
|
+
if (upgrading) {
|
|
298
|
+
const percent = upgradePercent || 0
|
|
299
|
+
return (
|
|
300
|
+
<Button
|
|
301
|
+
type='primary'
|
|
302
|
+
icon={<UpCircleOutlined />}
|
|
303
|
+
loading={checkingRemoteVersion}
|
|
304
|
+
disabled={checkingRemoteVersion}
|
|
305
|
+
onClick={() => this.cancel()}
|
|
306
|
+
className='mg1b'
|
|
307
|
+
>
|
|
308
|
+
<span>{`${e('upgrading')}... ${percent}% ${e('cancel')}`}</span>
|
|
309
|
+
</Button>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
return (
|
|
313
|
+
<Space.Compact>
|
|
314
|
+
{this.renderMirrorSelector()}
|
|
315
|
+
<Button
|
|
316
|
+
type='primary'
|
|
317
|
+
icon={<UpCircleOutlined />}
|
|
318
|
+
loading={checkingRemoteVersion}
|
|
319
|
+
disabled={checkingRemoteVersion}
|
|
320
|
+
onClick={() => this.doUpgrade()}
|
|
321
|
+
className='mg1b'
|
|
322
|
+
>
|
|
323
|
+
{e('upgrade')}
|
|
324
|
+
</Button>
|
|
325
|
+
</Space.Compact>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
renderUpgradeContent = () => {
|
|
330
|
+
const { installSrc } = this.props
|
|
310
331
|
const skip = checkSkipSrc(installSrc)
|
|
332
|
+
if (skip) {
|
|
333
|
+
return this.renderLinks()
|
|
334
|
+
}
|
|
335
|
+
return (
|
|
336
|
+
<div>
|
|
337
|
+
{this.renderUpgradeButton()}
|
|
338
|
+
{this.renderSkipVersion()}
|
|
339
|
+
<div className='pd1t'>
|
|
340
|
+
{this.renderLinks()}
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
renderUpgradePanel = () => {
|
|
347
|
+
const { remoteVersion, releaseInfo, showUpgradeModal } = this.props.upgradeInfo
|
|
348
|
+
const cls = showUpgradeModal
|
|
349
|
+
? 'animate upgrade-panel'
|
|
350
|
+
: 'animate upgrade-panel upgrade-panel-hide'
|
|
311
351
|
return (
|
|
312
352
|
<div className={cls}>
|
|
313
353
|
<div className='upgrade-panel-title fix'>
|
|
@@ -319,34 +359,23 @@ export default class Upgrade extends PureComponent {
|
|
|
319
359
|
</span>
|
|
320
360
|
</div>
|
|
321
361
|
<div className='upgrade-panel-body'>
|
|
322
|
-
{
|
|
323
|
-
!skip
|
|
324
|
-
? (
|
|
325
|
-
<div>
|
|
326
|
-
<Button
|
|
327
|
-
type='primary'
|
|
328
|
-
icon={<UpCircleOutlined />}
|
|
329
|
-
loading={checkingRemoteVersion}
|
|
330
|
-
disabled={checkingRemoteVersion}
|
|
331
|
-
onClick={func}
|
|
332
|
-
className='mg1b'
|
|
333
|
-
>
|
|
334
|
-
{
|
|
335
|
-
upgrading
|
|
336
|
-
? <span>{`${e('upgrading')}... ${upgradePercent || 0}% ${e('cancel')}`}</span>
|
|
337
|
-
: e('upgrade')
|
|
338
|
-
}
|
|
339
|
-
</Button>
|
|
340
|
-
{this.renderSkipVersion()}
|
|
341
|
-
<div className='pd1t'>
|
|
342
|
-
{getLink}
|
|
343
|
-
</div>
|
|
344
|
-
</div>
|
|
345
|
-
)
|
|
346
|
-
: getLink
|
|
347
|
-
}
|
|
362
|
+
{this.renderUpgradeContent()}
|
|
348
363
|
</div>
|
|
349
364
|
</div>
|
|
350
365
|
)
|
|
351
366
|
}
|
|
367
|
+
|
|
368
|
+
render () {
|
|
369
|
+
const { shouldUpgrade, checkingRemoteVersion, error } = this.props.upgradeInfo
|
|
370
|
+
if (error) {
|
|
371
|
+
return this.renderError(error)
|
|
372
|
+
}
|
|
373
|
+
if (!shouldUpgrade) {
|
|
374
|
+
return null
|
|
375
|
+
}
|
|
376
|
+
if (checkingRemoteVersion) {
|
|
377
|
+
return null
|
|
378
|
+
}
|
|
379
|
+
return this.renderUpgradePanel()
|
|
380
|
+
}
|
|
352
381
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
position fixed
|
|
3
3
|
right 10px
|
|
4
4
|
bottom 10px
|
|
5
|
-
z-index
|
|
5
|
+
z-index 888
|
|
6
6
|
background var(--main)
|
|
7
7
|
border-radius 5px
|
|
8
8
|
border 1px solid var(--main-darker)
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
.upgrade-panel-title
|
|
23
23
|
border-bottom 1px solid var(--main-darker)
|
|
24
24
|
.markdown-wrap
|
|
25
|
-
max-height
|
|
25
|
+
max-height 20vh
|
|
26
26
|
overflow-y auto
|