diff --git a/pydatalab/pydatalab/routes/v0_1/items.py b/pydatalab/pydatalab/routes/v0_1/items.py index ad1890bdc..81d1e8983 100644 --- a/pydatalab/pydatalab/routes/v0_1/items.py +++ b/pydatalab/pydatalab/routes/v0_1/items.py @@ -129,6 +129,7 @@ def get_starting_materials(): "date": 1, "chemform": 1, "name": 1, + "type": 1, "chemical_purity": 1, "supplier": 1, "location": 1, @@ -300,7 +301,8 @@ def search_items(): nresults = request.args.get("nresults", default=100, type=int) types = request.args.get("types", default=None) if isinstance(types, str): - types = types.split(",") # should figure out how to parse as list automatically + # should figure out how to parse as list automatically + types = types.split(",") match_obj = { "$text": {"$search": query}, @@ -428,10 +430,10 @@ def _create_sample( raise RuntimeError("Invalid type") model = ITEM_MODELS[type_] - ## the following code was used previously to explicitely check schema properties. - ## it doesn't seem to be necessary now, with extra = "ignore" turned on in the pydantic models, - ## and it breaks in instances where the models use aliases (e.g., in the starting_material model) - ## so we are taking it out now, but leaving this comment in case it needs to be reverted. + # the following code was used previously to explicitely check schema properties. + # it doesn't seem to be necessary now, with extra = "ignore" turned on in the pydantic models, + # and it breaks in instances where the models use aliases (e.g., in the starting_material model) + # so we are taking it out now, but leaving this comment in case it needs to be reverted. # schema = model.schema() # new_sample = {k: sample_dict[k] for k in schema["properties"] if k in sample_dict} new_sample = sample_dict diff --git a/webapp/src/components/CollectionSelect.vue b/webapp/src/components/CollectionSelect.vue index b3038eb53..2e3341d7e 100644 --- a/webapp/src/components/CollectionSelect.vue +++ b/webapp/src/components/CollectionSelect.vue @@ -9,7 +9,7 @@ @search="debouncedAsyncSearch" > @@ -77,7 +77,8 @@ export default { collectionOrNewCollection() { if ( this.searchQuery && - !this.collections.some((item) => item.collection_id === this.searchQuery) + !this.collections.some((item) => item.collection_id === this.searchQuery) && + !this.value.some((item) => item.collection_id === this.searchQuery) ) { return [ ...this.collections, @@ -130,7 +131,6 @@ export default { }, ]; } - await this.debouncedAsyncSearch(this.searchQuery, () => {}); } catch (error) { console.error("Error:", error); alert("An error occurred while creating the collection. Please try again."); diff --git a/webapp/src/components/CollectionTable.vue b/webapp/src/components/CollectionTable.vue index 0e4583b42..aa588e2db 100644 --- a/webapp/src/components/CollectionTable.vue +++ b/webapp/src/components/CollectionTable.vue @@ -16,7 +16,7 @@ export default { data() { return { collectionColumn: [ - { field: "collection_id", header: "ID", body: "FormattedItemName", filter: true }, + { field: "collection_id", header: "ID", body: "FormattedCollectionName", filter: true }, { field: "title", header: "Title" }, { field: "creators", header: "Creators", body: "Creators" }, ], diff --git a/webapp/src/components/DynamicDataTable.vue b/webapp/src/components/DynamicDataTable.vue index e193188f9..6b726c259 100644 --- a/webapp/src/components/DynamicDataTable.vue +++ b/webapp/src/components/DynamicDataTable.vue @@ -7,9 +7,9 @@