Skip to content

Commit

Permalink
add button for creating a list from run form field
Browse files Browse the repository at this point in the history
This is an initial/draft implementation. Some of the next steps are:
- By default, instead of the modals treating the items as selections from the current history, automatically filter items valid for the list (e.g.: for a list with csv elements, filter out csvs from the history in this list).
- In case nothing can be auto paried for `list:paired`, do not attempt to auto pair by default and simply show all items.
- In case the current history is empty and to make it clearer in general, allow history to be switched from within the modal?
- Allow files to be uploaded (and dropped) directly to either the form field or within the list builder once it is opened.

One thing I have not planned for yet is the rule builder. I can see that for `list` and `list:paired`, we get that from the `props.collectionTypes` in `FormData`. But when would we use the rule builder instead?

Fixes galaxyproject#18704
  • Loading branch information
ahmedhamidawan committed Sep 19, 2024
1 parent 1a29913 commit 526476e
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import { computed, onMounted, type Ref, ref, watch } from "vue";
import { isDatasetElement, isDCE } from "@/api";
import { getGalaxyInstance } from "@/app";
import { buildCollectionModal } from "@/components/History/adapters/buildCollectionModal";
import { useDatatypesMapper } from "@/composables/datatypesMapper";
import { useUid } from "@/composables/utils/uid";
import { type EventData, useEventStore } from "@/stores/eventStore";
import { useHistoryItemsStore } from "@/stores/historyItemsStore";
import { useHistoryStore } from "@/stores/historyStore";
import { orList } from "@/utils/strings";
import type { DataOption } from "./types";
Expand Down Expand Up @@ -471,6 +474,21 @@ function canAcceptSrc(historyContentType: "dataset" | "dataset_collection", coll
}
}
const historyStore = useHistoryStore();
const historyItemsStore = useHistoryItemsStore();
// Build a new collection
async function buildNewCollection(collectionType: string) {
if (!historyStore.currentHistoryId) {
return;
}
const modalResult = await buildCollectionModal(

Check failure on line 484 in client/src/components/Form/Elements/FormData/FormData.vue

View workflow job for this annotation

GitHub Actions / client-unit-test (18)

'modalResult' is assigned a value but never used. Allowed unused vars must match /_.+/u
collectionType,
historyItemsStore.getHistoryItems(historyStore.currentHistoryId, ""),
historyStore.currentHistoryId
);
// TODO: Implement handling `modalResult` as input for the field
}
// Drag/Drop event handlers
function onDragEnter(evt: MouseEvent) {
const eventData = eventStore.getDragData();
Expand Down Expand Up @@ -632,7 +650,20 @@ const noOptionsWarningMessage = computed(() => {
:placeholder="`Select a ${placeholder}`">
<template v-slot:no-options>
<BAlert variant="warning" show>
{{ noOptionsWarningMessage }}
<div>{{ noOptionsWarningMessage }}</div>
<div v-if="props.collectionTypes?.length > 0">
Click here to create/add:
<BButtonGroup size="sm" buttons>
<BButton
v-for="collectionType in props.collectionTypes"
:key="collectionType"
variant="primary"
@click="buildNewCollection(collectionType)">
{{ collectionType }}
</BButton>
</BButtonGroup>
{{ props.type === "data" ? "datasets" : "dataset collections" }}
</div>
</BAlert>
</template>
</FormSelect>
Expand Down

0 comments on commit 526476e

Please sign in to comment.