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

Do a correct check to know if the facility has been imported #12077

Merged

Conversation

jredrejo
Copy link
Member

@jredrejo jredrejo commented Apr 10, 2024

Summary

Using the FacilityViewset api to check if a facility has been imported after the setup wizard finishes does not work because in https://github.com/learningequality/kolibri/blob/develop/kolibri/core/auth/api.py#L617-L629 it checks PUSH transfers, that don't happen when importing a facility.

This PR changes the setup wizard behavior to solve it.
It also fixes an error observed while testing the wizard due to a incorrect ref name.

References

Closes: #10959
Closes: #11769

Reviewer guidance

  • do tests pass?
  • After running the setup wizard and importing a facility, does a modal to select a source to install resources appear?

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: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: frontend SIZE: small labels Apr 10, 2024
@jredrejo jredrejo added the TODO: needs review Waiting for review label Apr 10, 2024
@pcenov
Copy link
Member

pcenov commented Apr 11, 2024

Hi @jredrejo - I am not able to replicate the expected behavior of seeing the 'Select a source' modal. Here's a video of what I am doing and observing. Let me know if I should try anything else:

2024-04-11_14-30-09.mp4

@jredrejo
Copy link
Member Author

@pcenov I have no clue of what might be happening there 🤷‍♂️
Can you open the chrome dev tools, select the Application tab and check what you have in the "Session Storage" section?

@pcenov
Copy link
Member

pcenov commented Apr 11, 2024

Hi @jredrejo, here's what's in the 'Session storage':

2024-04-11_16-26-20

@jredrejo
Copy link
Member Author

jredrejo commented Apr 11, 2024

Hi @jredrejo, here's what's in the 'Session storage':

2024-04-11_16-26-20

@pcenov
That's perfect. I don't know why the window didn't appear for you. The cookie saying the facility is imported appears there with the correct value.
Any chance to reproduce it trying it importing a different facility? I'd like to find a way to reproduce the problem but according to this screenshot there's no way.

@pcenov
Copy link
Member

pcenov commented Apr 12, 2024

Hi @jredrejo - I've tried importing different facility, tried using a different browser and so on but I'm still nor able to see the 'Select a source' modal. If you can, please share a video of what you are doing on your end. Thanks!

@jredrejo
Copy link
Member Author

jredrejo commented Apr 12, 2024

Hi @jredrejo - I've tried importing different facility, tried using a different browser and so on but I'm still nor able to see the 'Select a source' modal. If you can, please share a video of what you are doing on your end. Thanks!

@pcenov sure, let's check if we can spot any difference:

Peek.2024-04-12.17-43.mp4

@pcenov
Copy link
Member

pcenov commented Apr 15, 2024

Hi @jredrejo - after additional testing I think I've found the reason for not seeing the modal - the facility which I was importing was created through the 'On my own' path. If I create a full facility and import it - then I am able to see the 'Select a source' modal.
Let me know if you can fix that here as part of this PR, or I should file a separate issue.

Importing a full facility:

full.facility.import.mp4

Importing an 'On my own' facility:

2024-04-15_10-35-27.mp4

@pcenov
Copy link
Member

pcenov commented Apr 15, 2024

Also the 'Add new device' link is not working (tested both in Chrome and Firefox):

2024-04-15_12-20-21.mp4

@jredrejo
Copy link
Member Author

Also the 'Add new device' link is not working (tested both in Chrome and Firefox):

2024-04-15_12-20-21.mp4

@pcenov please create a follow up issue on this. Let's not merge different problems in the same issue

Hi @jredrejo - after additional testing I think I've found the reason for not seeing the modal - the facility which I was importing was created through the 'On my own' path. If I create a full facility and import it - then I am able to see the 'Select a source' modal. Let me know if you can fix that here as part of this PR, or I should file a separate issue.

Importing a full facility:

full.facility.import.mp4
Importing an 'On my own' facility:

2024-04-15_10-35-27.mp4

hi @pcenov I see now clearly the problem and I can reproduce it perfectly
The team is discussing how to proceed. All tends to say that this case should not be possible:

Seems a little oxymoronic to have people import "on my own" facilities to other devices.

After a decission is made I'll change the code accordingly.
Thanks once again for your persistence!

@github-actions github-actions bot added the DEV: backend Python, databases, networking, filesystem... label Apr 18, 2024
@jredrejo jredrejo requested a review from rtibbles April 18, 2024 19:21
@@ -19,6 +19,8 @@
/>
<SelectDeviceModalGroup
v-if="showSelectAddressModal"
:filterByFacilityCanSignUp="true"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to filter by this? We should be able to import facilities even if they don't allow sign up, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, it was a unneeded code I left when testing it, but deleted it in another commit a few seconds after this one. If you look at the complete PR code this line is not there 😉

@jredrejo jredrejo requested a review from rtibbles April 19, 2024 08:09
@jredrejo
Copy link
Member Author

@pcenov it would be great if you can retest it. Facilities with an "on your own setup" should not be importable now.
Beware that, for it to work, both facilities (the one that's been provisioning and the one to be imported) must be running this PR code, it does not work with previous kolibri versions.

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.

Code changes make sense to me. @pcenov if you can do a final pass here?

Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

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

Hi @jredrejo - I confirm that now facilities created through 'On my own' can't be imported in the Setup Wizard.

@jredrejo jredrejo merged commit 5eeeb75 into learningequality:release-v0.16.x Apr 22, 2024
34 checks passed
@jredrejo jredrejo deleted the detecting_import_in_wizard branch April 22, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Setup Wizard Re: Setup Wizard (facility import, superuser creation, settings, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend SIZE: small TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants