asynqmon/ui
2022-03-02 06:34:45 -08:00
..
build Update ui build 2022-03-02 06:34:45 -08:00
public Add concept of Flag values under window object to ensure values are 2022-03-02 06:34:45 -08:00
src Use logo image 2022-03-02 06:34:45 -08:00
.gitignore Serve both UI assets and REST API from handler 2021-10-12 15:35:56 -07:00
package.json Install dayjs 2021-12-19 16:09:16 -08:00
README.md Add README and LICENSE files 2021-01-30 19:18:44 -08:00
tsconfig.json Show orphaned status in active task table 2022-03-02 06:34:45 -08:00
yarn.lock Install dayjs 2021-12-19 16:09:16 -08:00

Working with the React UI

This file explains how to work with Asynqmon UI.

Introduction

The Asynqmon UI was bootstrapped using Create React App, a popular toolkit for generating React application setups. You can find general information about Create React App on their documentation site.

Instead of plain JavaScript, we use TypeScript to ensure typed code.

Development environment

To work with the React UI code, you will need to have the following tools installed:

NOTE: When using Visual Studio Code, be sure to open the ui/ directory in the editor instead of the root of the repository. This way, the right ESLint and TypeScript configuration will be picked up from the React workspace.

Installing npm dependencies

The React UI depends on a large number of npm packages. These are not checked in, so you will need to download and install them locally via the Yarn package manager:

yarn

Yarn consults the package.json and yarn.lock files for dependencies to install. It creates a node_modules directory with all installed dependencies.

NOTE: Remember to change directory to ui/ before running this command and the following commands.

Running a local development server

You can start a development server for the React UI outside of a running Asynqmon server by running:

yarn start

This will open a browser window with the React app running on http://localhost:3000/. The page will reload if you make edits to the source code. You will also see any lint errors in the console.

Building the app for production

To build a production-optimized version of the React app to a build subdirectory, run:

yarn build

NOTE: You will likely not need to do this directly. Instead, this is taken care of by the build target in the main Asynqmon Makefile when building the full binary.

Integration into Asynqmon

To build a Asynqmon binary that includes a compiled-in version of the production build of the React app, change to the root of the repository and run:

make build

This installs npm dependencies via Yarn, builds a production build of the React app, and then finally compiles in all web assets into the Asynqmon binary.