Skip to content

CLOSER-Cohorts/dashboard

Repository files navigation

Dashboard

There are several dashboards in this application, which are used to perform different types of checks on the data and identify the following issues before deploying to production:

Installation

  • Rename ecosystem.config.dist to ecosystem.config.js.
  • Update the value of the COLECTICA_REPOSITORY_HOSTNAME environment variable with the name of a server that hosts the Colectica Repository. This environment variable is used to construct the URL for the REST API that the dashboard queries in order to retrieve data from the Colectica Repository.

Running the application locally

Before running either a dev or production instance of the Dashboard, type: npm i

To run a dev instance of the Dashboard, modify package.json by setting the value of the COLECTICA_REPOSITORY_HOSTNAME environment variable set in the 'dev' entry under the 'scripts' section to the hostname of the Colectica repository your Dashboard instance will be querying (e.g. type the following in the root directory of the dashboard application code:

npm run dev

To run a production instance of the Dashboard, type the following in the root directory of the dashboard application code:

npm run build
npm run start

Note that Node.js has different option settings for development and production instances; running a production instance in the above fashion just means running a local instance of the Dashboard with the Node.js options settings for a production environment. It does not deploy and run the Dashboard on a remote production environment.

Whether running a dev or production instance locally, the application can be viewed at http://localhost:3000. Note that this is not the same URL path for accessing the dashboard on the staging environment (which has /dashboard at the end).

Running the dashboard as a service on a Windows server

startDashboard.bat contains commands used to run the dashboard as a service on a Windows server. The details for how to set up a Windows server to host a NodeJS based application like the Dashboard are on the CLOSER Discovery Team wiki.

Using the application

Login to the application using your discovery.closer.ac.uk username and password.

Setting up data collection scripts for dashboards

Some dashboards don't query the Colectica repository and display the results on loading, but instead display information contained in files that are periodically updated. The dashboard pages for missing/incomplete relationships between items (pages/missingIncorrectRelationships) and for items with topic-related issues (pages/topicIssues) are populated with data from files in the data directory. The files in this directory are generated by lib/pollRepository.mjs and lib/findItemsWithTopicIssues.mjs. These files need to be created in advance of users looking at pages/topicIssues and pages/missingIncorrectRelationships because the queries that retrieve this data are long-running (at the time of writing, up to a couple of hours), and can't be executed dynamically whenever a user views these dashboards.

In order for the code that generates the files in the data directory to function, the lib/pollRepository.mjs, lib/findItemsWithTopicIssues.mjs and package.json files need to be modified after they are checked out. The login credentials for an account with the 'Guest' (i.e. read-only) role on a Colectica repository and the hostname of that repository need to be manually entered in the code; these details are too sensitive to store in a public repository.

The 'poll' and 'findTopicIssues' entries in the 'scripts' section of the package.json file need to be modified so the COLECTICA_REPOSITORY_HOSTNAME environment variable is set to the hostname of the Colectica repository that is being polled. The following line at the top of the lib/pollRepository.mjs and lib/findItemsWithTopicIssues.mjs files needs to be updated with the login details of a user with the 'Guest' role on the Colectica repository that is being polled:

const tokenObject = await getToken("user", "password", process.env.COLECTICA_REPOSITORY_HOSTNAME)

Running the jest tests

npm i
npm run test

About

A dashboard for viewing CLOSER data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •