Skip to content

Developers

HPO Curator is a tauri application with a Rust backend and an Angular front end.

The application makes major use of the following rust crates.

This page summarizes some of the angular and Rust/tauri commands that have been useful to create the application.

Initial setup

These steps were used to initialize the application and do not need to be repeated

npm create tauri@latest

The installer will ask questions about settings. We chose typescript, angular, npm.

Following this, run the following command.

npm install

Note that we are using standalone components.

Run the GUI application in development mode

npm run tauri dev

Creating new components

The standard command for creating a new component called <name> is

ng generate component <name> --standalone

You need to run the Angular CLI command from the root of your Angular project — the directory that contains the angular.json file. To create a component in a specific path, enter:

ng generate component components/hpoloader --standalone --skip-import

Note that this may not work after updating to nx. In this case, create a directory where you want to put the new component, cd into the directory, and enter this

npx nx generate @nx/angular:component hpoloader --standalone

This will initialize the typical four files for an angular component.

Added routing

ng add @angular/router

Angular material

To install

npm install @angular/material

Set up file system access

At the top level of the project, enter

npm install @tauri-apps/api

in the src-tauri folder, enter

cargo add tauri-plugin-fs

In the angular component, add

import { open } from '@tauri-apps/api/dialog';
import { readTextFile } from '@tauri-apps/api/fs';

Port issues

If one gets the error message: Port 1420 is already in use, then use the following command to obtain the process ID:

lsof -i :1420
COMMAND   PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    32315 <user>   49u  IPv4 0xd9cc1bb0104a525f      0t0  TCP localhost:timbuktu-srv4 (LISTEN)

then end the process with

kill -9 <PID>

Run in browser

Can be useful with the DevTools panel

npm run start

Problems with tauri.conf.json

Try to get the latest version

cargo install tauri-cli --locked
npm install @tauri-apps/cli@latest

generate a new file

cargo tauri init

file system (tauri v2)

npm run tauri add fs

npm run tauri add dialog

.