This repository contains source code for the front end of the Eduviewer
- Webpack 5.0
- Node 24+ (upgraded due to OpenSSL version change)
- Docker, if need to run/update e2e tests
To install the dependencies run:
npm install
npm run dev (HMR-enabled build)
The command starts webpack-dev-server on port 8080.
Development build uses public Eduviewer api https://od.helsinki.fi/eduviewer/ as backend.
Run cp .env--example .env and set USE_MOCKS=true to use mock data. If false, app calls the production backend.
npm run dist
This will build and optimize all frontend assets under dist to be served statically by the deployment server.
Webpack will ouput following different build files inside the dist folder:
- eduviewer.var.js
- eduviewer.commonjs2.js
- eduviewer.umd.js
- eduviewer.amd.js
Eduviewer frontend can be embedded to any web page using the following div tag:
<div id="eduviewer-root" module-code="CODE" academic-year="ACADEMIC_YEAR" only-selected-academic-year="true|false" lang="LANG" header="HEADER"></div>All attributes are optional.
langdefaults tofi, other valid values are:sv&enacademic-yeardefaults to the current academic year- Example
acedemic-yearexact values:hy-lv-68,hy-lv-69.
- Example
- If
module-codeordegree-program-idis set, embedded app won't show select for Degree Program - If
module-codeordegree-program-idis setonly-selected-academic-yeardetermines visibility of academic year dropdownhide-selections— hides the whole selection section, including academic year dropdown and select all switchhide-selected-academic-year— hides academic year title but not the select all switchonly-selected-academic-year(DEPRECATED),selected-academic-year-only— if either attribute is set totrue, hides academic year dropdown if it exists and is not explicitly set to false- IMPORTANT: use
selected-academic-year-onlyin React components, as React treats attributes starting withonas event handler attributes.
- IMPORTANT: use
hide-accordion(DEPRECATED),skip-title— if either attribute is set totrue, hides the root module title, showing only the module contentinternal-course-links— sets course links as internal, removing the arrow marking an external link
module-codeordegree-program-idis the code of degree program set in Sisu. Valid examples:KH10_001,MH30_004- If
headerisn't set, Eduviewer page won't have a h2 header on top of selects
You'll also need to include the following script tag at the end of your page's body tag:
<script src="address/to/eduviewer.var.js"></script>- To run e2e tests, run
npm run test:e2e - To update e2e snapshot images, run
npm run test:e2e:update
The stage is QA or PROD. This makes it possible to have different SSL files for different stages. The "keys" ssl.crt and ssl.key become file names since these are mounted as files. They must match what is specified in nginx.conf.template. Also the path in nginx.conf.template must match the path specified in the deployments pod specs volume mount.
# or delete + create if it already exists or apply if you make a secret manifest.
oc create secret generic ssl-secret-$STAGE \
--from-file=TLS_KEY=./ssl.key \
--from-file=TLS_CERTIFICATE=./ssl.crt \
--from-file=TLS_CA_CERTIFICATE=./ssl_ca.crt
GPL-3.0