Skip to content

Commit

Permalink
Merge pull request #19244 from jmchilton/collection_builder_language
Browse files Browse the repository at this point in the history
[24.2] Fix some collection builder help and language choices.
  • Loading branch information
ahmedhamidawan authored Dec 6, 2024
2 parents c554490 + 83c19e0 commit 73ce5b8
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 26 deletions.
21 changes: 12 additions & 9 deletions client/src/components/Collections/CollectionCreatorModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,25 @@ watch(
}
);
const extensionInTitle = computed<string>(() => {
const extensions = props.extensions;
if (!extensions || extensions.length == 0 || extensions.indexOf("data") >= 0) {
return "";
} else {
return orList(extensions);
}
});
const modalTitle = computed(() => {
if (props.collectionType === "list") {
return localize(
`Create a collection from a list of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} datasets`
);
return localize(`Create a list of ${fromSelection.value ? "selected" : ""} ${extensionInTitle.value} datasets`);
} else if (props.collectionType === "list:paired") {
return localize(
`Create a collection of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} dataset pairs`
`Create a list of ${fromSelection.value ? "selected" : ""} ${extensionInTitle.value} paired datasets`
);
} else if (props.collectionType === "paired") {
return localize(
`Create a ${props.extensions?.length ? orList(props.extensions) : ""} dataset pair collection ${
`Create a ${extensionInTitle.value} paired dataset collection ${
fromSelection.value ? "from selected items" : ""
}`
);
Expand Down
31 changes: 22 additions & 9 deletions client/src/components/Collections/ListCollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -412,28 +412,38 @@ function renameElement(element: any, name: string) {
:history-id="props.historyId"
:hide-source-items="hideSourceItems"
:extensions="extensions"
collection-type="list"
:no-items="props.initialElements.length == 0 && !props.fromSelection"
@add-uploaded-files="addUploadedFiles"
@on-update-datatype-toggle="changeDatatypeFilter"
@onUpdateHideSourceItems="onUpdateHideSourceItems"
@clicked-create="clickedCreate">
<template v-slot:help-content>
<!-- TODO: Update help content for case where `fromSelection` is false -->
<p>
{{
localize(
[
"Collections of datasets are permanent, ordered lists of datasets that can be passed to tools ",
"This interface allows you to build a new Galaxy list of datasets. ",
"A list is a type of Galaxy dataset collection that is a permanent, ordered list of datasets that can be passed to tools ",
"and workflows in order to have analyses done on each member of the entire group. This interface allows ",
"you to create a collection and re-order the final collection.",
"you to create and re-order a list of datasets. The datasets in a Galaxy collection have an identifier that is preserved accross ",
"tool executions and serves as a form of sample tracking - setting the name in this form will pick the identifier for that element ",
"of the list but will not change the dataset's actual name in Galaxy.",
].join("")
)
}}
</p>

<ul>
<li v-if="!fromSelection">
Move datsets from the "Unselected" column to the "Selected" column below to compose the list
in the intended order and with the intended datasets.
</li>
<li v-if="!fromSelection">
The filter textbox can be used to rapidly find the datasets of interest by name.
</li>
<li>
{{ localize("Rename elements in the list by clicking on") }}
{{ localize("Change the identifier of elements in the list by clicking on") }}
<i data-target=".collection-element .name">
{{ localize("the existing name") }}
</i>
Expand All @@ -442,13 +452,16 @@ function renameElement(element: any, name: string) {

<li>
{{ localize("Discard elements from the final created list by clicking on the ") }}
<i data-target=".collection-element .discard">
{{ localize("Discard") }}
<i v-if="fromSelection" data-target=".collection-element .discard">
{{ localize("Remove") }}
</i>
<i v-else data-target=".collection-element .discard">
{{ localize("discard") }}
</i>
{{ localize("button.") }}
</li>

<li>
<li v-if="fromSelection">
{{
localize(
"Reorder the list by clicking and dragging elements. Select multiple elements by clicking on"
Expand All @@ -468,15 +481,15 @@ function renameElement(element: any, name: string) {
{{ localize("link.") }}
</li>

<li>
<li v-if="fromSelection">
{{ localize("Click ") }}
<i data-target=".reset">
<FontAwesomeIcon :icon="faUndo" />
</i>
{{ localize("to begin again as if you had just opened the interface.") }}
</li>

<li>
<li v-if="fromSelection">
{{ localize("Click ") }}
<i data-target=".sort-items">
<FontAwesomeIcon :icon="faSortAlphaDown" />
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Collections/PairCollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
:suggested-name="initialSuggestedName"
:extensions="props.extensions"
:extensions-toggle="removeExtensions"
collection-type="paired"
:no-items="props.initialElements.length == 0 && !props.fromSelection"
@add-uploaded-files="addUploadedFiles"
@onUpdateHideSourceItems="onUpdateHideSourceItems"
Expand Down Expand Up @@ -423,7 +424,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
<i data-target=".collection-name"> {{ localize("name") }}</i>
{{ localize("and click ") }}
<i data-target=".create-collection">
{{ localize("Create list") }}
{{ localize("Create dataset pair") }}
</i>
{{ localize(".") }}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
render-extensions-toggle
:extensions-toggle="removeExtensions"
:extensions="extensions"
collection-type="list:paired"
:no-items="props.initialElements.length == 0 && !props.fromSelection"
@add-uploaded-files="addUploadedFiles"
@onUpdateHideSourceItems="hideSourceItems = $event"
Expand All @@ -875,9 +876,10 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
{{
localize(
[
"Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ",
"These collections can be passed to tools and workflows in order to have analyses done on each member of ",
"the entire group. This interface allows you to create a collection, choose which datasets are paired, ",
"This interface allows you to build a new Galaxy list of pairs. List of pairs are an ordered list of ",
"individual dataset paired together in their own paired collection (often forward and reverse reads). ",
"These lists can be passed to tools and workflows in order to have analyses done on each member of ",
"the entire group. This interface allows you to create such a list of paired datasets, choose which datasets are paired, ",
"and re-order the final collection.",
].join("")
)
Expand Down Expand Up @@ -994,7 +996,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
</i>
{{ localize("and click ") }}
<i data-target=".create-collection">
{{ localize("Create list") }}
{{ localize("Create list or pairs") }}
</i>
{{ localize(". (Note: you do not have to pair all unpaired datasets to finish.)") }}
</p>
Expand Down
18 changes: 16 additions & 2 deletions client/src/components/Collections/common/CollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface Props {
extensions?: string[];
extensionsToggle?: boolean;
noItems?: boolean;
collectionType?: string;

Check warning on line 42 in client/src/components/Collections/common/CollectionCreator.vue

View workflow job for this annotation

GitHub Actions / client-unit-test (18)

Prop 'collectionType' requires default value to be set
}
const props = withDefaults(defineProps<Props>(), {
Expand Down Expand Up @@ -102,6 +103,19 @@ const defaultExtension = computed(() => {
}
});
const shortWhatIsBeingCreated = computed<string>(() => {
// plain language for what is being created
if (props.collectionType === "list") {
return "list";
} else if (props.collectionType === "list:paired") {
return "list of pairs";
} else if (props.collectionType == "paired") {
return "dataset pair";
} else {
return "collection";
}
});
function addUploadedFiles(value: HDASummary[]) {
// TODO: We really need to wait for each of these items to get `state = 'ok'`
// before we can add them to the collection.
Expand Down Expand Up @@ -222,7 +236,7 @@ watch(
id="collection-name"
v-model="collectionName"
class="collection-name"
:placeholder="localize('Enter a name for your new collection')"
:placeholder="localize('Enter a name for your new ' + shortWhatIsBeingCreated)"
size="sm"
required
:state="!collectionName ? false : null" />
Expand All @@ -240,7 +254,7 @@ watch(
variant="primary"
:disabled="!validInput"
@click="emit('clicked-create', collectionName)">
{{ localize("Create collection") }}
{{ localize("Create " + shortWhatIsBeingCreated) }}
</BButton>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,20 @@ watch(
const formatsVisible = ref(false);
const formatsButtonId = useUid("form-data-formats-");
function collectionTypeToText(collectionType: string): string {
if (collectionType == "list:paired") {
return "list of pairs";
} else {
return collectionType;
}
}
const warningListAmount = 4;
const noOptionsWarningMessage = computed(() => {
const itemType = props.type === "data" ? "datasets" : "dataset collections";
const collectionTypeLabel = props.collectionTypes?.length ? `${orList(props.collectionTypes)} ` : "";
const collectionTypeLabel = props.collectionTypes?.length
? `${orList(props.collectionTypes.map(collectionTypeToText))} `
: "";
if (!props.extensions || props.extensions.length === 0 || props.extensions.includes("data")) {
return `No ${collectionTypeLabel}${itemType} available`;
} else if (props.extensions.length <= warningListAmount) {
Expand Down

0 comments on commit 73ce5b8

Please sign in to comment.