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:
parent
ede6c239f0
commit
c8a3f911e8
16 changed files with 117 additions and 15 deletions
|
@ -5,3 +5,7 @@ export function alertMsg(msg: string) {
|
|||
console.log(msg);
|
||||
}
|
||||
}
|
||||
|
||||
export function comfirmMsg(msg: string): boolean {
|
||||
return confirm(msg);
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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 &&
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue