Skip to content

Commit afafdc4

Browse files
disallow dragging collections to dataset-only inputs
This refers to `FormData` elements without the collection variant (only single or multiple dataset variants). Explained in galaxyproject#19866 (comment)
1 parent e743e9b commit afafdc4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

client/src/components/Form/Elements/FormData/FormData.vue

+13-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,13 @@ const keepOptionsUpdate = ref(0);
110110
*/
111111
const canBrowse = computed(() => variant.value && !!variant.value.find((v) => v.src === SOURCE.DATASET));
112112
113+
/**
114+
* A list of valid `src`s for the variant
115+
*/
116+
const validSrcs = computed(() => {
117+
return variant.value ? variant.value.map((v) => v.src) : [];
118+
});
119+
113120
/**
114121
* Provides the currently shown source type
115122
*/
@@ -572,7 +579,12 @@ function canAcceptSrc(historyContentType: "dataset" | "dataset_collection", coll
572579
}
573580
} else if (historyContentType === "dataset_collection") {
574581
if (props.type === "data") {
575-
// collection can always be mapped over a data input ... in theory.
582+
// if this input doesn't accept collections at all, return false
583+
if (!validSrcs.value.includes(SOURCE.COLLECTION)) {
584+
$emit("alert", "dataset collection is not a valid input for this dataset parameter.");
585+
return false;
586+
}
587+
// otherwise, collection can always be mapped over a data input ... in theory.
576588
// One day we should also validate the map over model
577589
return true;
578590
}

0 commit comments

Comments
 (0)