This repository provides the Angular applications that provide the web front-ends to the NIST Public Data Repository (PDR) and related tools. The PDR is developed and operated as part of the NIST Open Access to Research (OAR) program. The specific applications provided include:
- pdr-lps -- the PDR Landing Page Service (LPS)
- midas-author -- an application for creating a new non-literature digital asset (e.g. data, software) publication with two parts: a creation wizard and an editor.
- pdr-rpa -- application for managing requests for requests for restricted public data with two parts: one used by public users to request access (pdr-rpa-approve) and one used by internal users to approve requests.
As software based on the the Angular application framework, the code is written primarily in Typescript.
pdr-lps --> the Angular project directory for the pdr-lps app
midas-author --> contains Angular project directories for the two parts of the DAPTool
pdr-rpa --> contains Angular project directories for the two parts of RPA app
oar-lps --> contains Angular library project, oarlps, containing common code used by the
above applications
scripts/ --> Tools for running the demonstrations and running all tests
oar-build/ --> general oar build system support (do not customize)
docker/ --> Docker containers for building and running tests
.github/ --> GitHub repository configuration, including CI scripts for GitHub Actions
CODEOWNERS --> A listing of contacts, administrators, and contributors for this repository
LICENSE.md --> A statement of rights and responsibilities for use and copying of this software
Software in this repository is built using the Angular application framework
(v13), and, thus, is built and run using nodejs and npm. Both become available to your
development environment when you install,
- node 18.20.0 or higher
All prerequisite Javascript modules needed are provided via the npm build tool. See
package.json for a listing of primary dependencies and package-lock.json for a
complete listing of all dependencies.
As an alternative to explicitly installing prerequisites to run the tests, the docker directory
contains scripts for building a Docker container with all prerequites installed in a properly
configured environment. Running the docker/run.sh script will build the containers (caching them
locally), start the container, and put the user in a bash shell in the container. From there, one
can run applications or tests.
The scripts directory also includes scripts that will launch Docker containers to build the
software (makedist.docker) and run tests (testall.docker).
To use these scripts and containers, Docker must be installed separately.
As a standard OAR repository, it includes simple language-independent tools for building and testing the software without special knowledge of Typescript or Angular (assuming all prerequisites have been installed first); these are described in the section "Simple Building and Testing with OAR Tools".
Developers, on the other hand, primarily use the native tools (npm) to build and test as described
in "Building and Testing Using Native Tools".
As a standard OAR repository, the software products can be built by simply via the makedist
script, assuming the prerequisites are installed:
scripts/makedist
The built products will be written into the dist subdirectory (created by the makedist); each
will be written into a zip-formatted file with a name formed from the product name and a version
string.
The individual products can be built separately by specifying the product name as arguments, e.g:
scripts/makedist pdr-lps
scripts/makedist midas-author
Additional options are available; use the -h option to view the details:
scripts/makedist -h
The testall script can be used to execute all unit and integration tests:
scripts/testall
Like with makedist, you can run the tests for the different products separately by listing the
desired product names as arguments to testall. Running testall -h will explain available
command-line options.
The npm tool can be used in the standard way for Angular projects to
build and test this software.
Detail commands and instructions:
-
Clone this repository and update Angular library
After clone the repository, do the following:
cd oar-pdr-angular
git submodule update --init --recursive
cd lib
git checkout integration
Now lib folder should have the latest code of oar-lib-angular.
-
Install packages
Go to root folder, switch to initial-portal-setup02 branch, then do npm install:
Note: make sure your npm version is 7.0.0 or higher. Use npm -v to check your version.
If not, run npm install -g npm@latest.
cd ..
git checkout feature/add-lps-lib
npm i --legacy-peer-deps
- Build and run your application
You can build Angular library and your application separately or with one command.
To build Angular library:
npm run build-lib
Yo build local Angular library:
npm run build-oarlps
To build and run wizard:
npm run build-sw
npm run start-sw
To build MIDAS publishing UI application:
npm run build-midaslps
npm run start-midaslps
To build public landing page:
npm run build-pdrlps
npm run start-pdrlps
- Testing your app locally
Wizard:
http://localhost:4200
Publishing UI: Set the following flags in environment.ts: useMetadataService: false useCustomizationService: false
editEnabled: true
http://localhost:4202/od/id/test1?editEnabled=true
Public landing page: Set the following flags in environment.ts: useMetadataService: false useCustomizationService: false
editEnabled: false
http://localhost:4201/od/id/test1
As described above, the testall script will run all unit tests for all applications and
libraries in this repo (as well as for individual components). This script runs the tests via
npm scripts defined in the package.json file. For example, to run the tests for the
oarlps library, type:
npm run test:oarlps
The following script names run tests for individual components:
test:oarlps -- run tests in the oarlps library
test:pdrlps -- run tests in the pdr-lps application
test:wizard -- run tests in the midas-author wizard application
test:midasauthor -- run tests in the midas-author lps application
test:pdr-rpa-request -- run tests in the pdr-rpa request application
test:pdr-rpa-approve -- run tests in the pdr-rpa approve application
To restrict the test execution to just one .spec.ts file, add the file name (without a path
or .ts extension) to the npm command line:
npm run test:oarlps nerdm.service.spec
Test debugging can be accomplished via the node interpreter's "inspect"
feature. Before starting the
debugger, one normally sets an initial breakpoint by inserting a debugger; line
into the "spec" file. Then, to execute the test in debug mode, one uses a command of
this form:
node --inspect-brk node_modules/.bin/jest --runInBand --config path-to-jest-config spec-file
For example,
node --inspect-brk node_modules/.bin/jest --runInBand --config oar-lps/libs/oarlps/jest.config.js nerdm.service.spec
(The .ts extension on the spec-file is optional.)
The node interpreter, after starting, will pause to wait for a debugger to connect. Different debugger clients are supported, including the Chrome browser and VisualStudio. To debug using Chrome,
- Start the Chrome browser
- Navigate to "chrome://inspect"; if node is waiting, this page will show an "inspect" link at the bottom.
- Click "inspect" link; this will open the Chrome's developer tool window open to the debugger.
- Click the play button to execute until the first
debugger;line is reached.
From there, use the Chrome debugger features to set additional breakpoints as needed.
Please see LICENSE.md for the current licensing statements. Software in this
repository is open-source and held in the public domain.
The administrators of this repository include:
- Gretchen Greene ([email protected])
- Jon Zhang ([email protected])
- Ray Plante ([email protected])
- Christopher David ([email protected])