Skip to content

feat: Add plugin slot for login page - #1354

Merged
feanil merged 1 commit into
openedx:masterfrom
open-craft:kshitij/plugin-slot
Oct 24, 2025
Merged

feat: Add plugin slot for login page#1354
feanil merged 1 commit into
openedx:masterfrom
open-craft:kshitij/plugin-slot

Conversation

@xitij2000

@xitij2000 xitij2000 commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

Description

This change adds a plugin slot for the login page allowing it to be customised.

Since there was a dependency conflict between frontend-plugin-framework and the react-hooks testing package, the react-hooks testing package has been removed and a replaced with a simple mechanism for testing hooks.

Since this touched the Login Page those have also been refactored to move away from redux connect.

How Has This Been Tested?

Testing with a simple env.config.jsx, using automated tests and manual testing of login

Screenshots/sandbox (optional):

Include a link to the sandbox for design changes or screenshot for before and after. Remove this section if its not applicable.

Before After

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Sandbox, if applicable.
  • Is there adequate test coverage for your changes?

Post-merge Checklist

  • Deploy the changes to prod after verifying on stage or ask @openedx/2u-infinity to do it.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

Private-ref: https://tasks.opencraft.com/browse/BB-9095

@xitij2000
xitij2000 requested a review from a team as a code owner November 7, 2024 10:30
@openedx-webhooks

openedx-webhooks commented Nov 7, 2024

Copy link
Copy Markdown

Thanks for the pull request, @xitij2000!

This repository is currently maintained by @openedx/2u-infinity.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 7, 2024
@xitij2000
xitij2000 marked this pull request as draft November 7, 2024 10:37
@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch from e19d19d to 8dfabed Compare November 7, 2024 10:38
@codecov

codecov Bot commented Nov 7, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.57%. Comparing base (5061391) to head (0418a04).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/logistration/Logistration.jsx 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1354      +/-   ##
==========================================
- Coverage   87.58%   87.57%   -0.02%     
==========================================
  Files         124      125       +1     
  Lines        2304     2309       +5     
  Branches      648      644       -4     
==========================================
+ Hits         2018     2022       +4     
- Misses        277      278       +1     
  Partials        9        9              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +22 to +38
const renderHook = (hookCallback) => {
const result = {
current: null,
};

const Component = () => {
const val = hookCallback();
React.useEffect(() => {
result.current = val;
});
return null;
};

render(<Component />);
return { result };
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had to remove @testing-library/react-hooks due to package conflicts, so I've replaced it with this simplified hook testing code. In later versions this hook is part of the react testing library so we can pull it from there and remove this.

Comment thread src/plugin-slots/LoginPage/index.jsx Outdated
Comment on lines +8 to +11
const LoginPageSlot = ({
institutionLogin,
handleInstitutionLogin,
}) => (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know how valid this is. The original component needs these values, however they are not included in plugin props since they seem pretty specific to the implementation of the login page.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Basing on many similar code examples here, I think it's valid, @xitij2000?

clearThirdPartyAuthContextErrorMessage,
},
)(Logistration);
export default Logistration;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Most of the changes here are to move from old style redux code to more modern react hooks based code.

Comment thread src/logistration/Logistration.jsx Outdated
<h3 className="mb-4.5">{formatMessage(messages['logistration.sign.in'])}</h3>
)}
<LoginPage institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />
<LoginPageSlot institutionLogin={institutionLogin} handleInstitutionLogin={handleInstitutionLogin} />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm using the LoginPageSlot in two places but perhaps these should be two slots that both render the LoginPage by default?

@jignaciopm jignaciopm Jun 17, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree, because that would be clearer

I'm using the LoginPageSlot in two places but perhaps these should be two slots that both render the LoginPage by default?

