@leogps/file-uploader 2.0.0 → 2.0.2
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/.github/workflows/publish.yml +31 -0
- package/Dockerfile +18 -0
- package/README.md +45 -93
- package/dist/client/index.html +1 -1
- package/dist/client/{main.66a16cbe5e2ce036e9a7.bundle.js → main.cb411c3ff6063891b944.bundle.js} +67 -12
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +23 -0
- package/package.json +13 -3
- package/src/globals.ts +22 -3
- package/src/index.ts +60 -14
- package/src/model/progress.ts +1 -0
- package/src/model/progress_utils.ts +32 -11
- package/src/routes/upload.ts +116 -0
- package/src/routes/uploadComplete.ts +3 -3
- package/src/routes/uploadInit.ts +9 -4
- package/src/service/progress_writer.ts +39 -12
- package/src-client/entrypoint.ts +40 -4
- package/src-client/progress-handler.ts +7 -1
- package/src-client/public/index.html +10 -1
|
@@ -161,12 +161,13 @@ export class ProgressHandler {
|
|
|
161
161
|
<i class="fas fa-minus-circle m-0 p-0" aria-hidden="true" title="collapse"></i>
|
|
162
162
|
</span>
|
|
163
163
|
</a>
|
|
164
|
-
<span class="ml-0 pl-0">
|
|
164
|
+
<span class="upload-file-name ml-0 pl-0">
|
|
165
165
|
${progress.fileName}
|
|
166
166
|
</span>
|
|
167
167
|
</div>`);
|
|
168
168
|
$panel.append($panelHeading);
|
|
169
169
|
}
|
|
170
|
+
$panelHeading.find(".upload-file-name").text(progress.fileName || "");
|
|
170
171
|
|
|
171
172
|
// Main progress bar (bytes)
|
|
172
173
|
let $progressElem = $panel.find(`progress#${progressId}`);
|
|
@@ -197,6 +198,10 @@ export class ProgressHandler {
|
|
|
197
198
|
// Clear previous rows
|
|
198
199
|
$table.empty();
|
|
199
200
|
|
|
201
|
+
let progressPercent = 0;
|
|
202
|
+
if (progress.bytesReceived !== undefined && progress.bytesExpected !== undefined) {
|
|
203
|
+
progressPercent = (progress.bytesReceived / progress.bytesExpected) * 100;
|
|
204
|
+
}
|
|
200
205
|
// Define table rows
|
|
201
206
|
const rows: [string, string][] = [
|
|
202
207
|
// ["File Name", progress.fileName || "-"],
|
|
@@ -208,6 +213,7 @@ export class ProgressHandler {
|
|
|
208
213
|
<b>|</b> Uploaded: ${uploaded}/${totalChunks}`],
|
|
209
214
|
["Speed", `${prettyBytes(ProgressUtils.calculateTransferRate(progress))}/s`],
|
|
210
215
|
["Status", `${progress.lastState || "-"}`],
|
|
216
|
+
["Progress", `${progressPercent}%`],
|
|
211
217
|
];
|
|
212
218
|
|
|
213
219
|
if (progress.completed) {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<form id="uploadForm" action="/upload" enctype="multipart/form-data" method="post">
|
|
34
34
|
<div id="file-div" class="field file has-name is-boxed column is-flex-grow-1">
|
|
35
35
|
<label class="file-label">
|
|
36
|
-
<input class="file-input" type="file" name="
|
|
36
|
+
<input class="file-input" type="file" name="file" multiple="multiple">
|
|
37
37
|
<span class="file-cta">
|
|
38
38
|
<span class="file-icon">
|
|
39
39
|
<i class="fas fa-upload"></i>
|
|
@@ -46,6 +46,15 @@
|
|
|
46
46
|
<div id="file-name" class="mt-1 wrap-text is-multiline"></div>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
+
<div class="field">
|
|
50
|
+
<label class="checkbox">
|
|
51
|
+
<input id="disableChunkedUpload" type="checkbox">
|
|
52
|
+
<span>
|
|
53
|
+
Disable chunked/resumable upload
|
|
54
|
+
</span>
|
|
55
|
+
</label>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
49
58
|
<div class="control field is-flex-grow-1">
|
|
50
59
|
<button type="submit" class="button is-link">Submit</button>
|
|
51
60
|
</div>
|