rspace-os / rspace-web

This the main repository for RSpace: rspace-web. Check https://github.com/rspace-os/rspace-web/blob/main/DevDocs/DeveloperNotes/GettingStarted/GettingStarted.md for setup instructions.
https://github.com/rspace-os/rspace-web/wiki
GNU Affero General Public License v3.0
12 stars 3 forks source link

RSDEV-260 Add subsamples details section to sample page #54

Closed rlamacraft closed 1 month ago

rlamacraft commented 2 months ago

This change adds a new section to the sample page, showing some details of each subsample. This is to make it easier to browse those details without having to click around each subsample page, particularly useful when samples regularly only have one subsample.

image

This new panel appears below the subsample listing table, with the subsample theme colours to distinguish it from the sample itself. The user can browse back and forward between the subsample with the arrow buttons, or just to a specific subsample by tapping a row in the table (viewing the subsample's own page is now reachable by tapping the Global ID link or the link at the end of the new panel). The location, quantity, and notes fields are shown; fields that are specific to the subsample and detail what is unique about this physical quantity of some substance.

Moreover, the table listing all of the subsamples now defaults to being closed when there is only one subsample. We still must keep it available as there are some operations on the subsample that can only be performed from the search mechanism, but it is unlikely to be of interest most of the time for users who typically have samples with only one subsample. Interacting with the search mechanism in any way causes it to open.

In terms of implementation details of note, the activeResult of the Search mechanism scoped to the SampleModel is being used for fetching the full details of the subsample, and it is that allows us to change the displayed subsample when the rows of the table are tapped. As such, when the user presses the next and previous buttons we have to fetch the previous or next page of results if the record in question is not yet known to the Search mechanism. Up until now, we've not used the activeResult of the searches scoped to each record type (container contents, sample subsamples, and template samples), but the activeResult is in use in the move dialog, the template picker, and of course the whole page-wide search. The abstraction afforded by the Search and CoreFetcher et al. classes continues to pay dividends.