Skip to content

adds logic to LibraryPage to optionally display a particular device's…#10227

Merged
akolson merged 6 commits intolearningequality:developfrom
akolson:explore-library
Mar 14, 2023
Merged

adds logic to LibraryPage to optionally display a particular device's…#10227
akolson merged 6 commits intolearningequality:developfrom
akolson:explore-library

Conversation

@akolson
Copy link
Member

@akolson akolson commented Mar 10, 2023

Summary

This PR implements the ability to explore a device's library. Please see #9854 for spec details and figma designs

References

Closes #9854

Reviewer guidance

To review;

  • Login into Kolibri
  • Go to /learn/#/explore_libraries via the browser address bar
  • On load, click on the Explore button of any of the libraries displayed

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... SIZE: medium labels Mar 10, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 10, 2023

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

This all makes sense to me - and for the Studio piece until we get the backend APIs on Studio unstable at least, this is the best we can do to test out the UI.

Interested if there's any intersection here with @bjester's work on the device listing that might be useful!

* during development
*/
if (deviceId === KolibriStudioId) {
RemoteChannelResource.getKolibriStudioStatus().then(({ data }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Flagging for any other reviewers that until we have a Studio server with the new public content APIs in them, we have to do it this way.

"gradeLevels": label_metadata["grade_levels"],
"accessibilityLabels": label_metadata["accessibility_labels"],
"learnerNeeds": label_metadata["learner_needs"],
"baseurl": conf.OPTIONS["Urls"]["CENTRAL_CONTENT_BASE_URL"],
Copy link
Member

Choose a reason for hiding this comment

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

Could we call this studio_baseurl to make it more explicit?

},
},
$trs: {
libraryOf: {
Copy link
Member

Choose a reason for hiding this comment

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

@marcellamaki @radinamatic flagging the string movement here and in the next file.

@akolson akolson requested a review from rtibbles March 10, 2023 20:13
@akolson akolson marked this pull request as ready for review March 10, 2023 20:13
@akolson akolson requested a review from nucleogenesis March 10, 2023 20:14
Copy link
Member

@jredrejo jredrejo left a comment

Choose a reason for hiding this comment

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

I have some doubts in how this should work, not sure if it is because of my lack of understanding of the remote browsing or an actual issue.

} else {
if (deviceId) {
return setCurrentDevice(deviceId).then(device => {
const baseurl = deviceId === KolibriStudioId ? plugin_data.studio_baseurl : device.base_url;
Copy link
Member

Choose a reason for hiding this comment

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

maybe this is a naive question, but wouldn't it be possible to reuse the code from the device channel in the showAvailableChannelsPage function instead of rewritting something so similar?

Copy link
Member

Choose a reason for hiding this comment

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

Ultimately, we should remove most of this special casing, once we have a version of Studio that we can test against that supports the v2 public content APIs, then all we need to do is pass in the Studio baseurl, and channels and resources should all be fetched properly from Studio.

if (data.status === 'online') {
RemoteChannelResource.fetchCollection().then(channels => {
//This is a hack to return kolibri channels.
store.commit('SET_ROOT_NODES', channels);
Copy link
Member

Choose a reason for hiding this comment

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

maybe I don't understand how this should work, but the result are different of what I expected:
image
The explored device has only one channel, as seen in the network request, however rootNodes is set to 10 channels that I don't know where they come from, but not from the explored device.

Copy link
Member Author

@akolson akolson Mar 13, 2023

Choose a reason for hiding this comment

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

@jredrejo it looks like the current implementation within the LibraryPage returns the previously loaded library channels as the newly selected library loads. This is an issue that I think should be resolved once loading states are streamlined across the remote content browsing feature. @rtibbles any thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

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

yep, it's showing both the channels existing in the local device plus the one on the remote device.

Copy link
Member Author

@akolson akolson Mar 13, 2023

Choose a reason for hiding this comment

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

Though the behavior is for previous results to be cleared once the loading is complete for remote devices. Not very sure the behavior with locally hosted devices

Copy link
Member

Choose a reason for hiding this comment

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

Yes, the lack of the loading state is key here - especially as local channels are bootstrapped into the page so there's no loading at all.

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

This is good to merge, but more to do on top of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... SIZE: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote Content Browsing: Explore a library

4 participants