Giter Site home page Giter Site logo

frontend-app-learner-portal-enterprise's Introduction

frontend-app-learner-portal-enterprise

Build Status

Purpose

The edX learning platform's frontend for enterprise learners.

Getting Started

Setup for development

Ensure you have gone through Onboarding for devs

Clone this repo: git clone https://github.com/openedx/frontend-app-learner-portal-enterpise.git

Install nodejs (using nvm maybe a good idea to be able to switch node versions and because there is an .nvmrc file that will be usable by nvm)

To run the project, first install dependencies

$ nvm use # will install/setup node needed for this project. Install the specified version (nvm Will help you do that) $ npm i # will install deps

then, start the dev server:

$ npm start

Visit http://localhost:8734

At this point, it will ask you to login. Use the user indicated in devstack ([email protected], edx). When logged in, expect to see a 404 since we are not setup.

Our goal is to setup a enterprise customer, obtains its slug, then visit it such as http://localhostL8734/{enterprise_slug}

Now quickly check the .env.development file for which services are used by the application. e.g. LMS_BASE_URL='http://localhost:18000' . We will get back to this.

Serving production builds

During production builds, the NPM script npm run build is executed, which runs the production Webpack configuration (webpack.prod.config.js) to generate output files in the dist directory. However, these output files cannot be loaded directly into the browser. Instead, to preview a production build locally, these output files must be served via a server that can associate any URL route to the index.html entry-point of the application. The @openedx/frontend-build package supports a serve command, which runs the generated production output from Webpack with a Node.js Express server.

To serve a production build, the build must include the appropriate environment variables. The custom webpack.prod.config.js file in this project attempts to load all environment variables configured via the Git-ignored .env.private file, such that the production build can point to localhost URLs, etc.

Relevant commands:

  • npm run serve: Serves the output files from the dist directory on the PORT environment variable defined in the .env.development file.
  • npm run build:serve: Executes npm run build, followed by serving those generated assets in one command.
  • npm run build:with-theme:serve: Executes npm run build:with-theme (i.e., utilizes custom brand package), followed by serving those generated assets in a single command.

Setup test users and data

An enterprise portal will need a couple of roles: The Enterprise customer, and at least one learner account.

Next we will setup a test-enterprise customer who will have learners associated with it (Details at The Enterprise management commands):

  • Ensure the Enterprise Integration flag is enabled in devstack see this link. Set the flag ENABLE_ENTERPRISE_INTEGRATION to True if it isn't already
  • From the devstack directory, restart lms using make lms-restart for applying changes
  • Seed test data:
    • Go into the lms shell:
       $ make lms-shell
       $ ./manage.py lms seed_enterprise_devstack_data
    
  • Go to http://localhost:18000/admin/enterprise/ and login as edx/edx
  • If you can see an Enterprise section in the admin page you are all set so far, otherwise stop and ask someone!
  • Next, ensure the Learner portal is enable for this Enterprise user:

Get familiar with learner and customer accounts

In this section you will:

  • Locate the enterprise customer test-enterprise in the Django admin page for enterprise

  • Learn how to navigate to the admin portal for that customer and view learner accounts setup during previous steps

  • Visit http://localhost:18000/admin/enterprise/ : the Django admin portal for enterprise

  • Login as edx/edx

  • Visit the Enterprise Customers link, it should be http://localhost:18000/admin/enterprise/enterprisecustomer/

    • Locate the slug for the customer named 'Test enterprise'
    • This is probably test-enterprise
    • The slug is used as a url path to visit the enterprise portal for this customer, more on that later
  • Now click on the Test Enterprise user link

  • Click on Manage learners to view learner accounts

  • This page should list at least one learner account like [email protected] (username), password is the same as edx user

Use learner portal with the edx-enterprise stack

You are now in the Learner portal for the enterpriser customer Test Enterprise, as a learner!

Next up: enroll one or more learners into your own course!

It is very useful to create multiple courses and enroll the learners into them for testing

For this, an easy way is to use the Studio! Usually at http://localhost:18010

Setup enterprise stack for local changes

You need this, if you need to make changes to the API endpoints or anything else in edx-enterprise project

We have edx-enterprise Django module running inside of the LMS (which is started by devstack). Refer to Devstack Doc for details. This is what serves endpoints used by the application. To make changes, you will replace that available install of edx-enterprise with your local version

  • Setup devstack if not already and at least have the lms service running. Typically cd'ing to the devstack folder, and running make dev.up or make dev.nfs.up will do it

  • Ensure you can browse to LMS at least, http://localhost:18000

  • Sync edx-enterprise into the src/ folder of your work folder (e.g. ~/work/src/edx-enterprise)

  • Ensure this env var is set in your env for the docker mount to be located correctly, e.g.,: DEVSTACK_WORKSPACE=/Users/$USER/work , in your shell config file

  • Either start new shell or run exec "$SHELL" for changes to take effect in the shell

  • Start backend services needed (refer to .env.development file). Refer to Devstack Doc for details

If all worked you should be able to navigate to http://localhost:18000/admin/enterprise/ But wait, it won't work yet. As long as you get some reasonable response here, you are good (probably a login page).

Making changes to edx-enterprise stack locally

Make any changes in edx-enterprise stack then

  • In your devstack folder run

    $ make lms-shell
    $ pip install -e /edx/src/edx-enterprise
    $ exit # back to regular shell
    

    This will uninstall the published edx-enterprise package and instead install your local copy from src.

  • Now any changes you make to edx-enterprise should reflect your changes

  • If you do not see your changes, restart lms and wait some time:

    $ make lms-restart
    

Presubmission

Always run npm run lint before submission. We may want a precommit hook at some point. To fix lint issues, run npm run lint -- --fix

Testing

Testing is supported with Jest and Enzyme. To run tests, use:

npm test

Debugging

With built-in VSCode embedded debugger

This is nice if you want to use VScode built in debugger and also make changes and reload and try again.

In VSCode, click on the Debug button to the left toolbar

Go to add configuration and select type 'chrome'

VScode will generate a file in .vscode/launch.json that looks like this, edit it as shown to your desired url

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8734/test-enterprise",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

Save this file. It is already gitignore so no worries about accidental checkin.

Now you can just hit the run button that says 'Launch Chrome ...' and you can now put breakpoints in your code and get embedded VSCode debugging!

You can create more configs later if you want more than one url (such as different enterprise slug) to test with.

With chrome

Just fire up chrome devtools as usual and put breakpoints! You can also edit directly from chrome devtools by enabling local folder support.

in brief:

npm run debug-test

Then chrome://inspect in chrome along with debugger in the code to trigger a breakpoint?

Routes

This micro-frontend application consists of the following URL routes:

Route Description
http://localhost:8734/ The main entry point for the Enterprise Learner Portal. Detects which enterprise(s) you're linked to and redirects you to the appropriate dashboard page for a specific enterprise.
http://localhost:8734/:enterpriseSlug The dashboard page for a specific enterprise customer. Displays all course enrollments for a learner associated with that enterprise.
http://localhost:8734/:enterpriseSlug/search The search page for a specific enterprise customer. Shows all enrollable courses associated with that enterprise's content catalogs. Utilizes Algolia as a hosted search provider.
http://localhost:8734/:enterpriseSlug/course/:courseKey The course page with information about the course and provides a way for learners to enroll using their enterprise's subsidy (e.g., subscription license, codes).
http://localhost:8734/:enterpriseSlug/licenses/:activationKey/activate The license activation page allows new learners who have an assigned license to activate their license.
http://localhost:8734/r/:redirectPath This route allows deep linking to a specific page within the Enterprise Learner Portal (i.e., the redirect path) without yet knowing an enterprise slug. This route is helpful to send generic links to pages within the Enterprise Learner Portal in marketing, support, account management scenarios.

Code layout / components

TODO/WIP

Required reading

License

The code in this repository is licensed under the AGPLv3 unless otherwise noted.

Please see LICENSE <LICENSE>_ for details.

Contributing

Contributions are very welcome. Please read How To Contribute_ for details.

.. _How To Contribute: https://openedx.org/r/how-to-contribute

This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.

Getting Help

If you're having trouble, we have discussion forums at https://discuss.openedx.org where you can connect with others in the community.

Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace. Because this is a frontend repository, the best place to discuss it would be in the #wg-frontend channel_.

For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.

https://github.com/openedx/frontend-app-learner-portal-enterprise/issues

For more information about these options, see the Getting Help_ page.

.. _Slack invitation: https://openedx.org/slack .. _community Slack workspace: https://openedx.slack.com/ .. _#wg-frontend channel: https://openedx.slack.com/archives/C04BM6YC7A6 .. _Getting Help: https://openedx.org/community/connect

The Open edX Code of Conduct

All community members are expected to follow the Open edX Code of Conduct_.

.. _Open edX Code of Conduct: https://openedx.org/code-of-conduct/

Reporting Security Issues

Please do not report security issues in public. Please email [email protected].

frontend-app-learner-portal-enterprise's People

Contributors

adamstankiewicz avatar alex-sheehan-edx avatar bbaker6225 avatar bilaltahir21 avatar binodpant avatar brobro10000 avatar chavesj avatar edx-abolger avatar emrosarioa avatar feanil avatar hammadahmadwaqas avatar iloveagent57 avatar irfanuddinahmad avatar jajjibhai008 avatar johnnagro avatar katrinan029 avatar kellmarie avatar kiram15 avatar long74100 avatar mahamakifdar19 avatar manny-m avatar marlonkeating avatar muhammad-ammar avatar muneebgh avatar pwnage101 avatar renovate[bot] avatar saleem-latif avatar sameenfatima78 avatar taliaedx avatar zamanafzal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frontend-app-learner-portal-enterprise's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm react-instantsearch-dom Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency dayjs to v1.11.12
  • fix(deps): update dependency react-transition-group to v4.4.5
  • fix(deps): update dependency uuid to v9.0.1
  • chore(deps): update dependency @edx/browserslist-config to v1.2.0
  • chore(deps): update dependency @openedx/frontend-build to v13.1.4
  • chore(deps): update dependency @testing-library/jest-dom to v5.17.0
  • chore(deps): update dependency acorn to v8.12.1
  • chore(deps): update dependency axios-mock-adapter to v1.22.0
  • chore(deps): update dependency jest-canvas-mock to v2.5.2
  • chore(deps): update dependency prettier to v2.8.8
  • chore(deps): update tanstack-query monorepo (@tanstack/eslint-plugin-query, @tanstack/react-query, @tanstack/react-query-devtools)
  • fix(deps): update dependency @edx/frontend-component-footer to v13.2.0
  • fix(deps): update dependency algoliasearch to v4.24.0
  • fix(deps): update dependency classnames to v2.5.1
  • fix(deps): update dependency color to v3.2.1
  • fix(deps): update dependency dompurify to v2.5.6
  • fix(deps): update dependency formik to v2.4.6
  • fix(deps): update dependency plotly.js-dist to v2.34.0
  • fix(deps): update dependency prop-types to v15.8.1
  • fix(deps): update dependency react-instantsearch-dom to v6.40.4
  • fix(deps): update dependency react-parallax to v3.5.1
  • fix(deps): update dependency react-scroll to v1.9.0
  • fix(deps): update dependency redux to v4.2.1
  • fix(deps): update dependency video.js to v8.16.1
  • fix(deps): update react-router monorepo to v6.25.1 (react-router, react-router-dom)
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update dependency @openedx/frontend-build to v14
  • chore(deps): update dependency node to v20
  • chore(deps): update dependency prettier to v3
  • chore(deps): update tanstack-query monorepo to v5 (major) (@tanstack/eslint-plugin-query, @tanstack/react-query, @tanstack/react-query-devtools)
  • chore(deps): update testing-library monorepo (major) (@testing-library/jest-dom, @testing-library/react, @testing-library/react-hooks, @testing-library/user-event)
  • fix(deps): update dependency @edx/frontend-component-footer to v14
  • fix(deps): update dependency @edx/frontend-enterprise-hotjar to v7
  • fix(deps): update dependency @edx/frontend-enterprise-logistration to v9
  • fix(deps): update dependency @edx/frontend-enterprise-utils to v9
  • fix(deps): update dependency @edx/frontend-platform to v8
  • fix(deps): update dependency @openedx/paragon to v22
  • fix(deps): update dependency axios to v1
  • fix(deps): update dependency color to v4
  • fix(deps): update dependency dompurify to v3
  • fix(deps): update dependency iso-639-1 to v3
  • fix(deps): update dependency react-redux to v9
  • fix(deps): update dependency redux to v5
  • fix(deps): update dependency universal-cookie to v7
  • fix(deps): update dependency uuid to v10
  • 🔐 Create all rate-limited PRs at once 🔐

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/add-depr-ticket-to-depr-board.yml
.github/workflows/add-remove-label-on-comment.yml
.github/workflows/ci.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v4
.github/workflows/commitlint.yml
.github/workflows/coverage.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v4
.github/workflows/lockfileversion-check.yml
.github/workflows/self-assign-issue.yml
npm
package.json
  • @edx/brand 1.2.3
  • @edx/frontend-component-footer 13.0.2
  • @edx/frontend-enterprise-catalog-search 10.5.0
  • @edx/frontend-enterprise-hotjar 6.0.0
  • @edx/frontend-enterprise-logistration 8.0.0
  • @edx/frontend-enterprise-utils 8.0.0
  • @edx/frontend-platform 7.1.0
  • @edx/openedx-atlas 0.6.0
  • @edx/reactifex 2.2.0
  • @loadable/component 5.16.3
  • @lukemorales/query-key-factory 1.3.4
  • @openedx/paragon 21.13.1
  • @tanstack/react-query 4.28.0
  • @tanstack/react-query-devtools 4.29.0
  • accessible-nprogress 2.1.2
  • algoliasearch 4.6.0
  • axios 0.28.0
  • classnames 2.2.6
  • color 3.1.3
  • core-js 3.7.0
  • dayjs 1.11.10
  • dompurify 2.3.6
  • formik 2.2.9
  • history 4.10.1
  • iso-639-1 2.1.4
  • jest-localstorage-mock 2.4.26
  • lodash.camelcase 4.3.0
  • lodash.capitalize 4.2.1
  • lodash.clonedeep 4.5.0
  • lodash.debounce 4.0.8
  • lodash.isnil 4.0.0
  • plotly.js-dist 2.17.0
  • prop-types 15.7.2
  • react 17.0.2
  • react-dom 17.0.2
  • react-helmet 6.1.0
  • react-instantsearch-dom 6.38.1
  • react-parallax 3.3.0
  • react-redux 7.2.2
  • react-router 6.16.0
  • react-router-dom 6.16.0
  • react-router-hash-link 2.3.1
  • react-scroll 1.8.4
  • react-string-replace 1.1.1
  • react-transition-group 4.4.1
  • redux 4.0.5
  • universal-cookie 4.0.4
  • uuid 9.0.0
  • video.js 8.3.0
  • videojs-vjstranscribe ^1.0.3
  • videojs-youtube 3.0.1
  • @edx/browserslist-config 1.1.1
  • @faker-js/faker 8.4.1
  • @openedx/frontend-build 13.0.28
  • @tanstack/eslint-plugin-query 4.29.9
  • @testing-library/jest-dom 5.11.9
  • @testing-library/react 12.1.5
  • @testing-library/react-hooks 3.7.0
  • @testing-library/user-event 13.5.0
  • @wojtekmaj/enzyme-adapter-react-17 0.8.0
  • acorn 8.5.0
  • axios-mock-adapter 1.19.0
  • enzyme 3.11.0
  • jest-canvas-mock 2.4.0
  • jest-fetch-mock 3.0.3
  • jest-when 3.6.0
  • match-media-mock 0.1.1
  • mockdate 3.0.5
  • prettier 2.2.1
  • react-test-renderer 17.0.2
  • reactifex 1.1.1
  • resize-observer-polyfill 1.5.1
  • rosie 2.1.1
nvm
.nvmrc
  • node 18

  • Check this box to trigger a request for Renovate to run again on this repository

Upgrade React JS to v17

This repo is currently using React JS v16. We need to upgrade it to React 17 before moving to latest React version(v18).
React 17 doesn’t add any new developer-facing features, so its upgrade might not cause any breaking changes. Our end goal is to upgrade React to v18 but v18 no longer support enzyme, so we are upgrading to React 17 and then we’ll migrate from enzyme.

Epic Link

React 17 upgrade

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.