Skip to content

Add collections info to StartingMaterialTable.vue#1695

Open
be-smith wants to merge 12 commits intomainfrom
bes/add_collections_to_sm_page
Open

Add collections info to StartingMaterialTable.vue#1695
be-smith wants to merge 12 commits intomainfrom
bes/add_collections_to_sm_page

Conversation

@be-smith
Copy link
Copy Markdown
Member

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.82%. Comparing base (ce4f17c) to head (32c4839).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1695   +/-   ##
=======================================
  Coverage   78.82%   78.82%           
=======================================
  Files          81       81           
  Lines        7038     7038           
=======================================
  Hits         5548     5548           
  Misses       1490     1490           
Files with missing lines Coverage Δ
pydatalab/src/pydatalab/routes/v0_1/items.py 83.01% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds collection membership visibility for starting materials by returning collection metadata from the API and rendering it in the Starting Materials table.

Changes:

  • Add a “Collections” column to StartingMaterialTable.vue using the existing CollectionList cell renderer and enabling column filtering.
  • Update the /starting-materials/ aggregation pipeline to $lookup collections and include them in the projected response.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
webapp/src/components/StartingMaterialTable.vue Adds a Collections column and derives a comma-joined collectionsList field per row.
pydatalab/src/pydatalab/routes/v0_1/items.py Adds collections lookup + projection to the /starting-materials/ list endpoint output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +83
return this.$store.state.starting_material_list.map((item) => ({
...item,
collectionsList: (item.collections || [])
.map((collection) => collection.collection_id)
.join(", "),
}));
},
"collections": {
"collection_id": 1,
"title": 1,
Comment thread pydatalab/src/pydatalab/routes/v0_1/items.py
@cypress
Copy link
Copy Markdown

cypress Bot commented Apr 24, 2026

datalab    Run #4860

Run Properties:  status check failed Failed #4860  •  git commit 1436e3fb09 ℹ️: Merge 32c4839a9b515620a48fed577f65fd5d19e922c6 into ce4f17ca0b26aa74d6566c001b4a...
Project datalab
Branch Review bes/add_collections_to_sm_page
Run status status check failed Failed #4860
Run duration 09m 49s
Commit git commit 1436e3fb09 ℹ️: Merge 32c4839a9b515620a48fed577f65fd5d19e922c6 into ce4f17ca0b26aa74d6566c001b4a...
Committer Ben Smith
View all properties for this run ↗︎

Test results
Tests that failed  Failures 5
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 298
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/batchSampleFeature.cy.js • 5 failed tests • End-to-end tests (chrome)

View Output

Test Artifacts
Batch sample creation > modifies some data in the second sample Test Replay Screenshots
Batch sample creation > checks the copied samples Test Replay Screenshots
Batch sample creation > checks the created samples Test Replay Screenshots
Batch sample creation > uses the template id, name, date, copyFrom, and components Test Replay Screenshots
Batch sample creation > plays with the number of rows Test Replay Screenshots

@be-smith be-smith marked this pull request as ready for review April 28, 2026 12:34
@be-smith be-smith requested a review from Copilot April 28, 2026 12:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds collection membership visibility for starting materials by wiring the backend /starting-materials/ summary response to include collection info and exposing it in the Starting Material table UI.

Changes:

  • Add a “Collections” column to StartingMaterialTable.vue using the existing CollectionList cell renderer and filtering support.
  • Update Cypress component test expectations to include the new column header.
  • Update the backend aggregation for /starting-materials/ to $lookup collections and add a server test asserting collections[].collection_id is present.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
webapp/src/components/StartingMaterialTable.vue Adds a Collections column rendered via CollectionList.
webapp/cypress/component/StartingMaterialTableTest.cy.jsx Updates expected table headers to include Collections.
pydatalab/tests/server/test_starting_materials.py Adds an API test asserting /starting-materials/ includes collections[].collection_id.
pydatalab/src/pydatalab/routes/v0_1/items.py Adds a collections $lookup and attempts to project collections into the response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread webapp/cypress/component/StartingMaterialTableTest.cy.jsx
Comment on lines +109 to +111
"collections": {
"collection_id": 1,
},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong, but we should also get the collection title too

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"collections": {
"collection_id": 1,
},
"collections": {
"collection_id": 1,
"title": 1,
},

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lookup doesn't currently return the title, only _id and collection_id.

Do you want me to update it to return title?

Displaying the title alongside collection_id looks a bit messy in the UI

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I guess that's a bug in the item routes too then (which tries to grab title). Let's just stick to collection_id only then.

Comment on lines +136 to +157
collection_data = json.loads(default_collection.json())
collection_data["starting_members"] = [{"item_id": default_starting_material_dict["item_id"]}]
response = client.put("/collections", json={"data": collection_data})
assert response.status_code == 201, response.json

response = client.get("/starting-materials/")
assert response.status_code == 200
items = response.json["items"]
matching = [
item for item in items if item["item_id"] == default_starting_material_dict["item_id"]
]
assert len(matching) == 1
item = matching[0]

assert "collections" in item, "collections key missing from /starting-materials/ response"
assert len(item["collections"]) == 1
assert item["collections"][0]["collection_id"] == default_collection.collection_id

# Clean up the collection so later tests are unaffected
client.delete(f"/collections/{default_collection.collection_id}")


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry about clean up too much as long as it doesn't effect tests in this file -- our database is torn down and deleted after every test file anyway

@ml-evs ml-evs added this to the v0.7.x milestone Apr 29, 2026
@ml-evs ml-evs force-pushed the bes/add_collections_to_sm_page branch from fc620a9 to 32c4839 Compare May 1, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants