Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openedx/frontend-app-admin-portal…
Browse files Browse the repository at this point in the history
… into Ali-Abbas/react-router-upgrade
  • Loading branch information
Syed-Ali-Abbas-Zaidi committed Jan 8, 2024
2 parents aaff242 + c6e3a3f commit 64b95cb
Show file tree
Hide file tree
Showing 385 changed files with 45,632 additions and 37,720 deletions.
7 changes: 7 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
APP_ID='admin-portal'
NODE_ENV='development'
BASE_URL='http://localhost:1991'
LMS_BASE_URL='http://localhost:18000'
Expand All @@ -17,6 +18,7 @@ ENTERPRISE_LEARNER_PORTAL_URL='http://localhost:8734'
ENTERPRISE_SUPPORT_URL='https://edx.org'
ENTERPRISE_SUPPORT_REVOKE_LICENSE_URL='https://edx.org'
ENTERPRISE_SUPPORT_PROGRAM_OPTIMIZATION_URL='https://edx.org'
ENTERPRISE_SUPPORT_LEARNER_CREDIT_URL='https://edx.org'
SEGMENT_KEY=''
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
USER_INFO_COOKIE_NAME='edx-user-info'
Expand All @@ -40,6 +42,8 @@ FEATURE_SETTINGS_PAGE_LMS_TAB='true'
FEATURE_SETTINGS_PAGE_APPEARANCE_TAB='true'
FEATURE_LEARNER_CREDIT_MANAGEMENT='true'
FEATURE_CONTENT_HIGHLIGHTS='true'
FEATURE_API_CREDENTIALS_TAB='true'
FEATURE_SSO_SETTINGS_TAB='true'
HOTJAR_APP_ID=''
HOTJAR_VERSION='6'
HOTJAR_DEBUG=''
Expand All @@ -50,3 +54,6 @@ MAINTENANCE_ALERT_START_TIMESTAMP=''
USE_API_CACHE='true'
SUBSCRIPTION_LPR='true'
PLOTLY_SERVER_URL='http://localhost:8050'
AUTH0_SELF_SERVICE_INTEGRATION='true'
MFE_CONFIG_API_URL='http://localhost:18000/api/mfe_config/v1'
DEMO_ENTEPRISE_UUID='set a valid enterprise uuid'
116 changes: 116 additions & 0 deletions .env.development-stage
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# App Specific

# Note: The Algolia APP_ID and SEARCH_API_KEY are secret and must be configured via `.env.private`.
ALGOLIA_APP_ID=""
ALGOLIA_SEARCH_API_KEY=""

BASE_URL="https://localhost.stage.edx.org:1991"
LICENSE_MANAGER_BASE_URL="https://license-manager.stage.edx.org"
ENTERPRISE_ACCESS_BASE_URL="https://enterprise-access.stage.edx.org"
ENTERPRISE_CATALOG_BASE_URL="https://enterprise-catalog.stage.edx.org"
ENTERPRISE_SUBSIDY_BASE_URL="https://enterprise-subsidy.stage.edx.org"
DISCOVERY_BASE_URL="https://discovery.stage.edx.org"
PLOTLY_SERVER_URL="https://enterprise-dash.edx.org/admin-analytics/"
SEGMENT_KEY=""
NEW_RELIC_AGENT_ID=""
NEW_RELIC_APP_ID=""
ALGOLIA_INDEX_NAME="enterprise_catalog_new"
FEATURE_PROGRAM_TITLES_FACET='true'
FEATURE_LANGUAGE_FACET='true'
FEATURE_CODE_MANAGEMENT='true'
FEATURE_REPORTING_CONFIGURATIONS='true'
FEATURE_ANALYTICS='true'
FEATURE_SUPPORT='true'
FEATURE_SAML_CONFIGURATION=''
FEATURE_CODE_VISIBILITY='true'
FEATURE_EXTERNAL_LMS_CONFIGURATION=''
FEATURE_BULK_ENROLLMENT='true'
FEATURE_FILE_ATTACHMENT='true'
FEATURE_SETTINGS_PAGE='true'
FEATURE_SETTINGS_PAGE_LMS_TAB='true'
FEATURE_SETTINGS_PAGE_APPEARANCE_TAB='true'
FEATURE_LEARNER_CREDIT_MANAGEMENT='true'
FEATURE_CONTENT_HIGHLIGHTS='true'
FEATURE_AUTH0_SELF_SERVICE_INTEGRATION='false'
HOTJAR_DEBUG=''
HOTJAR_APP_ID=''
FEATURE_SSO_SETTINGS_TAB='true'
FEATURE_API_CREDENTIALS_TAB='true'
FEATURE_PENDING_ENROLLMENT_ACTIONS='false'
# maintenance alert
IS_MAINTENANCE_ALERT_ENABLED=''
MAINTENANCE_ALERT_MESSAGE='edX is currently in a brief maintenance window. Functionality involving course enrollments is unavailable at this time, including enrollment and assignment. Please check back shortly to continue the learning journey.'
MAINTENANCE_ALERT_START_TIMESTAMP=''

# Common

LMS_BASE_URL="https://courses.stage.edx.org"
STUDIO_BASE_URL="https://studio.stage.edx.org"
DATA_API_BASE_URL="https://analyticsapi.stage.edx.org"
ECOMMERCE_BASE_URL="https://ecommerce.stage.edx.org"
DISCOVERY_API_BASE_URL="https://discovery.stage.edx.org"
PUBLISHER_BASE_URL="https://publisher.stage.edx.org/"
CREDENTIALS_BASE_URL="https://credentials.stage.edx.org"
ENTERPRISE_CATALOG_API_BASE_URL="https://enterprise-catalog.stage.edx.org"
INSIGHTS_BASE_URL="https://stage-insights.edx.org"
LEARNING_BASE_URL="https://learning.stage.edx.org"
LOGIN_URL="https://courses.stage.edx.org/login"
LOGOUT_URL="https://courses.stage.edx.org/logout"
MARKETING_SITE_BASE_URL="https://stage.edx.org"
ORDER_HISTORY_URL="https://orders.stage.edx.org/orders"
ENTERPRISE_MARKETING_URL="https://business.edx.org"
REGISTRAR_API_BASE_URL="https://registrar.stage.edx.org/api"
OPTIMIZELY_PROJECT_ID="1706490390"
ENTERPRISE_LEARNER_PORTAL_HOSTNAME="enterprise.stage.edx.org"
ENTERPRISE_LEARNER_PORTAL_URL="https://enterprise.stage.edx.org"
DEMOGRAPHICS_BASE_URL="https://demographics.stage.edx.org"
EXAMS_BASE_URL="https://edx-exams.stage.edx.org"
ACCOUNT_SETTINGS_URL="https://account.stage.edx.org"
ACCOUNT_PROFILE_URL="https://profile.stage.edx.org"
SUPPORT_URL="https://support.edx.org"
ENTERPRISE_SUPPORT_URL="https://business-support.edx.org/hc/en-us"
ENTERPRISE_SUPPORT_PROGRAM_OPTIMIZATION_URL="https://business.edx.org/hubfs/Onboarding%20and%20Engagement/Onboarding%20Assets/Admin%20Resources/Program%20Optimization.pdf?hsLang=en"
ENTERPRISE_SUPPORT_LEARNER_CREDIT_URL='http://stage.edx.org'
CONTACT_URL="https://courses.stage.edx.org/support/contact_us"
OPEN_SOURCE_URL="https://open.edx.org"
TERMS_OF_SERVICE_URL="https://stage.edx.org/edx-terms-service"
PRIVACY_POLICY_URL="https://stage.edx.org/edx-privacy-policy"
SPANISH_PRIVACY_POLICY_URL="https://stage.edx.org/es/edx-privacy-policy"
SEARCH_CATALOG_URL="https://stage.edx.org/search"
FACEBOOK_URL="https://www.facebook.com/edX"
TWITTER_URL="https://twitter.com/edXOnline"
YOU_TUBE_URL="https://www.youtube.com/user/edxonline"
LINKED_IN_URL="https://www.linkedin.com/school/edx/"
GOOGLE_PLUS_URL="https://plus.google.com/+edXOnline"
REDDIT_URL="https://www.reddit.com/r/edx"
APPLE_APP_STORE_URL="https://itunes.apple.com/us/app/edx/id945480667?mt=8"
GOOGLE_PLAY_URL="https://play.google.com/store/apps/details?id=org.edx.mobile"
ENTERPRISE_SUPPORT_REVOKE_LICENSE_URL="https://business-support.edx.org/hc/en-us/articles/4409008473495"
LANGUAGE_PREFERENCE_COOKIE_NAME="stage-edx-language-preference"
NEW_RELIC_ACCOUNT_ID=""
NEW_RELIC_LICENSE_KEY=""
NEW_RELIC_TRUST_KEY=""
ACCESS_TOKEN_COOKIE_NAME="stage-edx-jwt-cookie-header-payload"
USER_INFO_COOKIE_NAME="stage-edx-user-info"
REFRESH_ACCESS_TOKEN_ENDPOINT="https://courses.stage.edx.org/login_refresh"
CSRF_TOKEN_API_PATH="/csrf/api/v1/token"
SITE_NAME="edX"
FAVICON_URL="https://edx-cdn.org/v3/stage/favicon.ico"
LOGO_TRADEMARK_URL="https://edx-cdn.org/v3/stage/logo-trademark.svg"
LOGO_TRADEMARK_URL_PNG="https://edx-cdn.org/v3/stage/logo-trademark.png"
LOGO_TRADEMARK_URL_SVG="https://edx-cdn.org/v3/stage/logo-trademark.svg"
LOGO_URL="https://edx-cdn.org/v3/stage/logo.svg"
LOGO_URL_PNG="https://edx-cdn.org/v3/stage/logo.png"
LOGO_URL_SVG="https://edx-cdn.org/v3/stage/logo.svg"
LOGO_WHITE_URL="https://edx-cdn.org/v3/stage/logo-white.svg"
LOGO_WHITE_URL_PNG="https://edx-cdn.org/v3/stage/logo-white.png"
LOGO_WHITE_URL_SVG="https://edx-cdn.org/v3/stage/logo-white.svg"
LOGO_POWERED_BY_OPEN_EDX_URL="https://edx-cdn.org/v3/stage/open-edx-tag.png"
LOGO_POWERED_BY_OPEN_EDX_URL_PNG="https://edx-cdn.org/v3/stage/open-edx-tag.png"
LOGO_POWERED_BY_OPEN_EDX_URL_SVG="https://edx-cdn.org/v3/stage/open-edx-tag.svg"
HOTJAR_VERSION=6
SESSION_COOKIE_DOMAIN=".stage.edx.org"

# Cookie Policy Banner
COOKIE_POLICY_BANNER_VIEWED_NAME="edx-cookie-policy-viewed"
MARKETING_SITE_NAME="edx.org"
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ FEATURE_FILE_ATTACHMENT='true'
ENTERPRISE_SUPPORT_URL = ''
ENTERPRISE_SUPPORT_REVOKE_LICENSE_URL = ''
PLOTLY_SERVER_URL='http://localhost:8050'
DEMO_ENTEPRISE_UUID='set a valid enterprise uuid'
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ config.overrides = [
]
}
},
{
files: ['*.test.js', '*.test.jsx'],
rules: {
'react/prop-types': 'off',
'react/jsx-no-constructed-context-values': 'off',
},
},
];


Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node: [16]
npm: [8.5.x]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm@${{ matrix.npm }}
node-version: ${{ env.NODE_VER }}
- name: Validate no uncommitted package-lock changes
run: make validate-no-uncommitted-package-lock-changes
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lockfileversion-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ on:

jobs:
version-check:
uses: edx/.github/.github/workflows/lockfileversion-check.yml@master
uses: openedx/.github/.github/workflows/lockfileversion-check-v3.yml@master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dist/

# emacs
*~
.projectile

# edx
.env.private
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
82 changes: 81 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
![Build Status](https://github.com/openedx/frontend-app-admin-portal/actions/workflows/ci.yml/badge.svg)
![Codecov](https://codecov.io/gh/edx/frontend-app-admin-portal/branch/master/graph/badge.svg)

## Overview
# Purpose
frontend-app-admin-portal is a frontend that provides branded learning experiences as well as a dashboard for enterprise learning administrators.

# Getting Started

## Setting up a dev environment

### The Short Story
Expand Down Expand Up @@ -101,3 +103,81 @@ module.exports = {
```

NB: In order for webpack to properly resolve scss imports locally, you must use a `~` before the import, like so: `@import "~@edx/brand/paragon/fonts";`

### Running tests

You can run all tests as follows:
```
nvm use
npm install
npm run test
```

Additionally, you can run a single test file with
```
npm run test -- ProvisioningFormSubmissionButton.test.jsx
```

or run a given test function by appending a `.only` to the test function (or appending `.skip` to do the inverse).
For example: `test.only('your test function', () => {...})`.

You can use watch mode with tests as follows:
```
npm run test:watch BudgetDetailPage.test.jsx
# or to skip coverage reporting
npm run test:watch-no-cov BudgetDetailpage.test.jsx
```
Note the watcher has its own set of commands to help run test functions that match a regex (`t my regex`), etc.
Use the `w` command to get a list of valid watch commands.

## 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-admin-portal/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

## 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.

## 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/

## License

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

Please see `LICENSE <LICENSE>`_ for details.

## Reporting Security Issues

Please do not report security issues in public. Please email [email protected].
9 changes: 7 additions & 2 deletions __mocks__/react-instantsearch-dom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ const advertised_course_run = {
start: '2020-09-09T04:00:00Z',
key: 'course-v1:edX+Bee101+3T2020',
};
const mockNormalizedData = {
start_date: '2020-09-09T04:00:00Z',
end_date: '2021-09-09T04:00:00Z',
enroll_by_date: '2020-09-15T04:00:00Z',
};

/* eslint-disable camelcase */
const fakeHits = [
{ objectID: '1', aggregation_key: 'course:Bees101', title: 'bla', advertised_course_run, key: 'Bees101' },
{ objectID: '2', aggregation_key: 'course:Wasps200', title: 'blp', advertised_course_run, key: 'Wasps200' },
{ objectID: '1', aggregation_key: 'course:Bees101', title: 'bla', partners: [{ name: 'edX' }, { name: 'another_unused' }], advertised_course_run, key: 'Bees101', normalized_metadata: mockNormalizedData },
{ objectID: '2', aggregation_key: 'course:Wasps200', title: 'blp', partners: [{ name: 'edX' }, { name: 'another_unused' }], advertised_course_run, key: 'Wasps200', normalized_metadata: mockNormalizedData },
];
/* eslint-enable camelcase */

Expand Down
6 changes: 0 additions & 6 deletions babel.config.js

This file was deleted.

46 changes: 46 additions & 0 deletions docs/decisions/0005-moment-to-dayjs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
5. Replacing Moment.js library with Day.js
============================================================

Status
******

In progress

Context
*******

Moment.js is a widely used time and date library, but the creators have decided to make it a legacy project that no
longer fixes bugs or adds new features. Because of this, and because of the large size that the Moment.js package takes up
(4.23 MB according to npm and the minified size is 6.3KB), we are choosing to replace all instances of Moment.js
in our enterprise repositories.

Decisions
*********

In its stead, we are choosing to replace this library with the Day.js project. This is one of the projects that were
explicitly recommended from the Moment.js team as a recommended alternative. Out of the box, it supports basic usage,
and additional plugins have been identified based on a look through our current usages of Moment.js in our codebase.
The plugins that we will need to add are Duration, UTC, and Timezone, with more possibilities available for future use.

Day.js also has almost identical functions to Moment, and was definitely created with this in mind. So most files will
just need to replace the package name and nothing else

``moment(date).format('MMMM D, YYYY') -> dayjs(date).format('MMMM D, YYYY')``

Consequences
************

By choosing Day.js over another, larger library like date-fns, we sacrifice more of the out of the box functionality
that comes from having a bigger library. Also, day.js does not support tree-shaking like the date-fns library does.
However, by only installing needed plugins and starting from a much smaller package size, Day.js will considerably
decrease the JS bundle size while still maintaining the core functionality.

Alternatives Considered
***********************

date-fns
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Date-fns has a 162.1 kB bundle size compared to 6.4 kB of day.js bundle. Since the majority of the functionality
we are using with these libraries is basic, and the intended goal is to ultimately decrease the bundle size,
opting for the more lightweight library was the preferred path forward.
Loading

0 comments on commit 64b95cb

Please sign in to comment.