mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 15:45:04 +08:00
Show the error when selecting a folder fails in FilesDialog
Selecting a folder lists it recursively. When the server refuses that listing, the dialog stayed on Loading, kept the folder selected and showed no error.
This commit is contained in:
@@ -261,6 +261,22 @@ describe("FilesDialog, file mode", () => {
|
||||
await utils.navigateBack();
|
||||
expect(utils.getRenderedRows().length).toBe(rootResponse.length);
|
||||
});
|
||||
|
||||
it("should show the error and undo the selection when a recursive listing fails", async () => {
|
||||
await utils.openRootDirectory();
|
||||
server.use(
|
||||
http.get("/api/remote_files", ({ response }) => {
|
||||
return response("4XX").json({ err_msg: someErrorText, err_code: 400 }, { status: 400 });
|
||||
}),
|
||||
);
|
||||
|
||||
suppressDebugConsole(); // expecting error message.
|
||||
|
||||
await utils.clickOn(utils.findRenderedDirectory(directoryId));
|
||||
utils.expectErrorMessage();
|
||||
expect(utils.getSelectionDialog().props("isBusy")).toBe(false);
|
||||
utils.expectOkButtonDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("FilesDialog, create new file source button", () => {
|
||||
|
||||
@@ -182,21 +182,29 @@ function selectDirectoryRecursive(record: SelectionItem) {
|
||||
// look for subdirectories
|
||||
const recursive = true;
|
||||
isBusy.value = true;
|
||||
browseRemoteFiles(record.url, recursive).then((incoming) => {
|
||||
incoming.entries.forEach((item) => {
|
||||
// construct record
|
||||
const subRecord = entryToRecord(item);
|
||||
if (subRecord.isLeaf) {
|
||||
// select file under this path
|
||||
selectSingleRecord(subRecord, true);
|
||||
} else {
|
||||
// select subdirectory
|
||||
selectedDirectories.value.push(subRecord);
|
||||
}
|
||||
browseRemoteFiles(record.url, recursive)
|
||||
.then((incoming) => {
|
||||
incoming.entries.forEach((item) => {
|
||||
// construct record
|
||||
const subRecord = entryToRecord(item);
|
||||
if (subRecord.isLeaf) {
|
||||
// select file under this path
|
||||
selectSingleRecord(subRecord, true);
|
||||
} else {
|
||||
// select subdirectory
|
||||
selectedDirectories.value.push(subRecord);
|
||||
}
|
||||
});
|
||||
totalItems.value = incoming.totalMatches;
|
||||
isBusy.value = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
// undo the directory selection made above
|
||||
unselectPath(record.url, false, record.id);
|
||||
formatRows();
|
||||
errorMessage.value = errorMessageAsString(error);
|
||||
isBusy.value = false;
|
||||
});
|
||||
totalItems.value = incoming.totalMatches;
|
||||
isBusy.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user