Skip to content

UI Bug - don't allow checking deferred for local files. #20609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion client/src/components/Upload/DefaultBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,19 @@ function addFileFromInput(eventTarget: EventTarget | null) {
/** A new file has been announced to the upload queue */
function eventAnnounce(index: string, file: UploadFile) {
counterAnnounce.value++;
const mode = file.mode || "local";
let deferred: boolean | undefined = false;
if (mode === "local") {
deferred = undefined;
}
const uploadModel = {
...defaultModel,
id: index,
dbKey: dbKey.value,
extension: extension.value,
fileData: file,
fileMode: file.mode || "local",
fileMode: mode,
deferred: deferred,
fileName: file.name,
filePath: file.path,
fileSize: file.size,
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/DefaultRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface Props {
}

const props = withDefaults(defineProps<Props>(), {
deferred: false,
deferred: undefined,
info: "",
listDbKeys: undefined,
listExtensions: undefined,
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Upload/UploadSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ library.add(faCog);
defineProps({
deferred: {
type: Boolean,
default: null,
default: undefined,
},
disabled: {
type: Boolean,
Expand Down Expand Up @@ -49,7 +49,7 @@ const emit = defineEmits(["input"]);
:value="toPosixLines"
@click="emit('input', 'toPosixLines')" />
<UploadOption
v-if="deferred !== null"
v-if="deferred !== undefined"
class="upload-deferred"
title="Defer dataset resolution"
:value="deferred"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Upload/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface FileStream {

export interface UploadItem {
dbKey: string;
deferred: boolean;
deferred?: boolean;
enabled: boolean;
extension: string;
fileContent: string;
Expand Down
8 changes: 7 additions & 1 deletion client/src/utils/upload-payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export function uploadPayload(items, historyId, composite = false) {
name: fileName,
space_to_tab: item.spaceToTab,
to_posix_lines: item.toPosixLines,
deferred: item.deferred,
};
// match file mode
switch (item.fileMode) {
Expand All @@ -59,13 +58,19 @@ export function uploadPayload(items, historyId, composite = false) {
return {
src: "url",
url: urlTrim,
deferred: item.deferred,
...elem,
};
} else {
throw new Error(`Invalid url: ${urlTrim}`);
}
});
} else {
// The researcher may have checked the deferred option and we don't know
// that until here and we cannot make pasted content deferred. Idealy we would
// have some sort of warning here but I don't want to import Toaster in this
// utility function. This stems from the same comment above from Sam about this being
// uncomfortable magic. -John
return {
src: "pasted",
paste_content: item.fileContent,
Expand All @@ -77,6 +82,7 @@ export function uploadPayload(items, historyId, composite = false) {
return {
src: "url",
url: urlContent,
deferred: item.deferred,
...elem,
};
} else {
Expand Down
10 changes: 0 additions & 10 deletions client/src/utils/upload-payload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe("uploadPayload", () => {
{ fileContent: " fileContent ", fileMode: "new", fileName: "1" },
{
dbKey: "dbKey2",
deferred: true,
extension: "extension2",
fileData: { size: 1 },
fileMode: "local",
Expand Down Expand Up @@ -62,7 +61,6 @@ describe("uploadPayload", () => {
},
{
dbKey: "dbKey5",
deferred: true,
extension: "extension5",
fileData: { size: 1 },
fileMode: "local",
Expand All @@ -83,7 +81,6 @@ describe("uploadPayload", () => {
elements: [
{
dbkey: "?",
deferred: undefined,
ext: "auto",
name: "1",
paste_content: " fileContent ",
Expand All @@ -93,7 +90,6 @@ describe("uploadPayload", () => {
},
{
dbkey: "dbKey2",
deferred: true,
ext: "extension2",
name: "2",
space_to_tab: true,
Expand Down Expand Up @@ -132,7 +128,6 @@ describe("uploadPayload", () => {
},
{
dbkey: "dbKey5",
deferred: true,
ext: "extension5",
name: "PreviousGalaxyFile",
space_to_tab: true,
Expand All @@ -151,7 +146,6 @@ describe("uploadPayload", () => {
{ fileContent: "fileContent", fileMode: "new", fileName: "1" },
{
dbKey: "dbKey",
deferred: true,
extension: "extension",
fileContent: "fileContent",
fileData: "fileData",
Expand All @@ -162,7 +156,6 @@ describe("uploadPayload", () => {
},
{
dbKey: "dbKey2",
deferred: true,
extension: "extension2",
fileContent: "fileContent",
fileData: "fileData",
Expand All @@ -188,7 +181,6 @@ describe("uploadPayload", () => {
items: [
{
dbkey: "?",
deferred: undefined,
ext: "auto",
name: "1",
paste_content: "fileContent",
Expand All @@ -198,7 +190,6 @@ describe("uploadPayload", () => {
},
{
dbkey: "dbKey",
deferred: true,
ext: "extension",
name: "2",
space_to_tab: true,
Expand All @@ -207,7 +198,6 @@ describe("uploadPayload", () => {
},
{
dbkey: "dbKey2",
deferred: true,
ext: "extension2",
name: "PreviousGalaxyFile",
space_to_tab: true,
Expand Down
Loading