Skip to content

Remote Content Browsing: Clean the library page when displaying other available libraries#10216

Closed
AllanOXDi wants to merge 13 commits intolearningequality:developfrom
AllanOXDi:remote_content_browsing_functionality
Closed

Remote Content Browsing: Clean the library page when displaying other available libraries#10216
AllanOXDi wants to merge 13 commits intolearningequality:developfrom
AllanOXDi:remote_content_browsing_functionality

Conversation

@AllanOXDi
Copy link
Member

@AllanOXDi AllanOXDi commented Mar 9, 2023

Summary

This PR clean the library page when displaying other available libraries.

References

Reviewer guidance

Please see the figma design

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.) SIZE: small labels Mar 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

@AllanOXDi AllanOXDi changed the title fixes device icon Remote Content Browsing: Clean the library page when displaying other available libraries Mar 9, 2023
@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Facility Re: Facility App (user/class management, facility settings, csv import/export, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) DEV: backend Python, databases, networking, filesystem... SIZE: very large and removed DEV: backend Python, databases, networking, filesystem... APP: Facility Re: Facility App (user/class management, facility settings, csv import/export, etc.) APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) APP: User Re: User app (sign-in, sign-up, user profile, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) labels Mar 16, 2023
@AllanOXDi AllanOXDi requested a review from marcellamaki March 16, 2023 14:45
@AllanOXDi AllanOXDi marked this pull request as ready for review March 16, 2023 14:52
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Overall code looks good.

I think that making the allDevices prop a bit safer or required would help a bit. Note that making it required will just mean that Vue will complain to you in the devtools whenever you don't pass a value to the prop - so it may just be worth doing null checks before reading into the object in any case.

Comment on lines 60 to 70
allDevices: {
type: Object,
required: false,
default: null,
},
Copy link
Member

Choose a reason for hiding this comment

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

With default: null here you can run into an issue where if the prop is not provided at all it can result in a Error: Cannot read properties of null/undefined in any code that tries to read into allDevices, which they assume is an object.

It doesn't look like you're checking for if it's nullish before you try to read from the object's value (ie, your v-if around line 7) -- so if allDevices really isn't required, then making the default value {} or checking if allDevices is null before reading from it (or maybe using the ?.) would be safer.

Comment on lines 67 to 68
if (device['operating_system'] === 'Darwin') {
return 'laptop';
Copy link
Member

Choose a reason for hiding this comment

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

Since we default at the end to showing a laptop this seems unnecessary -- is there some particular reason we should check first for "Darwin" before "Android" or could we remove the first if here to the same effect?

Copy link
Member

Choose a reason for hiding this comment

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

+1

methods: {
getDeviceIcon(device) {
if (device['operating_system'] === 'Darwin') {
return 'laptop';
Copy link
Member

Choose a reason for hiding this comment

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

Please see comment above from @nucleogenesis regarding this.

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Hi @AllanOXDi, Great work. Code generally LGTM. I have left some comments that will help improve the code even further.

Copy link
Member

Choose a reason for hiding this comment

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

Just a general comment on PinnedNetworkResources and PinnedNetworkResources components. It is probably better to load the devices alongside there channels in this file and just pass the results as props to the components since they are in the same file. This comes with benefits like better state management, better reloading capabilities and most importantly implementing the DRY(Don't repeat yourself) principal.

},
setup() {
const { windowBreakpoint } = useKResponsiveWindow();
const { baseurl, fetchDevices } = useDevices();
Copy link
Member

Choose a reason for hiding this comment

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

Please see my general comment on the LibraryPage/index.,vue file

Copy link
Member

Choose a reason for hiding this comment

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

Please see my general comment on the LibraryPage/index.,vue file

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Overall code looks good. Thanks @AllanOXDi. Just a final change and we should be good for merging

</h2>
<div>
<h2>{{ $tr('moreLibraries') }}</h2>
<MoreNetworkDevices />
Copy link
Member

@akolson akolson Mar 23, 2023

Choose a reason for hiding this comment

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

I think applying the same concept as seen with PinnedNetworkResources would work great. Creating an unpinnedDevices data property and passing it into the PinnedNetworkResources as a prop would help with refreshing state of these devices(I think there is a refresh button somewhere). That would mean also getting rid of the fetchDevices and fetchChannels in the MoreNetworkDevices component as it would not be necessary since you are passing the content(devices and their channels) as props. For now its okay for them to display the same devices. Later we can apply filtering based on results returned from the pinning API that we co-hacked with Jacob yesterday

@AllanOXDi AllanOXDi requested a review from akolson March 24, 2023 19:27
return 'laptop';
}
},
},
Copy link
Member

Choose a reason for hiding this comment

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

I had to add another } here when running locally.

@marcellamaki
Copy link
Member

Hi @AllanOXDi - I was doing a little bit of manual QA on this and I noticed that the channel cards that are displayed here are my channels, not the channels of the remote devices.

Maybe this PR is just for the card implementation, but I just wanted to mention this because I am not sure if it was intentional, and in case we need a follow up issue for it. It looks like the Explore Libraries page that @akolson was working on has this in place, so maybe it's just a matter of a follow up issue using the pattern there.
https://user-images.githubusercontent.com/17235236/228255591-794f7b4a-0471-46d3-b614-14a3c436e7f2.mp4

Nice work overall! Great to see this Library Page coming along so well :)

