-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature: Remote download on content pages #10558
New feature: Remote download on content pages #10558
Conversation
To fix the topic content page not being properly loaded. This is most likely a temporary fix since the composable is work in progress. In the long term, it seems that pagination parameters will be optional.
for smoother user experience when showing/hiding download/bookmark button and the download loader
Build Artifacts
|
b42c4c9
to
f7a394d
Compare
- remove obsolete code - improve test cases independence - refactor redundant code - re-organize the test suite to be better readable
f7a394d
to
65a9faf
Compare
@@ -119,11 +119,18 @@ export default function useDownloadRequests(store) { | |||
status: 'QUEUED', | |||
date_added: new Date(), | |||
}; | |||
// TODO: Remove and replace by real progress implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up issue #10564
return false; | ||
} | ||
const downloadRequest = downloadRequestMap.downloads[this.content.id]; | ||
// TODO: Get real progress from `downloadRequest` as soon as backend is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up issue #10564
return false; | ||
} | ||
const downloadRequest = downloadRequestMap.downloads[this.content.id]; | ||
// TODO: Get real progress from `downloadRequest` as soon as backend is ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up issue #10564
to prevent from 'Cannot read properties of undefined' occuring in some scenarios
@jtamiace If you could look at the summary with the three recordings in the PR description, that'd be appreciated. Also note three related issues that involve UX |
@MisRob for (1) and (3) the icons shifting around feels a bit unexpected and distracting. For (1), is it possible to make the spinner replace the location of the download icon so that either the loading spinner or the bookmark icon is showing but not both? So something like: For how this adapts on mobile displays (2) and (3), I am not sure what technical solution makes sense, but here is an option that would require some different logic than full width displays but could eliminate the icon shifts. Keeping the download status outside of the menu seems like a nice way to communicate the system status: ^Although I guess disabling could also be used for the desktop view? |
rather then disappearing it.
Thank you, @jtamiace, that's right. I used the "disabled" state for both mobile and desktop as it was a bit more straightforward to implement. Looking much better now: |
Related learningequality/kolibri-design-system#433 has been merged and KDS reference in this PR updated to point to the latest KDS |
@MisRob For some resources the KCircularLoader seems to be continuous and is displayed before I have hit download. On other resources, it functions as expected. InfiniteLoading.mov |
@LianaHarris360 Ah, I should have mentioned this - resources with ids |
Ok, this behavior does only happen for those two hardcoded resources, which makes complete sense. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MisRob - I've added just a couple of non-blocking comments from the code read through, but all can be discussed/addressed later. I also think it makes sense to have more robust manual QA happen here after I finish the non-mocked version of the content download request viewset work, so I think we're good to go with @LianaHarris360's manual QA and the QA team can pick up the testing once more of the backend is connected up (cc @radinamatic)
@@ -41,6 +41,8 @@ export function showTopicsContent(store, id, deviceId = null) { | |||
if (deviceId) { | |||
return setCurrentDevice(deviceId).then(device => { | |||
const baseurl = device.base_url; | |||
const { fetchUserDownloadRequests } = useDownloadRequests(store); | |||
fetchUserDownloadRequests({ page: 1, pageSize: 100 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking, and can definitely be adjusted in follow up as needed, but do we want the default page size to be 100 here? That seems like a lot to me and like we want smaller pagination segments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I don't know if we'll use pagination parameters here on this page, but it's currently how fetchUserDownloadRequests
is implemented so better to be ready for it. I will resolve it in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up PR #10683
<Transition name="downloading-loader"> | ||
<!-- | ||
wrapping span needed here because | ||
(1) tooltip doesn't display when `ref` is on `KCircularLoader` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- tooltip doesn't display when
ref
is on `KCircularLoader
Today I learned!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's the case generally, it's possible that the new show
prop I added to KCircularLoader
plays a role in this but I didn't find time to investigate more closely. It's near the end of my TODOs list though :)
!this.$refs.timerButton.$el.contains(event.target) && | ||
!this.$refs.timer.$el.contains(event.target) | ||
!this.$refs.timerButton?.$el.contains(event.target) && | ||
!this.$refs.timer?.$el.contains(event.target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not clear on what this change, and the one above on line 500 and 501 is doing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comes from this commit 5ae63b5. At some point, I noticed "Cannot read properties of undefined" console errors and found out it was caused by references not being present at the time of attempting to access them here in some situations. Most likely it was a little bug not directly related to the new code. I added safeguards to resolve that. If you were asking about the syntax, that's Optional chaining.
Summary
useDownloadRequests
Notice somewhat strange UX in (3) as the download option disappears and later the bookmark option appears. We may need to re-think the logic around displaying icons/menu items in the
LearningActivityBar
to be able to improve this. Unless someone has a better idea, I can open an issue for that.References
Resolves a large portion of Remote Content Browsing: Update Content Renderer for downloading and streaming #9856 but contains some mocks. Remote Content Browsing: Update
useDownloadRequests
to provide remote content download progress (complete/incomplete) #10564 needs to be resolved for it to be complete.Related KDS PR: Add an option to freeze loader kolibri-design-system#433
Follow-ups and related issues
useDownloadRequests
to provide remote content download progress (complete/incomplete) #10564Reviewer guidance
Taking into account the number of related issues, some of them in need of implementation before this feature is complete, I think it'd make more sense to do a more thorough QA of download as a whole as soon we have everything in place. In this PR, we can focus on:
To test remote content, you can navigate to Library -> Mr Tibbles' Classroom Server -> Kolibri QA Channel as a learner
Comments
Testing checklist
PR process
Reviewer checklist
yarn
andpip
)