|
| 1 | +# Service Account Manager |
| 2 | + |
| 3 | +**This application is still under development!** |
| 4 | + |
| 5 | +A React + Vite application for managing service account users. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- Node.js |
| 10 | +- npm |
| 11 | +- Access to a SystemLink environment |
| 12 | +- A SystemLink API key (for local development through the API proxy) |
| 13 | + |
| 14 | +## Why a local proxy is required |
| 15 | + |
| 16 | +When running this app locally, browser requests to SystemLink API domains are |
| 17 | +blocked by CORS. Use the API Service Proxy to forward requests from localhost to |
| 18 | +your SystemLink API server. |
| 19 | + |
| 20 | +## Run Locally |
| 21 | + |
| 22 | +### 1. Start the API proxy |
| 23 | + |
| 24 | +From `examples/Web Apps/Dev Tools/ApiServiceProxy`: |
| 25 | + |
| 26 | +```bash |
| 27 | +npm ci |
| 28 | +``` |
| 29 | + |
| 30 | +Create `proxyConfig.js` from `proxyConfig.example.js`, then set: |
| 31 | + |
| 32 | +- SystemLink API URL (for example, `https://demo-api.lifecyclesolutions.ni.com`) |
| 33 | +- API key |
| 34 | + |
| 35 | +Start proxy: |
| 36 | + |
| 37 | +```bash |
| 38 | +npm run start |
| 39 | +``` |
| 40 | + |
| 41 | +The proxy runs at `http://localhost:4000`. |
| 42 | + |
| 43 | +### 2. Configure this app for local development |
| 44 | + |
| 45 | +In this project folder (`ServiceHealthDashboard`), `.env.development` should |
| 46 | +point to the proxy: |
| 47 | + |
| 48 | +```bash |
| 49 | +VITE_SYSTEMLINK_SERVER_URL=http://localhost:4000/apiProxy |
| 50 | +``` |
| 51 | + |
| 52 | +This value is already configured in the repo. |
| 53 | + |
| 54 | +### 3. Install and run the app |
| 55 | + |
| 56 | +From `examples/Web Applications/Framework Examples/React/ServiceHealthDashboard`: |
| 57 | + |
| 58 | +```bash |
| 59 | +npm ci |
| 60 | +npm run dev |
| 61 | +``` |
| 62 | + |
| 63 | +Open the URL printed by Vite (typically `http://localhost:5173`). |
| 64 | + |
| 65 | +## Useful Commands |
| 66 | + |
| 67 | +From this project folder: |
| 68 | + |
| 69 | +```bash |
| 70 | +npm run dev # Start dev server |
| 71 | +npm run build # Build production assets into dist/ |
| 72 | +npm run preview # Preview the production build locally |
| 73 | +npm run lint # Run ESLint |
| 74 | +npm run lint:fix # Run ESLint and auto-fix issues |
| 75 | +``` |
| 76 | + |
| 77 | +## Deployment using the SystemLink CLI |
| 78 | + |
| 79 | +Prereq: |
| 80 | +**[Install](https://github.com/ni-kismet/systemlink-cli?tab=readme-ov-file#installation)** |
| 81 | +the SystemLink CLI to your machine and |
| 82 | +**[login](https://github.com/ni-kismet/systemlink-cli?tab=readme-ov-file#installation)** |
| 83 | +to the CLI. |
| 84 | + |
| 85 | +1. `cd` into the project folder and run `npm run build` to create `dist/` folder |
| 86 | +2. Create .nipkg file using `slcli webapp pack dist/` |
| 87 | +3. Publish the webapp with |
| 88 | + `slcli webapp publish dist.nipkg --name NAME --workspace WORKSPACE`. Specify |
| 89 | + the webapp NAME and the user WORKSPACE |
| 90 | +4. After any changes are made, repack the webapp (step 2) and update the webapp |
| 91 | + with `slcli webapp publish dist.nipkg --id ID`. (Use `slcli webapp list` to |
| 92 | + get the ID) |
| 93 | + |
| 94 | +For more details on |
| 95 | +[WebApp Management](https://github.com/ni-kismet/systemlink-cli?tab=readme-ov-file#installation) |
| 96 | +see the SL-CLI docs |
0 commit comments