@electerm/electerm-react 1.34.30
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/LICENSE +21 -0
- package/README.md +31 -0
- package/client/common/auto-complete-data-mapper.js +6 -0
- package/client/common/byte-format.js +14 -0
- package/client/common/class.js +52 -0
- package/client/common/clipboard.js +49 -0
- package/client/common/constants.js +308 -0
- package/client/common/create-lang-edit-link.js +7 -0
- package/client/common/create-title.js +29 -0
- package/client/common/db-fix.js +24 -0
- package/client/common/db.js +155 -0
- package/client/common/download-mirrors.js +10 -0
- package/client/common/download.js +16 -0
- package/client/common/error-handler.jsx +27 -0
- package/client/common/fetch-from-server.js +47 -0
- package/client/common/fetch.jsx +71 -0
- package/client/common/find-bookmark-group-id.js +15 -0
- package/client/common/find-parent.js +30 -0
- package/client/common/form-layout.js +27 -0
- package/client/common/fs.js +21 -0
- package/client/common/get-proxy.js +8 -0
- package/client/common/id-with-stamp.js +10 -0
- package/client/common/index-sorter.js +4 -0
- package/client/common/init-setting-item.js +32 -0
- package/client/common/is-absolute-path.js +3 -0
- package/client/common/is-ip.js +16 -0
- package/client/common/is-valid-path.js +7 -0
- package/client/common/key-control-pressed.js +13 -0
- package/client/common/key-pressed.js +13 -0
- package/client/common/key-shift-pressed.js +7 -0
- package/client/common/mode2permission.js +81 -0
- package/client/common/new-terminal.js +31 -0
- package/client/common/parse-int10.js +3 -0
- package/client/common/parse-json-safe.js +11 -0
- package/client/common/pass-enc.js +25 -0
- package/client/common/post-msg.js +3 -0
- package/client/common/pre.js +156 -0
- package/client/common/promise-timeout.js +27 -0
- package/client/common/resolve.js +31 -0
- package/client/common/run-idle.js +1 -0
- package/client/common/safe-local-storage.js +35 -0
- package/client/common/safe-name.js +19 -0
- package/client/common/sftp.js +74 -0
- package/client/common/terminal-theme.js +158 -0
- package/client/common/test-connection.js +12 -0
- package/client/common/time.js +30 -0
- package/client/common/to-simple-obj.js +5 -0
- package/client/common/track.js +7 -0
- package/client/common/transfer.js +76 -0
- package/client/common/trzsz.js +62 -0
- package/client/common/ui-theme.js +44 -0
- package/client/common/uid.js +5 -0
- package/client/common/update-check.js +79 -0
- package/client/common/upgrade.js +68 -0
- package/client/common/wait.js +8 -0
- package/client/common/ws.js +161 -0
- package/client/components/batch-op/batch-op.jsx +650 -0
- package/client/components/bookmark-form/bookmark-form.styl +8 -0
- package/client/components/bookmark-form/bookmark-group-tree-format.js +39 -0
- package/client/components/bookmark-form/encodes.js +44 -0
- package/client/components/bookmark-form/form-ssh-common.jsx +208 -0
- package/client/components/bookmark-form/form-tabs.jsx +69 -0
- package/client/components/bookmark-form/index.jsx +159 -0
- package/client/components/bookmark-form/local-form-ui.jsx +152 -0
- package/client/components/bookmark-form/local-form.jsx +16 -0
- package/client/components/bookmark-form/proxy.jsx +49 -0
- package/client/components/bookmark-form/quick-command-list.jsx +31 -0
- package/client/components/bookmark-form/quick-command.jsx +228 -0
- package/client/components/bookmark-form/render-auth-ssh.jsx +104 -0
- package/client/components/bookmark-form/render-connection-hopping.jsx +229 -0
- package/client/components/bookmark-form/render-delayed-scripts.jsx +88 -0
- package/client/components/bookmark-form/render-ssh-tunnel.jsx +116 -0
- package/client/components/bookmark-form/serial-form-ui.jsx +311 -0
- package/client/components/bookmark-form/serial-form.jsx +20 -0
- package/client/components/bookmark-form/sftp-enable.jsx +33 -0
- package/client/components/bookmark-form/ssh-form-ui.jsx +100 -0
- package/client/components/bookmark-form/ssh-form.jsx +348 -0
- package/client/components/bookmark-form/telnet-form-ui.jsx +154 -0
- package/client/components/bookmark-form/telnet-form.jsx +16 -0
- package/client/components/bookmark-form/tree-delete.jsx +87 -0
- package/client/components/bookmark-form/use-form-funcs.jsx +50 -0
- package/client/components/bookmark-form/use-quick-commands.jsx +83 -0
- package/client/components/bookmark-form/use-submit.jsx +77 -0
- package/client/components/bookmark-form/use-ui.jsx +82 -0
- package/client/components/bookmark-form/x11.jsx +23 -0
- package/client/components/common/animate-text.jsx +37 -0
- package/client/components/common/animate-text.styl +54 -0
- package/client/components/common/external-link.jsx +28 -0
- package/client/components/common/help-icon.jsx +25 -0
- package/client/components/common/highlight.jsx +23 -0
- package/client/components/common/highlight.styl +3 -0
- package/client/components/common/input-auto-focus.jsx +68 -0
- package/client/components/common/input-confirm.jsx +66 -0
- package/client/components/common/logo-elem.jsx +22 -0
- package/client/components/common/markdown.jsx +27 -0
- package/client/components/common/react-subx.jsx +1 -0
- package/client/components/common/resize-wrap.jsx +222 -0
- package/client/components/common/resize-wrap.styl +9 -0
- package/client/components/common/search.jsx +9 -0
- package/client/components/common/show-item.jsx +27 -0
- package/client/components/context-menu/boomarks.jsx +15 -0
- package/client/components/context-menu/context-menu.jsx +340 -0
- package/client/components/context-menu/context-menu.styl +90 -0
- package/client/components/context-menu/history.jsx +27 -0
- package/client/components/context-menu/icon-holder.jsx +5 -0
- package/client/components/context-menu/menu-btn.jsx +224 -0
- package/client/components/context-menu/sub-tab-menu.jsx +23 -0
- package/client/components/context-menu/tabs.jsx +22 -0
- package/client/components/context-menu/zoom.jsx +40 -0
- package/client/components/footer/batch-input.jsx +177 -0
- package/client/components/footer/footer-entry.jsx +141 -0
- package/client/components/footer/footer.styl +47 -0
- package/client/components/icons/match-case.jsx +10 -0
- package/client/components/icons/match-whole-word.jsx +13 -0
- package/client/components/icons/regular-exp.jsx +10 -0
- package/client/components/main/css-overwrite.jsx +92 -0
- package/client/components/main/error-wrapper.jsx +59 -0
- package/client/components/main/index.jsx +11 -0
- package/client/components/main/loading.jsx +25 -0
- package/client/components/main/main.jsx +149 -0
- package/client/components/main/term-fullscreen-control.jsx +21 -0
- package/client/components/main/term-fullscreen.styl +27 -0
- package/client/components/main/ui-theme.jsx +31 -0
- package/client/components/main/upgrade.jsx +351 -0
- package/client/components/main/upgrade.styl +27 -0
- package/client/components/main/wrapper.styl +41 -0
- package/client/components/quick-commands/qm.styl +29 -0
- package/client/components/quick-commands/quick-command-item.jsx +36 -0
- package/client/components/quick-commands/quick-command-transport-mod.jsx +54 -0
- package/client/components/quick-commands/quick-command-transport.jsx +12 -0
- package/client/components/quick-commands/quick-commands-box.jsx +233 -0
- package/client/components/quick-commands/quick-commands-form-elem.jsx +119 -0
- package/client/components/quick-commands/quick-commands-form.jsx +33 -0
- package/client/components/quick-commands/quick-commands-list.jsx +128 -0
- package/client/components/quick-commands/quick-commands-select.jsx +38 -0
- package/client/components/session/session.jsx +533 -0
- package/client/components/session/session.styl +53 -0
- package/client/components/session/sessions.jsx +445 -0
- package/client/components/setting-panel/bookmark-transport.jsx +148 -0
- package/client/components/setting-panel/bookmark-tree-list.jsx +14 -0
- package/client/components/setting-panel/col.jsx +18 -0
- package/client/components/setting-panel/list.jsx +186 -0
- package/client/components/setting-panel/list.styl +33 -0
- package/client/components/setting-panel/on-tree-drop.js +222 -0
- package/client/components/setting-panel/setting-modal.jsx +163 -0
- package/client/components/setting-panel/setting-wrap.jsx +37 -0
- package/client/components/setting-panel/setting-wrap.styl +52 -0
- package/client/components/setting-panel/setting.jsx +858 -0
- package/client/components/setting-panel/setting.styl +4 -0
- package/client/components/setting-panel/start-session-select.jsx +91 -0
- package/client/components/setting-panel/tab-bookmarks.jsx +37 -0
- package/client/components/setting-panel/tab-history.jsx +44 -0
- package/client/components/setting-panel/tab-quick-commands.jsx +38 -0
- package/client/components/setting-panel/tab-settings.jsx +42 -0
- package/client/components/setting-panel/tab-themes.jsx +34 -0
- package/client/components/setting-panel/tree-list.jsx +978 -0
- package/client/components/setting-panel/tree-list.styl +57 -0
- package/client/components/setting-sync/data-import.jsx +65 -0
- package/client/components/setting-sync/setting-sync-form.jsx +271 -0
- package/client/components/setting-sync/setting-sync.jsx +81 -0
- package/client/components/setting-sync/sync.styl +7 -0
- package/client/components/sftp/address-bar.jsx +139 -0
- package/client/components/sftp/address-bookmark-item.jsx +47 -0
- package/client/components/sftp/address-bookmark.jsx +81 -0
- package/client/components/sftp/address-bookmark.styl +8 -0
- package/client/components/sftp/confirm-modal.jsx +184 -0
- package/client/components/sftp/file-icon.jsx +22 -0
- package/client/components/sftp/file-item.jsx +1226 -0
- package/client/components/sftp/file-mode-modal.jsx +205 -0
- package/client/components/sftp/file-props-modal.jsx +211 -0
- package/client/components/sftp/file-read.js +81 -0
- package/client/components/sftp/list-table-ui.jsx +547 -0
- package/client/components/sftp/owner-list.js +97 -0
- package/client/components/sftp/paged-list.jsx +60 -0
- package/client/components/sftp/permission-render.jsx +42 -0
- package/client/components/sftp/sftp-entry.jsx +1069 -0
- package/client/components/sftp/sftp.styl +217 -0
- package/client/components/sftp/transfer-common.js +9 -0
- package/client/components/sftp/transfer-conflict.jsx +315 -0
- package/client/components/sftp/transfer-speed-format.js +60 -0
- package/client/components/sftp/transfer-tag.jsx +40 -0
- package/client/components/sftp/transfer-tag.styl +11 -0
- package/client/components/sftp/transfer.styl +55 -0
- package/client/components/sftp/transport-action.jsx +410 -0
- package/client/components/sftp/transport-entry.jsx +108 -0
- package/client/components/sftp/transport-types.js +8 -0
- package/client/components/sftp/transports-action.jsx +111 -0
- package/client/components/sftp/transports-ui.jsx +93 -0
- package/client/components/sftp/zip.js +42 -0
- package/client/components/sidebar/bookmark-select.jsx +48 -0
- package/client/components/sidebar/bookmark.jsx +82 -0
- package/client/components/sidebar/history.jsx +66 -0
- package/client/components/sidebar/index.jsx +230 -0
- package/client/components/sidebar/info-modal.jsx +250 -0
- package/client/components/sidebar/info.styl +27 -0
- package/client/components/sidebar/side-icon.jsx +25 -0
- package/client/components/sidebar/sidebar.styl +128 -0
- package/client/components/sidebar/transfer-history-modal.jsx +110 -0
- package/client/components/sidebar/transfer-history.styl +3 -0
- package/client/components/sidebar/transfer-list-control.jsx +205 -0
- package/client/components/sidebar/transfer-list.jsx +55 -0
- package/client/components/sidebar/transfer-modal.jsx +76 -0
- package/client/components/sidebar/transfer.styl +8 -0
- package/client/components/sidebar/transport-ui.jsx +109 -0
- package/client/components/tabs/index.jsx +320 -0
- package/client/components/tabs/tab.jsx +427 -0
- package/client/components/tabs/tabs.styl +220 -0
- package/client/components/tabs/window-control.jsx +55 -0
- package/client/components/terminal/attach-addon-custom.js +70 -0
- package/client/components/terminal/build-ls-term-id.js +5 -0
- package/client/components/terminal/index.jsx +1358 -0
- package/client/components/terminal/normal-buffer.jsx +33 -0
- package/client/components/terminal/term-search.jsx +224 -0
- package/client/components/terminal/term-search.styl +15 -0
- package/client/components/terminal/terminal-apis.js +31 -0
- package/client/components/terminal/terminal-interactive.jsx +148 -0
- package/client/components/terminal/terminal.styl +96 -0
- package/client/components/terminal/xterm-zmodem.js +48 -0
- package/client/components/terminal/zmodem-transfer.jsx +98 -0
- package/client/components/terminal/zmodem.styl +14 -0
- package/client/components/terminal-info/activity.jsx +54 -0
- package/client/components/terminal-info/base.jsx +25 -0
- package/client/components/terminal-info/content.jsx +101 -0
- package/client/components/terminal-info/data-cols-parser.jsx +50 -0
- package/client/components/terminal-info/disk.jsx +29 -0
- package/client/components/terminal-info/index.jsx +25 -0
- package/client/components/terminal-info/network.jsx +114 -0
- package/client/components/terminal-info/resource.jsx +80 -0
- package/client/components/terminal-info/run-cmd.jsx +273 -0
- package/client/components/terminal-info/terminal-info.styl +29 -0
- package/client/components/terminal-info/up.jsx +15 -0
- package/client/components/terminal-theme/index.jsx +264 -0
- package/client/components/terminal-theme/terminal-theme-list.styl +3 -0
- package/client/components/terminal-theme/theme-list.jsx +146 -0
- package/client/components/text-editor/text-editor-form.jsx +97 -0
- package/client/components/text-editor/text-editor.jsx +182 -0
- package/client/css/antd-overwrite.styl +14 -0
- package/client/css/basic.styl +38 -0
- package/client/css/includes/box.styl +154 -0
- package/client/css/includes/font-size.styl +6 -0
- package/client/css/includes/index.styl +3 -0
- package/client/css/includes/text.styl +31 -0
- package/client/css/includes/theme-default.styl +20 -0
- package/client/entry/basic.js +58 -0
- package/client/entry/index.jsx +15 -0
- package/client/entry/worker.js +137 -0
- package/client/store/address-bookmark.js +25 -0
- package/client/store/app-upgrade.js +23 -0
- package/client/store/batch-input-history.js +26 -0
- package/client/store/bookmark-group.js +128 -0
- package/client/store/bookmark.js +22 -0
- package/client/store/common.js +140 -0
- package/client/store/context-menu.js +23 -0
- package/client/store/db-upgrade.js +43 -0
- package/client/store/event.js +70 -0
- package/client/store/index.js +335 -0
- package/client/store/init-state.js +191 -0
- package/client/store/item.js +120 -0
- package/client/store/load-data.js +198 -0
- package/client/store/quick-command.js +43 -0
- package/client/store/session.js +54 -0
- package/client/store/setting.js +208 -0
- package/client/store/sidebar.js +48 -0
- package/client/store/sync.js +390 -0
- package/client/store/system-menu.js +120 -0
- package/client/store/tab.js +74 -0
- package/client/store/terminal-theme.js +116 -0
- package/client/store/transfer-history.js +27 -0
- package/client/store/transfer-list.js +20 -0
- package/client/store/ui-theme.js +71 -0
- package/client/store/watch.js +116 -0
- package/client/views/index.pug +58 -0
- package/package.json +34 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
@require '../../css/includes/theme-default'
|
|
2
|
+
// .sftp-wrap
|
|
3
|
+
// .ant-spin-container
|
|
4
|
+
// .ant-spin-nested-loading
|
|
5
|
+
// filter none
|
|
6
|
+
.sftp-section
|
|
7
|
+
position absolute
|
|
8
|
+
.sftp-title-wrap
|
|
9
|
+
position relative
|
|
10
|
+
.sftp-item
|
|
11
|
+
position relative
|
|
12
|
+
z-index 3
|
|
13
|
+
padding 0
|
|
14
|
+
line-height 26px
|
|
15
|
+
height 32px
|
|
16
|
+
user-select none
|
|
17
|
+
margin-bottom 4px
|
|
18
|
+
&:nth-child(even)
|
|
19
|
+
.sftp-file-prop
|
|
20
|
+
background main
|
|
21
|
+
&:hover
|
|
22
|
+
.sftp-file-prop
|
|
23
|
+
background-color primary
|
|
24
|
+
color contrastColor(primary)
|
|
25
|
+
&.selected
|
|
26
|
+
.sftp-file-prop
|
|
27
|
+
background-color darken(primary, 30%)
|
|
28
|
+
color contrastColor(primary)
|
|
29
|
+
.sftp-history
|
|
30
|
+
position absolute
|
|
31
|
+
left 0
|
|
32
|
+
top 100%
|
|
33
|
+
right 0
|
|
34
|
+
z-index 30
|
|
35
|
+
box-shadow none
|
|
36
|
+
border none
|
|
37
|
+
height 0
|
|
38
|
+
background main
|
|
39
|
+
overflow hidden
|
|
40
|
+
border-radius 3px
|
|
41
|
+
&.focused
|
|
42
|
+
height auto
|
|
43
|
+
border 1px solid main-dark
|
|
44
|
+
box-shadow 0px 0px 3px 3px alpha(main, .05)
|
|
45
|
+
|
|
46
|
+
.sftp-history-item
|
|
47
|
+
padding 5px 10px
|
|
48
|
+
cursor pointer
|
|
49
|
+
border-bottom 1px solid primary
|
|
50
|
+
&:hover
|
|
51
|
+
background main-dark
|
|
52
|
+
|
|
53
|
+
.sftp-item-title
|
|
54
|
+
width 100%
|
|
55
|
+
.sftp-item-title
|
|
56
|
+
width 75%
|
|
57
|
+
.sftp-item-size
|
|
58
|
+
width 24%
|
|
59
|
+
.sftp-status-success
|
|
60
|
+
color success
|
|
61
|
+
.sftp-status-exception
|
|
62
|
+
color error
|
|
63
|
+
.sftp-status-active
|
|
64
|
+
color primary
|
|
65
|
+
|
|
66
|
+
.virtual-file
|
|
67
|
+
.sftp-item
|
|
68
|
+
position absolute
|
|
69
|
+
left 0
|
|
70
|
+
right 0
|
|
71
|
+
bottom 0
|
|
72
|
+
top 0
|
|
73
|
+
z-index 1
|
|
74
|
+
height 100%
|
|
75
|
+
opacity 0
|
|
76
|
+
padding 0
|
|
77
|
+
margin 0
|
|
78
|
+
|
|
79
|
+
.file-icon
|
|
80
|
+
position absolute
|
|
81
|
+
left 10px
|
|
82
|
+
top 10px
|
|
83
|
+
font-size 50px
|
|
84
|
+
.file-props
|
|
85
|
+
margin-left 70px
|
|
86
|
+
|
|
87
|
+
.opacity-loop
|
|
88
|
+
opacity 0.3
|
|
89
|
+
animation blinker 5s linear infinite
|
|
90
|
+
|
|
91
|
+
@keyframes blinker
|
|
92
|
+
50%
|
|
93
|
+
opacity .8
|
|
94
|
+
|
|
95
|
+
.sftp-sort-btn
|
|
96
|
+
color text
|
|
97
|
+
&.active
|
|
98
|
+
font-weight bold
|
|
99
|
+
color text-light
|
|
100
|
+
|
|
101
|
+
//list table
|
|
102
|
+
.sftp-file-prop
|
|
103
|
+
height 32px
|
|
104
|
+
line-height 30px
|
|
105
|
+
position absolute
|
|
106
|
+
left 0
|
|
107
|
+
width 100px
|
|
108
|
+
padding 0 5px
|
|
109
|
+
background main
|
|
110
|
+
overflow hidden
|
|
111
|
+
white-space nowrap
|
|
112
|
+
text-overflow ellipsis
|
|
113
|
+
pointer-events none
|
|
114
|
+
cursor default
|
|
115
|
+
z-index 4
|
|
116
|
+
color text
|
|
117
|
+
&:last-child
|
|
118
|
+
right 0 !important
|
|
119
|
+
width auto !important
|
|
120
|
+
.file-bg
|
|
121
|
+
position absolute
|
|
122
|
+
left 0
|
|
123
|
+
top 0
|
|
124
|
+
right 0
|
|
125
|
+
height 32px
|
|
126
|
+
z-index 3
|
|
127
|
+
|
|
128
|
+
.sftp-header-item
|
|
129
|
+
height 28px
|
|
130
|
+
line-height 25px
|
|
131
|
+
position absolute
|
|
132
|
+
left 0
|
|
133
|
+
width 100px
|
|
134
|
+
border 1px solid main
|
|
135
|
+
border-right none
|
|
136
|
+
padding 0 5px
|
|
137
|
+
background main
|
|
138
|
+
overflow hidden
|
|
139
|
+
white-space nowrap
|
|
140
|
+
text-overflow ellipsis
|
|
141
|
+
color text
|
|
142
|
+
&:last-child
|
|
143
|
+
border-right 1px solid main
|
|
144
|
+
right 0 !important
|
|
145
|
+
width auto !important
|
|
146
|
+
&.desc
|
|
147
|
+
background linear-gradient(to bottom, main-dark 0%,main-light 100%)
|
|
148
|
+
&.asc
|
|
149
|
+
background linear-gradient(to bottom, main-light 0%,main-dark 100%)
|
|
150
|
+
.sftp-header-handle
|
|
151
|
+
z-index 20
|
|
152
|
+
cursor ew-resize
|
|
153
|
+
border none
|
|
154
|
+
background none
|
|
155
|
+
.sftp-file-table-header
|
|
156
|
+
height 30px
|
|
157
|
+
.sftp-table
|
|
158
|
+
z-index 2
|
|
159
|
+
&:hover
|
|
160
|
+
::-webkit-scrollbar
|
|
161
|
+
width 12px
|
|
162
|
+
// .sftp-table-content
|
|
163
|
+
// overflow-x hidden
|
|
164
|
+
// ::-webkit-scrollbar
|
|
165
|
+
// width 7px
|
|
166
|
+
// background alpha(main, .5)
|
|
167
|
+
|
|
168
|
+
// ::-webkit-scrollbar-track
|
|
169
|
+
// -webkit-box-shadow none
|
|
170
|
+
|
|
171
|
+
// ::-webkit-scrollbar-thumb
|
|
172
|
+
// background-color primary
|
|
173
|
+
// outline none
|
|
174
|
+
.sftp-item
|
|
175
|
+
&.sftp-dragover
|
|
176
|
+
.sftp-file-prop
|
|
177
|
+
background primary !important
|
|
178
|
+
color text-light !important
|
|
179
|
+
&.sftp-dragover-multi
|
|
180
|
+
&:after
|
|
181
|
+
&:before
|
|
182
|
+
position absolute
|
|
183
|
+
left 2px
|
|
184
|
+
top 2px
|
|
185
|
+
width 100%
|
|
186
|
+
height 100%
|
|
187
|
+
background main-light
|
|
188
|
+
content ''
|
|
189
|
+
z-index -1
|
|
190
|
+
&:after
|
|
191
|
+
left 4px
|
|
192
|
+
top 4px
|
|
193
|
+
.icon-holder
|
|
194
|
+
width 1em
|
|
195
|
+
display inline-block
|
|
196
|
+
.symbolic-link-icon
|
|
197
|
+
margin-right 2px
|
|
198
|
+
|
|
199
|
+
//sftp
|
|
200
|
+
.sftp-panel
|
|
201
|
+
background main
|
|
202
|
+
color text
|
|
203
|
+
|
|
204
|
+
.file-list
|
|
205
|
+
// &::-webkit-scrollbar
|
|
206
|
+
// width 1em
|
|
207
|
+
// background main
|
|
208
|
+
|
|
209
|
+
// &::-webkit-scrollbar-track
|
|
210
|
+
// -webkit-box-shadow inset 0 0 6px alpha(main, .1)
|
|
211
|
+
|
|
212
|
+
::-webkit-scrollbar-thumb
|
|
213
|
+
background-color primary !important
|
|
214
|
+
|
|
215
|
+
.pager-wrap
|
|
216
|
+
z-index 4
|
|
217
|
+
position relative
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pass transfer list from props
|
|
3
|
+
* when list changes, do transfer and other op
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useRef } from 'react'
|
|
7
|
+
import { useDelta, useConditionalEffect } from 'react-delta'
|
|
8
|
+
import { maxTransport, typeMap } from '../../common/constants'
|
|
9
|
+
import { getLocalFileInfo, getRemoteFileInfo, getFolderFromFilePath, getFileExt } from './file-read'
|
|
10
|
+
import copy from 'json-deep-copy'
|
|
11
|
+
import { findIndex, find } from 'lodash-es'
|
|
12
|
+
import generate from '../../common/uid'
|
|
13
|
+
import resolve from '../../common/resolve'
|
|
14
|
+
import eq from 'fast-deep-equal'
|
|
15
|
+
import { createTransferProps } from './transfer-common'
|
|
16
|
+
|
|
17
|
+
export default (props) => {
|
|
18
|
+
const { transferList } = props
|
|
19
|
+
const delta = useDelta(transferList)
|
|
20
|
+
const currentId = useRef('')
|
|
21
|
+
const timer = useRef(null)
|
|
22
|
+
const onConfirm = useRef(false)
|
|
23
|
+
const ref = {}
|
|
24
|
+
|
|
25
|
+
ref.localCheckExist = (path) => {
|
|
26
|
+
return getLocalFileInfo(path)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ref.remoteCheckExist = (path) => {
|
|
30
|
+
const { sftp } = props
|
|
31
|
+
return getRemoteFileInfo(sftp, path)
|
|
32
|
+
.then(r => r)
|
|
33
|
+
.catch(() => false)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const checkExist = (type, path) => {
|
|
37
|
+
return ref[type + 'CheckExist'](path)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function rename (tr, action, _renameId) {
|
|
41
|
+
const isRemote = tr.typeTo === typeMap.remote
|
|
42
|
+
const { path, name } = getFolderFromFilePath(tr.toPath, isRemote)
|
|
43
|
+
const { base, ext } = getFileExt(name)
|
|
44
|
+
const renameId = _renameId || generate()
|
|
45
|
+
const newName = ext
|
|
46
|
+
? `${base}(rename-${renameId}).${ext}`
|
|
47
|
+
: `${base}(rename-${renameId})`
|
|
48
|
+
const res = {
|
|
49
|
+
...tr,
|
|
50
|
+
renameId,
|
|
51
|
+
newName,
|
|
52
|
+
oldName: base,
|
|
53
|
+
toPath: resolve(path, newName)
|
|
54
|
+
}
|
|
55
|
+
if (action) {
|
|
56
|
+
res.action = action
|
|
57
|
+
}
|
|
58
|
+
return res
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function updateTransferAction (data) {
|
|
62
|
+
const {
|
|
63
|
+
id,
|
|
64
|
+
action,
|
|
65
|
+
transfer
|
|
66
|
+
} = data
|
|
67
|
+
const {
|
|
68
|
+
fromFile
|
|
69
|
+
} = transfer
|
|
70
|
+
clear()
|
|
71
|
+
props.modifier((old) => {
|
|
72
|
+
let transferList = copy(old.transferList)
|
|
73
|
+
const index = findIndex(transferList, d => d.id === id)
|
|
74
|
+
if (index < 0) {
|
|
75
|
+
return {
|
|
76
|
+
transferList
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
transferList[index].fromFile = fromFile
|
|
80
|
+
transferList[index].action = action
|
|
81
|
+
if (action === 'skip') {
|
|
82
|
+
transferList.splice(index, 1)
|
|
83
|
+
} else if (action === 'cancel') {
|
|
84
|
+
transferList = transferList.slice(0, index)
|
|
85
|
+
}
|
|
86
|
+
if (action.includes('All')) {
|
|
87
|
+
transferList = transferList.map((t, i) => {
|
|
88
|
+
if (i < index) {
|
|
89
|
+
return t
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...t,
|
|
93
|
+
action: action.replace('All', '')
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
if (action.includes('rename')) {
|
|
98
|
+
transferList[index] = rename(transferList[index])
|
|
99
|
+
} else if (action === 'skipAll') {
|
|
100
|
+
transferList.splice(index, 1)
|
|
101
|
+
}
|
|
102
|
+
window.store.setTransfers(transferList)
|
|
103
|
+
return {
|
|
104
|
+
transferList
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function tagTransferError (id, errorMsg) {
|
|
110
|
+
const tr = find(transferList, d => d.id === id)
|
|
111
|
+
window.store.addTransferHistory({
|
|
112
|
+
...tr,
|
|
113
|
+
host: props.host,
|
|
114
|
+
error: errorMsg,
|
|
115
|
+
finishTime: Date.now()
|
|
116
|
+
})
|
|
117
|
+
props.modifier(old => {
|
|
118
|
+
const transferList = copy(old.transferList)
|
|
119
|
+
const index = findIndex(transferList, d => d.id === id)
|
|
120
|
+
if (index >= 0) {
|
|
121
|
+
transferList.splice(index, 1)
|
|
122
|
+
}
|
|
123
|
+
window.store.setTransfers(transferList)
|
|
124
|
+
return {
|
|
125
|
+
transferList
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function setConflict (tr) {
|
|
131
|
+
if (props.transferToConfirm) {
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
props.modifier({
|
|
135
|
+
transferToConfirm: tr
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function onDecision (event) {
|
|
140
|
+
if (event && event.data && event.data.id === currentId.current) {
|
|
141
|
+
// const {
|
|
142
|
+
// transferGroupId,
|
|
143
|
+
// fileId,
|
|
144
|
+
// id,
|
|
145
|
+
// action
|
|
146
|
+
// } = event.data
|
|
147
|
+
currentId.current = ''
|
|
148
|
+
updateTransferAction(event.data)
|
|
149
|
+
onConfirm.current = false
|
|
150
|
+
window.removeEventListener('message', onDecision)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function waitForSignal () {
|
|
155
|
+
window.addEventListener('message', onDecision)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function setCanTransfer (fromFile, tr) {
|
|
159
|
+
clear()
|
|
160
|
+
props.modifier((old) => {
|
|
161
|
+
const transferList = copy(old.transferList)
|
|
162
|
+
const index = findIndex(transferList, t => {
|
|
163
|
+
return t.id === tr.id
|
|
164
|
+
})
|
|
165
|
+
if (index >= 0) {
|
|
166
|
+
const up = {
|
|
167
|
+
action: 'transfer',
|
|
168
|
+
fromFile
|
|
169
|
+
}
|
|
170
|
+
Object.assign(transferList[index], up)
|
|
171
|
+
}
|
|
172
|
+
window.store.setTransfers(transferList)
|
|
173
|
+
return {
|
|
174
|
+
transferList
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function expand (fromFile, tr) {
|
|
180
|
+
let list = []
|
|
181
|
+
if (!tr.skipExpand) {
|
|
182
|
+
const { type } = fromFile
|
|
183
|
+
list = await props[type + 'List'](
|
|
184
|
+
true, tr.fromPath
|
|
185
|
+
)
|
|
186
|
+
list = list.map(t => {
|
|
187
|
+
return {
|
|
188
|
+
typeFrom: tr.typeFrom,
|
|
189
|
+
typeTo: tr.typeTo,
|
|
190
|
+
fromPath: resolve(t.path, t.name),
|
|
191
|
+
toPath: resolve(tr.toPath, t.name),
|
|
192
|
+
id: generate(),
|
|
193
|
+
...createTransferProps(props),
|
|
194
|
+
parentId: tr.id
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
clear()
|
|
199
|
+
props.modifier((old) => {
|
|
200
|
+
const transferList = copy(old.transferList)
|
|
201
|
+
const index = findIndex(transferList, t => {
|
|
202
|
+
return t.id === tr.id
|
|
203
|
+
})
|
|
204
|
+
transferList.splice(index + 1, 0, ...list)
|
|
205
|
+
if (transferList[index]) {
|
|
206
|
+
transferList[index].expanded = true
|
|
207
|
+
}
|
|
208
|
+
window.store.setTransfers(transferList)
|
|
209
|
+
return {
|
|
210
|
+
transferList
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function clear () {
|
|
216
|
+
currentId.current = ''
|
|
217
|
+
}
|
|
218
|
+
async function watchFile () {
|
|
219
|
+
if (!transferList.length && currentId.current) {
|
|
220
|
+
return clear()
|
|
221
|
+
}
|
|
222
|
+
const tr = transferList
|
|
223
|
+
.filter(t => {
|
|
224
|
+
return (
|
|
225
|
+
!t.action ||
|
|
226
|
+
!t.fromFile ||
|
|
227
|
+
(t.fromFile.isDirectory && !t.expanded)
|
|
228
|
+
)
|
|
229
|
+
})[0]
|
|
230
|
+
if (!tr) {
|
|
231
|
+
onConfirm.current = false
|
|
232
|
+
return clear()
|
|
233
|
+
}
|
|
234
|
+
if (currentId.current) {
|
|
235
|
+
return null
|
|
236
|
+
}
|
|
237
|
+
currentId.current = tr.id
|
|
238
|
+
const {
|
|
239
|
+
typeFrom,
|
|
240
|
+
typeTo,
|
|
241
|
+
fromPath,
|
|
242
|
+
toPath,
|
|
243
|
+
id,
|
|
244
|
+
action,
|
|
245
|
+
expanded,
|
|
246
|
+
renameId,
|
|
247
|
+
parentId,
|
|
248
|
+
skipConfirm
|
|
249
|
+
} = tr
|
|
250
|
+
const fromFile = tr.fromFile
|
|
251
|
+
? tr.fromFile
|
|
252
|
+
: await checkExist(typeFrom, fromPath)
|
|
253
|
+
if (!fromFile) {
|
|
254
|
+
currentId.current = ''
|
|
255
|
+
return tagTransferError(id, 'file not exist')
|
|
256
|
+
}
|
|
257
|
+
let toFile = false
|
|
258
|
+
if (renameId || parentId) {
|
|
259
|
+
toFile = false
|
|
260
|
+
} else if (fromPath === toPath && typeFrom === typeTo) {
|
|
261
|
+
toFile = true
|
|
262
|
+
} else {
|
|
263
|
+
toFile = await checkExist(typeTo, toPath)
|
|
264
|
+
}
|
|
265
|
+
if (fromFile.isDirectory) {
|
|
266
|
+
tr.zip = true
|
|
267
|
+
tr.skipExpand = true
|
|
268
|
+
}
|
|
269
|
+
if (fromPath === toPath && typeFrom === typeTo) {
|
|
270
|
+
return updateTransferAction({
|
|
271
|
+
id,
|
|
272
|
+
action: 'rename',
|
|
273
|
+
transfer: {
|
|
274
|
+
...tr,
|
|
275
|
+
operation: 'cp',
|
|
276
|
+
fromFile
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
} else if (toFile && !action && !skipConfirm) {
|
|
280
|
+
waitForSignal(id)
|
|
281
|
+
if (!onConfirm.current) {
|
|
282
|
+
onConfirm.current = true
|
|
283
|
+
return setConflict({
|
|
284
|
+
...tr,
|
|
285
|
+
fromFile,
|
|
286
|
+
toFile
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
} else if (toFile && !tr.fromFile && action) {
|
|
290
|
+
return updateTransferAction({
|
|
291
|
+
id,
|
|
292
|
+
action,
|
|
293
|
+
transfer: {
|
|
294
|
+
...tr,
|
|
295
|
+
fromFile
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
} else if (
|
|
299
|
+
fromFile.isDirectory &&
|
|
300
|
+
!expanded &&
|
|
301
|
+
typeFrom !== typeTo &&
|
|
302
|
+
transferList.filter(t => t.fromFile).length < maxTransport
|
|
303
|
+
) {
|
|
304
|
+
return expand(fromFile, tr)
|
|
305
|
+
}
|
|
306
|
+
setCanTransfer(fromFile, tr)
|
|
307
|
+
}
|
|
308
|
+
useConditionalEffect(() => {
|
|
309
|
+
watchFile()
|
|
310
|
+
return () => {
|
|
311
|
+
clearTimeout(timer.current)
|
|
312
|
+
}
|
|
313
|
+
}, delta && delta.prev && !eq(delta.prev, delta.curr))
|
|
314
|
+
return null
|
|
315
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* format transfer speed
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const m1 = 1000 * 1000
|
|
6
|
+
const k1 = 1000
|
|
7
|
+
const sec = 1000
|
|
8
|
+
const minute = sec * 60
|
|
9
|
+
const hour = minute * 60
|
|
10
|
+
const day = hour * 24
|
|
11
|
+
const month = day * 30
|
|
12
|
+
|
|
13
|
+
export default (bytes, startTime) => {
|
|
14
|
+
let now = Date.now()
|
|
15
|
+
if (now <= startTime) {
|
|
16
|
+
now = startTime + 1
|
|
17
|
+
}
|
|
18
|
+
const speed = bytes / ((now - startTime) / 1000)
|
|
19
|
+
if (speed > m1) {
|
|
20
|
+
return (speed / m1).toFixed(1) + 'MB/s'
|
|
21
|
+
} else {
|
|
22
|
+
return (speed / k1).toFixed(1) + 'KB/s'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function formatTime (ms) {
|
|
27
|
+
const d = Math.floor(ms / day)
|
|
28
|
+
const h = Math.floor((ms - d * day) / hour)
|
|
29
|
+
const m = Math.floor((ms - d * day - h * hour) / minute)
|
|
30
|
+
const s = Math.floor((ms - d * day - h * hour - m * minute) / sec)
|
|
31
|
+
if (ms > month) {
|
|
32
|
+
return '>30d'
|
|
33
|
+
} else if (ms > day) {
|
|
34
|
+
return `${d}d ${h}:${m}:${s}`
|
|
35
|
+
} else if (ms > hour) {
|
|
36
|
+
return `${h}:${m}:${s}`
|
|
37
|
+
} else if (ms > minute) {
|
|
38
|
+
return `${m}:${s}`
|
|
39
|
+
} else {
|
|
40
|
+
return Math.floor(ms / 1000) + 's'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const computePassedTime = (startTime) => {
|
|
45
|
+
const allTimeNeed = (Date.now()) - startTime
|
|
46
|
+
return formatTime(allTimeNeed)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const computeLeftTime = (bytes, total, startTime) => {
|
|
50
|
+
let now = Date.now()
|
|
51
|
+
if (now <= startTime) {
|
|
52
|
+
now = startTime + 1
|
|
53
|
+
}
|
|
54
|
+
const speed = bytes / (now - startTime)
|
|
55
|
+
const allTimeNeed = (total - bytes) / speed
|
|
56
|
+
return {
|
|
57
|
+
leftTime: formatTime(allTimeNeed),
|
|
58
|
+
leftTimeInt: allTimeNeed
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transfer tag
|
|
3
|
+
* @param {object} props
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import './transfer-tag.styl'
|
|
7
|
+
const { prefix } = window
|
|
8
|
+
const e = prefix('sftp')
|
|
9
|
+
|
|
10
|
+
export default function TransferTag (props) {
|
|
11
|
+
const {
|
|
12
|
+
typeTo,
|
|
13
|
+
typeFrom,
|
|
14
|
+
error,
|
|
15
|
+
inited
|
|
16
|
+
} = props.transfer
|
|
17
|
+
let tagStatus = inited ? 'started' : 'init'
|
|
18
|
+
if (error) {
|
|
19
|
+
tagStatus = 'error'
|
|
20
|
+
}
|
|
21
|
+
const typeFromTitle = e(typeFrom)
|
|
22
|
+
const typeToTitle = e(typeTo)
|
|
23
|
+
const title = error
|
|
24
|
+
? `error: ${error}`
|
|
25
|
+
: ''
|
|
26
|
+
return (
|
|
27
|
+
<span className={'flex-child transfer-tag transfer-status-' + tagStatus} title={title}>
|
|
28
|
+
<span className='sftp-transfer-type'>
|
|
29
|
+
{typeFromTitle}
|
|
30
|
+
</span>
|
|
31
|
+
<span className='sftp-transfer-arrow'>
|
|
32
|
+
→
|
|
33
|
+
</span>
|
|
34
|
+
<span className='sftp-transfer-type'>
|
|
35
|
+
{typeToTitle}
|
|
36
|
+
</span>
|
|
37
|
+
<span className='mg1l'>[{title}]</span>
|
|
38
|
+
</span>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@require '../../css/includes/theme-default'
|
|
2
|
+
.transports-wrap
|
|
3
|
+
position absolute
|
|
4
|
+
left 60px
|
|
5
|
+
top 3px
|
|
6
|
+
right 60px
|
|
7
|
+
height 36px
|
|
8
|
+
color text
|
|
9
|
+
.transports-circle-wrap
|
|
10
|
+
text-align center
|
|
11
|
+
position relative
|
|
12
|
+
z-index 10
|
|
13
|
+
.transports-dd
|
|
14
|
+
position absolute
|
|
15
|
+
left 0
|
|
16
|
+
right 0
|
|
17
|
+
overflow-y scroll
|
|
18
|
+
z-index 11
|
|
19
|
+
background main
|
|
20
|
+
box-shadow 0px 0px 3px 3px alpha(main, .5)
|
|
21
|
+
.transports-wrap
|
|
22
|
+
.transports-dd
|
|
23
|
+
display none
|
|
24
|
+
&:hover .transports-dd
|
|
25
|
+
display block
|
|
26
|
+
|
|
27
|
+
.transports-title
|
|
28
|
+
border-bottom 1px solid primary
|
|
29
|
+
padding 10px 15px
|
|
30
|
+
.transports-content
|
|
31
|
+
max-height 200px
|
|
32
|
+
padding 10px 0
|
|
33
|
+
.sftp-transport
|
|
34
|
+
display flex
|
|
35
|
+
padding 8px 5px
|
|
36
|
+
&:hover
|
|
37
|
+
background main-dark
|
|
38
|
+
.sftp-transport .transfer-control-icon:hover
|
|
39
|
+
color primary
|
|
40
|
+
.transports-count
|
|
41
|
+
color text
|
|
42
|
+
// .sftp-file
|
|
43
|
+
// flex-grow 1
|
|
44
|
+
// .sftp-file-percent
|
|
45
|
+
// width 100px
|
|
46
|
+
// .transfer-tag
|
|
47
|
+
// width 200px
|
|
48
|
+
// .transfer-control-icon
|
|
49
|
+
// width 20px
|
|
50
|
+
.flex-child + .flex-child
|
|
51
|
+
margin-left 5px
|
|
52
|
+
flex-grow 1
|
|
53
|
+
.transfer-control-icon
|
|
54
|
+
margin-right 3px
|
|
55
|
+
margin-top 3px
|