Comment thread src/login/LoginPage.jsx Outdated
thirdPartyAuthApiStatus: PENDING_STATE,
thirdPartyAuthContext: {
currentProvider: null,
errorMessage: null,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The changes to this file are to move to hooks from the older pattern of mapStateToProps etc.

Comment thread src/login/LoginPage.jsx Outdated
Comment on lines +296 to +298
const mapStateToProps = state => ({
thirdPartyAuthContext: thirdPartyAuthContextSelector(state),
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Aren't we fetching thirdPartyAuthContext with useSelector above? If so, can't we get rid of mapStateToProps completely?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I started moving to the new hooks-based approach but ran out of time. I've now fully migrated.

Comment thread src/plugin-slots/LoginPage/index.jsx Outdated
Comment on lines +8 to +11
const LoginPageSlot = ({
institutionLogin,
handleInstitutionLogin,
}) => (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Basing on many similar code examples here, I think it's valid, @xitij2000?

@xitij2000
xitij2000 marked this pull request as ready for review December 18, 2024 15:31
@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch 3 times, most recently from c999936 to f1a8f7b Compare December 20, 2024 11:29
@Cup0fCoffee

Copy link
Copy Markdown

@xitij2000 Do we need to backport this PR to Sumac?

@xitij2000

Copy link
Copy Markdown
Contributor Author

@xitij2000 Do we need to backport this PR to Sumac?

I'm doing this as part of theming maintainability so I won't be backporting it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Overview

This PR adds a plugin slot for the login page to allow greater customization and simplifies the login page implementation. Key changes include:

  • Introducing a new LoginPageSlot component that wraps the LoginPage inside a PluginSlot.
  • Refactoring LoginPage to use React hooks (useDispatch, useSelector, useIntl) instead of Redux connect.
  • Updating Logistration and related tests to accommodate the new plugin slot and hook-based implementation.

Reviewed Changes

File Description
src/plugin-slots/LoginPage/index.jsx New slot component wrapping LoginPage inside PluginSlot.
src/logistration/Logistration.test.jsx Test refactoring to use a unified renderComponent helper.
src/login/LoginPage.jsx Refactored to use hooks and updated dependency imports; removed connect.
src/recommendations/data/tests/hooks.test.jsx Custom renderHook implementation for testing hooks.
src/login/tests/LoginPage.test.jsx Test update to initialize loginFormData for LoginPage.
src/logistration/Logistration.jsx Refactored to use useSelector, useDispatch, and LoginPageSlot.

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch from 8b202c9 to b71959f Compare March 17, 2025 08:18
@mphilbrick211

Copy link
Copy Markdown

Hi @awais-ansari - is this all set to be merged?

@jignaciopm jignaciopm left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good to me!

@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch from e3d311b to 54d8439 Compare October 9, 2025 12:32
@itsjeyd

itsjeyd commented Oct 15, 2025

Copy link
Copy Markdown

Hey @MaxFrank13 @julrusak, any objections to merging this? As mentioned earlier we would love to get this into Ulmo.

@MaxFrank13

Copy link
Copy Markdown
Member

Hey @MaxFrank13 @julrusak, any objections to merging this? As mentioned earlier we would love to get this into Ulmo.

No objections to merging. I do not have merge rights for this repo though

@itsjeyd

itsjeyd commented Oct 21, 2025

Copy link
Copy Markdown

Thanks @MaxFrank13.

@deborahgu Would you be good with merging this now?

@deborahgu

Copy link
Copy Markdown
Member

I don't actually have write access yet, though I believe I was supposed to get it. @feanil, in the case where a repository temporarily doesn't have a maintainer, is there best practice for summoning someone with permission?

@deborahgu deborahgu removed the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Oct 21, 2025
@feanil

feanil commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

@openedx/committers-frontend-app-authn still has about 8 members who can merge, but I'm here now so I can do it this time around.

@feanil

feanil commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Looks like this needs a rebase, @xitij2000 can you do that.

@feanil
feanil enabled auto-merge October 21, 2025 16:01
auto-merge was automatically disabled October 22, 2025 14:37

Head branch was pushed to by a user without write access

@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch 2 times, most recently from 8db7690 to 6adaa86 Compare October 22, 2025 14:38
@xitij2000

Copy link
Copy Markdown
Contributor Author

Looks like this needs a rebase, @xitij2000 can you do that.

Done!

push:
branches:
- master
- release-ulmo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's up with this change, I don't think I saw it in here before? What's the reason for this change?

@deborahgu deborahgu Oct 22, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WTH, that rebase somehow pulled in some commits I made that never even existed on this repo. Last week I created a couple of local PR's and I fatfingered, made two PRs from a fork to openedx/master, both of which I promptly closed. I have absolutely no idea how those could have gotten pulled in from a rebase on openedx unless it was set to use edx as the upstream, and I can't think of why @itsjeyd would have that?!?

list of the commits in this PR Screenshot of the actions a couple of lines above this showing the force push pulled in these commits

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in any case both of those commits should obviously be removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure how this happened other than using Github UI's rebase function. Will fix ASAP.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems my local repo clone was infact still on the edx org, fixed.

@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch 2 times, most recently from 8db7690 to 2a3ff19 Compare October 23, 2025 05:40
@itsjeyd

itsjeyd commented Oct 23, 2025

Copy link
Copy Markdown

@farhaanbukhsh You might already be aware of it but just to be safe I wanted to give you a heads-up that we'll need to get this merged before the Ulmo branch cut today. If you could help make sure that happens, that would be great.

@farhaanbukhsh

Copy link
Copy Markdown
Member

@itsjeyd I am not a CC for this repo possibly @feanil can merge it since he reviewed it, also the release cut is moved to next Tuesday.

@itsjeyd

itsjeyd commented Oct 24, 2025

Copy link
Copy Markdown

@farhaanbukhsh I figured you weren't going to be able to merge this PR yourself, just wanted to make sure it was on your radar and wouldn't be forgotten :)

And good to know that the date for the branch cut changed again, thanks for that update.

@itsjeyd

itsjeyd commented Oct 24, 2025

Copy link
Copy Markdown

@xitij2000 Could you please rebase the changes again and let @openedx/committers-frontend-app-authn and @feanil know that they're ready to merge?

This change adds a plugin slot for the login page allowing it to be customised.

Since there was a dependency conflict between frontend-plugin-framework and the react-hooks testing package, the react-hooks testing package has been removed and a replaced with a simple mechanism for testing hooks.

Since this touched the Login Page those have also been refactored to move away from redux connect.
@xitij2000
xitij2000 force-pushed the kshitij/plugin-slot branch from 2a3ff19 to 0418a04 Compare October 24, 2025 10:27
@xitij2000

Copy link
Copy Markdown
Contributor Author

@openedx/committers-frontend-app-authn @feanil This is ready to merge.

@feanil
feanil merged commit bee0afd into openedx:master Oct 24, 2025
4 checks passed
@github-project-automation github-project-automation Bot moved this from In Eng Review to Done in Contributions Oct 24, 2025
@xitij2000
xitij2000 deleted the kshitij/plugin-slot branch January 29, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.