From 02406ba1d3f3cff5629012abcf52f72793c328ba Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 3 Dec 2024 14:33:13 -0500 Subject: [PATCH] Improve language in collection builders... --- .../Collections/CollectionCreatorModal.vue | 21 +++++++++++-------- .../Collections/ListCollectionCreator.vue | 1 + .../Collections/PairCollectionCreator.vue | 3 ++- .../PairedListCollectionCreator.vue | 3 ++- .../Collections/common/CollectionCreator.vue | 18 ++++++++++++++-- .../Form/Elements/FormData/FormData.vue | 12 ++++++++++- 6 files changed, 44 insertions(+), 14 deletions(-) diff --git a/client/src/components/Collections/CollectionCreatorModal.vue b/client/src/components/Collections/CollectionCreatorModal.vue index 278e25f3d706..33c6d938e9db 100644 --- a/client/src/components/Collections/CollectionCreatorModal.vue +++ b/client/src/components/Collections/CollectionCreatorModal.vue @@ -113,22 +113,25 @@ watch( } ); +const extensionInTitle = computed(() => { + 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" : "" }` ); diff --git a/client/src/components/Collections/ListCollectionCreator.vue b/client/src/components/Collections/ListCollectionCreator.vue index 9be7de5aae6c..bcd76e36bee0 100644 --- a/client/src/components/Collections/ListCollectionCreator.vue +++ b/client/src/components/Collections/ListCollectionCreator.vue @@ -442,6 +442,7 @@ function renameElement(element: any, name: string) { :history-id="props.historyId" :hide-source-items="hideSourceItems" :extensions="extensions" + collectionType="list" @add-uploaded-files="addUploadedFiles" @on-update-datatype-toggle="changeDatatypeFilter" @onUpdateHideSourceItems="onUpdateHideSourceItems" diff --git a/client/src/components/Collections/PairCollectionCreator.vue b/client/src/components/Collections/PairCollectionCreator.vue index f7a9ab5f6d5a..9ce44c1ba2a3 100644 --- a/client/src/components/Collections/PairCollectionCreator.vue +++ b/client/src/components/Collections/PairCollectionCreator.vue @@ -433,6 +433,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) { :suggested-name="initialSuggestedName" :extensions="props.extensions" :extensions-toggle="removeExtensions" + collection-type="paired" @add-uploaded-files="addUploadedFiles" @onUpdateHideSourceItems="onUpdateHideSourceItems" @clicked-create="clickedCreate" @@ -481,7 +482,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) { {{ localize("name") }} {{ localize("and click ") }} - {{ localize("Create list") }} + {{ localize("Create dataset pair") }} {{ localize(".") }}

diff --git a/client/src/components/Collections/PairedListCollectionCreator.vue b/client/src/components/Collections/PairedListCollectionCreator.vue index d6e0f385aecb..3e53e5e5cbd2 100644 --- a/client/src/components/Collections/PairedListCollectionCreator.vue +++ b/client/src/components/Collections/PairedListCollectionCreator.vue @@ -935,6 +935,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) { :history-id="props.historyId" :hide-source-items="hideSourceItems" render-extensions-toggle + collection-type="list:paired" :extensions-toggle="removeExtensions" :extensions="extensions" @add-uploaded-files="addUploadedFiles" @@ -1066,7 +1067,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) { {{ localize("and click ") }} - {{ localize("Create list") }} + {{ localize("Create list of pairs") }} {{ localize(". (Note: you do not have to pair all unpaired datasets to finish.)") }}

diff --git a/client/src/components/Collections/common/CollectionCreator.vue b/client/src/components/Collections/common/CollectionCreator.vue index c080744dbe3d..8087fe2d4154 100644 --- a/client/src/components/Collections/common/CollectionCreator.vue +++ b/client/src/components/Collections/common/CollectionCreator.vue @@ -38,6 +38,7 @@ interface Props { renderExtensionsToggle?: boolean; extensions?: string[]; extensionsToggle?: boolean; + collectionType?: string; } const props = withDefaults(defineProps(), { @@ -101,6 +102,19 @@ const defaultExtension = computed(() => { } }); +const shortWhatIsBeingCreated = computed(() => { + // 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. @@ -211,7 +225,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" /> @@ -229,7 +243,7 @@ watch( variant="primary" :disabled="!validInput" @click="emit('clicked-create', collectionName)"> - {{ localize("Create collection") }} + {{ localize("Create " + shortWhatIsBeingCreated) }} diff --git a/client/src/components/Form/Elements/FormData/FormData.vue b/client/src/components/Form/Elements/FormData/FormData.vue index d2a0e0b87ce9..785e0ced16e0 100644 --- a/client/src/components/Form/Elements/FormData/FormData.vue +++ b/client/src/components/Form/Elements/FormData/FormData.vue @@ -599,10 +599,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) {