Skip to content
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

Setup Wizard: More helpful error state when trying to import from unprovisioned device #12397

Conversation

nucleogenesis
Copy link
Member

Summary

2024-07-02.16-07-59.mp4
  • Takes string from here "No learning facilities found"
  • Uses that by making the "Select facility" show an error when there are no facilities
  • Adds hideContinue prop to OnboardingStepBase to hide the Continue button there when we have this error state
  • Fixes issue where user's selection was lost when clicking "Go back" from the error state

References

Fixes #12066

Reviewer guidance

See the issue comment here for replication path -- note that I kinda had to go back and forth a few times through the flow - never actually importing anything - before I got the device to show up.

Overall, does the workflow feel okay?

@github-actions github-actions bot added APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: frontend labels Jul 2, 2024
@pcenov
Copy link
Member

pcenov commented Jul 3, 2024

Thanks @nucleogenesis - I confirm that now there's an error message if I attempt to import a learner from unprovisioned device.
Just have one question - in #12066 I have mentioned that the expected behavior would be for the device to not be shown in the 'Select device' modal which is the case for example when I attempt to import a full facility from that same unprovisioned device. Is that not an option in this case?

@bjester
Copy link
Member

bjester commented Jul 3, 2024

To @pcenov's note, we should probably add a prop to SelectDeviceForm for filtering locations that have a facility, i.e. filterHasFacility. Then have the useDeviceFacilityFilter apply the filter. That should prevent it from ever getting as far as where these error messages would show.

That would take care of filtering devices that would not be joinable or importable because they have no facility, which is a solid improvement. Although it doesn't go quite as far as the original issue's proposal of filtering those devices that actually have learners for import. I think the consensus was that we don't need to go that far. See my comment in regards to that

@rtibbles rtibbles changed the base branch from develop to release-v0.17.x July 12, 2024 16:15
@github-actions github-actions bot added the DEV: backend Python, databases, networking, filesystem... label Jul 22, 2024
if "timeout" not in kwargs:
kwargs.update(timeout=self.timeout)

timeout = kwargs.pop("timeout", self.timeout)
Copy link
Member Author

Choose a reason for hiding this comment

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

@bjester I saw the comment in the filters about wanting to pass the params to the API directly and started investigating. I was running into an error when I tried to pass the filter values as kwargs and discovered that the parent request method expects the params kwarg.

Looking at changing the front-end code to pass these values in to the API seemed like maybe out of scope for this PR, but does this look right and like it might help simplify the facility filters a bit. I was thinking I might just put that into the apiParams object created in SelectDeviceForm but paused to get your thoughts here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah so I think the changes that are needed are external to this client class. This class is a generic client utility. This means we rather need to update the APIs that are using it to pass the params.

@nucleogenesis
Copy link
Member Author

@radinamatic @bjester I've updated this with changes that I think are in line with Blaine's suggestion which hides no-facility devices altogether when a particular prop is passed.

I'm feeling a little unsure of my approach so I look forward to your thoughts on the code Blaine!

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

More comments. The primary blocking change is the updates to the network client. I'm quite sure those changes are likely breaking.

kolibri/core/discovery/utils/network/client.py Outdated Show resolved Hide resolved
if "timeout" not in kwargs:
kwargs.update(timeout=self.timeout)

timeout = kwargs.pop("timeout", self.timeout)
Copy link
Member

Choose a reason for hiding this comment

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

Yeah so I think the changes that are needed are external to this client class. This class is a generic client utility. This means we rather need to update the APIs that are using it to pass the params.

{} => "are there any facilities at all?"
{ id: <val> } => "are there any facilities that match this id?"

this ensures that we properly handle the case where there are no
facilities
@nucleogenesis nucleogenesis force-pushed the fix--noisy-unprovisioned-devices branch from c75c06f to 1b7a759 Compare July 29, 2024 18:23
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Code LGTM

);

// If we're filtering a particular facility
if (Object.keys(facilityFilter).length > 0 || props.filterByHasFacilities) {
apiParams.subset_of_users_device = false;
Copy link
Member

Choose a reason for hiding this comment

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

It maybe unexpected that we filter out SoUDs when applying props.filterByHasFacilities, but since it's a new prop, we don't have any use cases, so it's def fine until we do.

@pcenov
Copy link
Member

pcenov commented Aug 13, 2024

Hi @radinamatic - I confirm that the issue described in #12066 is fixed now and there are no new issues observed while regression testing.

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Manual QA passes, good to go! 💯 👏🏽 :shipit:

@rtibbles
Copy link
Member

Readthedocs build appears to have stalled, and has nothing to do with this PR. Merging!

@rtibbles rtibbles merged commit 1353e99 into learningequality:release-v0.17.x Aug 22, 2024
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup Wizard - Devices that are not fully setup are showing up in the 'Select device' modal
6 participants