@akolson
Copy link
Member

akolson commented Mar 28, 2023

@marcellamaki thanks for raising this. Based on the design spec, i think we shouldn't be having this
image @AllanOXDi ?

@AllanOXDi AllanOXDi closed this by deleting the head repository Mar 30, 2023
@AllanOXDi AllanOXDi reopened this Mar 30, 2023
return this.coreString('channelsLabel');
}
},
// ...mapGetters(['isUserLoggedIn']),
Copy link
Member

Choose a reason for hiding this comment

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

This should be removed completely

// this.fetchDevices().then(devices => {
// this.devices = devices.filter(d => d.available);
// });
// }
Copy link
Member

Choose a reason for hiding this comment

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

All commented code should be removed completely

refresh: {
message: 'Refresh',
context: 'Link for refreshing library',
},
Copy link
Member

Choose a reason for hiding this comment

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

I think adding/moving around translations strings has been suspended for now due to the string freeze. cc @marcellamaki @radinamatic

Copy link
Member Author

@AllanOXDi AllanOXDi Mar 30, 2023

Choose a reason for hiding this comment

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

I think these strings were already in. Might have come due to a rebase yesterday

Copy link
Member

@akolson akolson Mar 30, 2023

Choose a reason for hiding this comment

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

I just checked and the refresh string already exists in the commonCoreStrings.js. So using this instead and deleting the new one would be an acceptable solution to this.

https://github.com/learningequality/kolibri/blob/develop/kolibri/core/assets/src/mixins/commonCoreStrings.js#L1524

required: false,
default: null,
},
isPinned: {
Copy link
Member

Choose a reason for hiding this comment

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

I think this prop is misleading. I think the wifi icon is meant to specify whether the resource is available or not. @jtamiace , @marcellamaki ?

<div
style="text-align:right;margin-right:10px;margin-top:10px"
>
<KIcon v-if="isPinned" icon="wifi" />
Copy link
Member

Choose a reason for hiding this comment

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

I think the v-if="isPinned" directive should be moved to the parent(div) as hiding just the KIcon will leave additional margins that may not be desirable. Also, see my comments below regarding the isPinned prop

Copy link
Member

Choose a reason for hiding this comment

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

This file should be deleted as its no longer used in light of the discussion here

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Thanks @AllanOXDi! Code looks good. Just a few minor changes and we should be good to go!

@AllanOXDi
Copy link
Member Author

AllanOXDi commented Mar 30, 2023

Closing this PR again. It's giving me a nightmare updating it.Probably because I deleted a base branch. Please see #10354. Sorry!

@AllanOXDi AllanOXDi closed this Mar 30, 2023
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.) SIZE: medium SIZE: small SIZE: very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants