@electerm/electerm-react 1.37.110 → 1.37.121
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 -0
- package/client/components/setting-panel/tree-list.jsx +17 -7
- package/client/components/sftp/file-item.jsx +28 -15
- package/client/components/sftp/file-read.js +27 -1
- package/client/components/sftp/transfer-conflict.jsx +11 -3
- package/client/components/sidebar/bookmark.jsx +1 -1
- package/client/components/sidebar/sidebar.styl +2 -0
- package/client/components/tabs/app-drag.jsx +0 -1
- package/package.json +1 -1
|
@@ -334,7 +334,7 @@ export default class ItemListTree extends Component {
|
|
|
334
334
|
|
|
335
335
|
renderSearch = () => {
|
|
336
336
|
return (
|
|
337
|
-
<div className='pd1y
|
|
337
|
+
<div className='pd1y'>
|
|
338
338
|
<Search
|
|
339
339
|
onChange={this.handleChange}
|
|
340
340
|
value={this.state.keyword}
|
|
@@ -723,15 +723,25 @@ export default class ItemListTree extends Component {
|
|
|
723
723
|
title,
|
|
724
724
|
this.state.keyword
|
|
725
725
|
)
|
|
726
|
+
const propsAll = {
|
|
727
|
+
className: cls,
|
|
728
|
+
title: titleAll,
|
|
729
|
+
onContextMenu: e => this.onContextMenu(e, item, isGroup)
|
|
730
|
+
}
|
|
731
|
+
const titleProps = {
|
|
732
|
+
className: 'tree-item-title elli',
|
|
733
|
+
style: this.props.staticList
|
|
734
|
+
? { maxWidth: (this.props.store.leftSidebarWidth - 110) + 'px' }
|
|
735
|
+
: undefined
|
|
736
|
+
}
|
|
737
|
+
const key = item.id || uid()
|
|
726
738
|
return (
|
|
727
739
|
<div
|
|
728
|
-
|
|
729
|
-
key={
|
|
730
|
-
title={titleAll}
|
|
731
|
-
onContextMenu={e => this.onContextMenu(e, item, isGroup)}
|
|
740
|
+
{...propsAll}
|
|
741
|
+
key={key}
|
|
732
742
|
>
|
|
733
743
|
<div
|
|
734
|
-
|
|
744
|
+
{...titleProps}
|
|
735
745
|
>
|
|
736
746
|
{tag}{titleHighlight}
|
|
737
747
|
</div>
|
|
@@ -965,7 +975,7 @@ export default class ItemListTree extends Component {
|
|
|
965
975
|
{
|
|
966
976
|
this.renderSearch()
|
|
967
977
|
}
|
|
968
|
-
<div className='item-list-wrap
|
|
978
|
+
<div className='item-list-wrap' style={listStyle}>
|
|
969
979
|
{this.renderNewBookmarkGroup()}
|
|
970
980
|
<Tree
|
|
971
981
|
{...treeProps}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '../../common/constants'
|
|
29
29
|
import findParent from '../../common/find-parent'
|
|
30
30
|
import sorter from '../../common/index-sorter'
|
|
31
|
-
import { getFolderFromFilePath } from './file-read'
|
|
31
|
+
import { getFolderFromFilePath, getLocalFileInfo, checkFolderSize } from './file-read'
|
|
32
32
|
import { readClipboard, copy as copyToClipboard, hasFileInClipboardText } from '../../common/clipboard'
|
|
33
33
|
import fs from '../../common/fs'
|
|
34
34
|
import time from '../../common/time'
|
|
@@ -286,7 +286,7 @@ export default class FileSection extends React.Component {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
onDropFile = (fromFiles, toFile, fromFileManager) => {
|
|
289
|
+
onDropFile = async (fromFiles, toFile, fromFileManager) => {
|
|
290
290
|
const { type: fromType } = fromFiles[0]
|
|
291
291
|
const {
|
|
292
292
|
id,
|
|
@@ -321,7 +321,25 @@ export default class FileSection extends React.Component {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// other side, do transfer
|
|
324
|
-
|
|
324
|
+
let files = fromFiles
|
|
325
|
+
if (fromFileManager) {
|
|
326
|
+
files = await this.filterFiles(fromFiles)
|
|
327
|
+
}
|
|
328
|
+
this.transferDrop(files, toFile, operation)
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
filterFiles = async (files) => {
|
|
332
|
+
const res = []
|
|
333
|
+
for (const file of files) {
|
|
334
|
+
const { base, path } = file
|
|
335
|
+
const info = await getLocalFileInfo(
|
|
336
|
+
resolve(path, base)
|
|
337
|
+
)
|
|
338
|
+
if (info) {
|
|
339
|
+
res.push(info)
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return res
|
|
325
343
|
}
|
|
326
344
|
|
|
327
345
|
transferDrop = (fromFiles, toFile, operation) => {
|
|
@@ -763,7 +781,7 @@ export default class FileSection extends React.Component {
|
|
|
763
781
|
}
|
|
764
782
|
}
|
|
765
783
|
|
|
766
|
-
getTransferList = (
|
|
784
|
+
getTransferList = async (
|
|
767
785
|
file,
|
|
768
786
|
toPathBase,
|
|
769
787
|
_typeTo,
|
|
@@ -793,15 +811,16 @@ export default class FileSection extends React.Component {
|
|
|
793
811
|
operation
|
|
794
812
|
}
|
|
795
813
|
if (isDirectory) {
|
|
814
|
+
const zip = await checkFolderSize(this.props, file)
|
|
796
815
|
Object.assign(obj, {
|
|
797
|
-
zip
|
|
798
|
-
skipExpand:
|
|
816
|
+
zip,
|
|
817
|
+
skipExpand: zip
|
|
799
818
|
})
|
|
800
819
|
}
|
|
801
820
|
return [obj]
|
|
802
821
|
}
|
|
803
822
|
|
|
804
|
-
doTransferSelected = (
|
|
823
|
+
doTransferSelected = async (
|
|
805
824
|
e,
|
|
806
825
|
selectedFiles = this.props.selectedFiles,
|
|
807
826
|
toPathBase,
|
|
@@ -810,7 +829,7 @@ export default class FileSection extends React.Component {
|
|
|
810
829
|
) => {
|
|
811
830
|
let all = []
|
|
812
831
|
for (const f of selectedFiles) {
|
|
813
|
-
const arr = this.getTransferList(f, toPathBase, typeTo, operation)
|
|
832
|
+
const arr = await this.getTransferList(f, toPathBase, typeTo, operation)
|
|
814
833
|
all = [
|
|
815
834
|
...all,
|
|
816
835
|
...arr
|
|
@@ -821,13 +840,7 @@ export default class FileSection extends React.Component {
|
|
|
821
840
|
|
|
822
841
|
transfer = async () => {
|
|
823
842
|
const { file } = this.state
|
|
824
|
-
const arr = this.getTransferList(file)
|
|
825
|
-
this.props.addTransferList(arr)
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
zipTransferDirectory = () => {
|
|
829
|
-
const { file } = this.state
|
|
830
|
-
const arr = this.getTransferList(file)
|
|
843
|
+
const arr = await this.getTransferList(file)
|
|
831
844
|
this.props.addTransferList(arr)
|
|
832
845
|
}
|
|
833
846
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import generate from '../../common/uid'
|
|
6
6
|
import fs from '../../common/fs'
|
|
7
|
-
import { isWin } from '../../common/constants'
|
|
7
|
+
import { isWin, typeMap } from '../../common/constants'
|
|
8
|
+
import resolve from '../../common/resolve'
|
|
8
9
|
|
|
9
10
|
export const getFileExt = fileName => {
|
|
10
11
|
const sep = '.'
|
|
@@ -79,3 +80,28 @@ export const getRemoteFileInfo = async (sftp, filePath) => {
|
|
|
79
80
|
isDirectory: stat.isDirectory
|
|
80
81
|
}
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
export async function checkFolderSize (props, f) {
|
|
85
|
+
const pth = resolve(f.path, f.name)
|
|
86
|
+
const func = f.type === typeMap.remote
|
|
87
|
+
? props.sftp
|
|
88
|
+
: window.fs
|
|
89
|
+
const {
|
|
90
|
+
size,
|
|
91
|
+
count
|
|
92
|
+
} = await func.getFolderSize(pth)
|
|
93
|
+
.catch(err => {
|
|
94
|
+
console.log('get folder size fail', err)
|
|
95
|
+
return { size: 0, count: 0 }
|
|
96
|
+
})
|
|
97
|
+
if (count === 0) {
|
|
98
|
+
return true
|
|
99
|
+
}
|
|
100
|
+
if (size >= 600) {
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
if (size / count >= 100) {
|
|
104
|
+
return false
|
|
105
|
+
}
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
import { useRef } from 'react'
|
|
7
7
|
import { useDelta, useConditionalEffect } from 'react-delta'
|
|
8
8
|
import { maxTransport, typeMap } from '../../common/constants'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getLocalFileInfo,
|
|
11
|
+
getRemoteFileInfo,
|
|
12
|
+
getFolderFromFilePath,
|
|
13
|
+
getFileExt,
|
|
14
|
+
checkFolderSize
|
|
15
|
+
} from './file-read'
|
|
10
16
|
import copy from 'json-deep-copy'
|
|
11
17
|
import { findIndex, find } from 'lodash-es'
|
|
12
18
|
import generate from '../../common/uid'
|
|
@@ -263,8 +269,10 @@ export default (props) => {
|
|
|
263
269
|
toFile = await checkExist(typeTo, toPath)
|
|
264
270
|
}
|
|
265
271
|
if (fromFile.isDirectory) {
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
const skip = await checkFolderSize(props, fromFile)
|
|
273
|
+
.then(d => d && typeFrom !== typeTo)
|
|
274
|
+
tr.zip = skip
|
|
275
|
+
tr.skipExpand = skip
|
|
268
276
|
}
|
|
269
277
|
if (fromPath === toPath && typeFrom === typeTo) {
|
|
270
278
|
return updateTransferAction({
|