Release 0.3.0 (#37)

* chore(cicd): add build and start script

* fix(client/web): fix fail to reupload same file, avoid default worker

* test(client/web): add case for worker list filtering
This commit is contained in:
Hexxa 2021-01-31 19:37:05 +08:00 committed by GitHub
parent ede6c239f0
commit c8a3f911e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 117 additions and 15 deletions

View file

@ -5,3 +5,7 @@ export function alertMsg(msg: string) {
console.log(msg);
}
}
export function comfirmMsg(msg: string): boolean {
return confirm(msg);
}

View file

@ -4,7 +4,7 @@ import { List, Map } from "immutable";
import FileSize from "filesize";
import { Layouter } from "./layouter";
import { alertMsg } from "../common/env";
import { alertMsg, comfirmMsg } from "../common/env";
import { updater } from "./browser.updater";
import { ICoreState } from "./core_state";
import {
@ -139,6 +139,11 @@ export class Browser extends React.Component<Props, State, {}> {
selectedItems: Map<string, boolean>(),
});
return;
} else {
const filesToDel = this.state.selectedItems.keySeq().join(", ");
if (!comfirmMsg(`do you want to delete ${filesToDel}?`)) {
return;
}
}
updater()

View file

@ -32,7 +32,6 @@ export function initWithWorker(worker: IWorker): ICoreState {
}
export function init(): ICoreState {
const scripts = Array.from(document.querySelectorAll("script"));
const worker = Worker == null ? new FgWorker() : new BgWorker();
initUploadMgr(worker);

View file

@ -62,6 +62,12 @@ describe("upload.worker", () => {
expectedUploaderStartInput: "file1",
currentFilePath: "file0",
},
{
infos: [makeEntry("file1", true)],
expectedUploadingFile: "file1",
expectedUploaderStartInput: "file1",
currentFilePath: "file1",
},
];
for (let i = 0; i < tcs.length; i++) {

View file

@ -57,10 +57,10 @@ export class UploadWorker {
infoArray[i].runnable &&
infoArray[i].uploaded < infoArray[i].size
) {
if (infoArray[i].filePath !== this.filePath) {
this.stopUploader();
this.startUploader(infoArray[i].file, infoArray[i].filePath);
}
// infoArray[i].filePath !== this.filePath, it may re-uploading a deleted file
// and it will stuck or the file will be renamed in the future
this.stopUploader();
this.startUploader(infoArray[i].file, infoArray[i].filePath);
break;
} else if (
!infoArray[i].runnable &&

View file

@ -144,7 +144,7 @@ export class UploadMgr {
};
}
export let uploadMgr = new UploadMgr(new FgWorker());
export let uploadMgr: UploadMgr = undefined;
export const initUploadMgr = (worker: IWorker): UploadMgr => {
uploadMgr = new UploadMgr(worker);
return uploadMgr;