Skip to content

Commit b4c2b06

Browse files
authored
merge rmf-auth into dashboard (#985)
Signed-off-by: Teo Koon Peng <[email protected]>
1 parent 9a250d4 commit b4c2b06

39 files changed

+207
-1765
lines changed

.github/workflows/dashboard.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
- '.github/workflows/dashboard.yml'
66
- 'packages/dashboard/**'
77
- 'packages/react-components/**'
8-
- 'packages/rmf-auth/**'
98
- 'packages/rmf-models/**'
109
- 'packages/api-client/**'
1110
push:

.github/workflows/rmf-auth.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Nightly](https://github.com/open-rmf/rmf-web/actions/workflows/nightly.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/nightly.yml) [![Dashboard End-to-End](https://github.com/open-rmf/rmf-web/actions/workflows/dashboard-e2e.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/dashboard-e2e.yml) [![react-components](https://github.com/open-rmf/rmf-web/workflows/react-components/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Areact-components+branch%3Amain) [![dashboard](https://github.com/open-rmf/rmf-web/workflows/dashboard/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Adashboard+branch%3Amain) [![api-server](https://github.com/open-rmf/rmf-web/workflows/api-server/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Aapi-server+branch%3Amain) [![rmf-auth](https://github.com/open-rmf/rmf-web/actions/workflows/rmf-auth.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/rmf-auth.yml) [![ros-translator](https://github.com/open-rmf/rmf-web/actions/workflows/ros-translator.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/ros-translator.yml) [![api-client](https://github.com/open-rmf/rmf-web/actions/workflows/api-client.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/api-client.yml) [![codecov](https://codecov.io/gh/open-rmf/rmf-web/branch/main/graph/badge.svg)](https://codecov.io/gh/open-rmf/rmf-web)
1+
[![Nightly](https://github.com/open-rmf/rmf-web/actions/workflows/nightly.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/nightly.yml) [![Dashboard End-to-End](https://github.com/open-rmf/rmf-web/actions/workflows/dashboard-e2e.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/dashboard-e2e.yml) [![react-components](https://github.com/open-rmf/rmf-web/workflows/react-components/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Areact-components+branch%3Amain) [![dashboard](https://github.com/open-rmf/rmf-web/workflows/dashboard/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Adashboard+branch%3Amain) [![api-server](https://github.com/open-rmf/rmf-web/workflows/api-server/badge.svg)](https://github.com/open-rmf/rmf-web/actions?query=workflow%3Aapi-server+branch%3Amain) [![ros-translator](https://github.com/open-rmf/rmf-web/actions/workflows/ros-translator.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/ros-translator.yml) [![api-client](https://github.com/open-rmf/rmf-web/actions/workflows/api-client.yml/badge.svg)](https://github.com/open-rmf/rmf-web/actions/workflows/api-client.yml) [![codecov](https://codecov.io/gh/open-rmf/rmf-web/branch/main/graph/badge.svg)](https://codecov.io/gh/open-rmf/rmf-web)
22

33
# RMF Web
44

@@ -21,12 +21,14 @@ Open-RMF Web is a collection of packages that provide a web-based interface for
2121
We currently support [Ubuntu 24.04](https://releases.ubuntu.com/noble/), [ROS 2 Jazzy](https://docs.ros.org/en/jazzy/index.html) and Open-RMF's [22.09](https://github.com/open-rmf/rmf/releases/tag/22.09) release. Other distributions may work as well, but is not guaranteed.
2222

2323
Install pnpm and nodejs
24+
2425
```bash
2526
curl -fsSL https://get.pnpm.io/install.sh | bash -
2627
pnpm env use --global lts
2728
```
2829

2930
For Debian/Ubuntu systems,
31+
3032
```bash
3133
sudo apt install python3-pip python3-venv
3234
```
@@ -35,26 +37,29 @@ sudo apt install python3-pip python3-venv
3537

3638
Refer to the following documentation for either building from source or installing released binaries:
3739

38-
* [rmf](https://github.com/open-rmf/rmf)
40+
- [rmf](https://github.com/open-rmf/rmf)
3941

4042
> **Note**
4143
> Simulation demos are not part of the released binaries, and therefore a built workspace with at least the [demos repository](https://github.com/open-rmf/rmf_demos) would be required for trying out the web dashboard with simulation.
4244
4345
### Install dependencies
4446

4547
Run
48+
4649
```bash
4750
pnpm install
4851
```
4952

5053
You may also install dependencies for only a subset of the packages
54+
5155
```bash
5256
pnpm install -w --filter <package>...
5357
```
5458

5559
### Launching
5660

5761
Source Open-RMF and launch the dashboard in development mode,
62+
5863
```bash
5964
# For binary installation
6065
source /opt/ros/jazzy/setup.bash
@@ -117,27 +122,27 @@ pnpm run start
117122

118123
# Contribution guide
119124

120-
* For general contribution guidelines, see [CONTRIBUTING](CONTRIBUTING.md).
121-
* Follow [typescript guidelines](https://basarat.gitbook.io/typescript/styleguide).
122-
* When introducing a new feature or component in [`react-components`](packages/react-components), write tests and stories.
123-
* When introducing a new feature in [`dashboard`](packages/dashboard), write tests as well as [e2e](packages/dashboard-e2e) test whenever possible.
124-
* When introducing API changes with [`api-server`](packages/api-server),
125-
* If the new changes are to be used externally (outside of the web packages, with other Open-RMF packages for example), make changes to [`rmf_api_msgs`](https://github.com/open-rmf/rmf_api_msgs), before generating the required models using [this script](packages/api-server/generate-models.sh) with modified commit hashes.
126-
* Don't forget to update the API client with the newly added changes with [these instructions](packages/api-client/README.md/#generating-rest-api-client).
127-
* Check out the latest API definitions [here](https://open-rmf.github.io/rmf-web/), or visit `/docs` relative to your running server's url, e.g. `http://localhost:8000/docs`.
128-
* Develop the frontend without launching any Open-RMF components using [storybook](packages/dashboard/README.md/#storybook).
129-
* For integration with new devices/infrastructure, check out [Robot Interaction Objects (RIO)](https://github.com/open-rmf/rmf-web/wiki/Robot-Interaction-Objects-(RIO)).
130-
* Update documentation alongside development, and update the [`ros2multirobotbook`](https://osrf.github.io/ros2multirobotbook) where necessary.
125+
- For general contribution guidelines, see [CONTRIBUTING](CONTRIBUTING.md).
126+
- Follow [typescript guidelines](https://basarat.gitbook.io/typescript/styleguide).
127+
- When introducing a new feature or component in [`react-components`](packages/react-components), write tests and stories.
128+
- When introducing a new feature in [`dashboard`](packages/dashboard), write tests as well as [e2e](packages/dashboard-e2e) test whenever possible.
129+
- When introducing API changes with [`api-server`](packages/api-server),
130+
- If the new changes are to be used externally (outside of the web packages, with other Open-RMF packages for example), make changes to [`rmf_api_msgs`](https://github.com/open-rmf/rmf_api_msgs), before generating the required models using [this script](packages/api-server/generate-models.sh) with modified commit hashes.
131+
- Don't forget to update the API client with the newly added changes with [these instructions](packages/api-client/README.md/#generating-rest-api-client).
132+
- Check out the latest API definitions [here](https://open-rmf.github.io/rmf-web/), or visit `/docs` relative to your running server's url, e.g. `http://localhost:8000/docs`.
133+
- Develop the frontend without launching any Open-RMF components using [storybook](packages/dashboard/README.md/#storybook).
134+
- For integration with new devices/infrastructure, check out [Robot Interaction Objects (RIO)](<https://github.com/open-rmf/rmf-web/wiki/Robot-Interaction-Objects-(RIO)>).
135+
- Update documentation alongside development, and update the [`ros2multirobotbook`](https://osrf.github.io/ros2multirobotbook) where necessary.
131136

132137
# Configuration
133138

134-
* See the [rmf-dashboard](packages/dashboard/README.md#configuration) docs for the frontend build-time and run-time configurations.
135-
* See the [api-server](packages/api-server/README.md#configuration) docs for API server run-time configurations.
139+
- See the [rmf-dashboard](packages/dashboard/README.md#configuration) docs for the frontend build-time and run-time configurations.
140+
- See the [api-server](packages/api-server/README.md#configuration) docs for API server run-time configurations.
136141

137142
# Troubleshooting
138143

139-
* If a feature is missing or is not working, it could be only available in an Open-RMF source build, and not in the binaries. Try building Open-RMF from source and source that new workspace before launching the API server. `rmf-web` may use in-development features of Open-RMF.
144+
- If a feature is missing or is not working, it could be only available in an Open-RMF source build, and not in the binaries. Try building Open-RMF from source and source that new workspace before launching the API server. `rmf-web` may use in-development features of Open-RMF.
140145

141-
* Creating tasks from the web dashboard when running a simulated Open-RMF deployment will require the task start time suit simulation time, which starts from unix millis 0. Try creating the same task with a start date of before the year of 1970.
146+
- Creating tasks from the web dashboard when running a simulated Open-RMF deployment will require the task start time suit simulation time, which starts from unix millis 0. Try creating the same task with a start date of before the year of 1970.
142147

143-
* Check if the issue has already been [reported or fixed](https://github.com/open-rmf/rmf-web/issues).
148+
- Check if the issue has already been [reported or fixed](https://github.com/open-rmf/rmf-web/issues).

codecov.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ flags:
1515
paths:
1616
- packages/api-server
1717
carryforward: true
18-
rmf-auth:
19-
paths:
20-
- packages/rmf-auth
21-
carryforward: true

packages/dashboard/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"debug": "^4.2.0",
4343
"eventemitter3": "^4.0.7",
4444
"jsdom": "^24.1.1",
45+
"keycloak-js": "^25.0.2",
4546
"react": "^18.2.0",
4647
"react-components": "workspace:*",
4748
"react-dom": "^18.2.0",
4849
"react-error-boundary": "^4.0.13",
4950
"react-grid-layout": "^1.3.4",
5051
"react-router": "^6.14.1",
5152
"react-router-dom": "^6.14.1",
52-
"rmf-auth": "workspace:*",
5353
"rmf-models": "workspace:*",
5454
"rxjs": "^7.5.5",
5555
"three": "^0.166.1"
@@ -66,11 +66,13 @@
6666
"@testing-library/dom": "^9.3.4",
6767
"@testing-library/react": "^14.2.2",
6868
"@testing-library/user-event": "^14.5.2",
69+
"@types/history": "^5.0.0",
6970
"@vitejs/plugin-react-swc": "^3.7.0",
7071
"@vitest/coverage-v8": "^2.0.4",
7172
"api-server": "file:../api-server",
7273
"concurrently": "^8.2.2",
7374
"eslint": "^8.57.0",
75+
"history": "^5.3.0",
7476
"storybook": "^8.0.5",
7577
"typescript": "~5.4.3",
7678
"vite": "^5.3.5",

packages/dashboard/src/app-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import { getDefaultTaskDefinition, TaskDefinition } from 'react-components';
3-
import { Authenticator, KeycloakAuthenticator, StubAuthenticator } from 'rmf-auth';
43

54
import appConfigJson from '../app-config.json';
5+
import { Authenticator, KeycloakAuthenticator, StubAuthenticator } from './auth';
66
import { BasePath } from './util/url';
77

88
export interface RobotResource {

packages/dashboard/src/auth/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export * from './authenticator';
2+
export * from './keycloak';
3+
export * from './login-card';
4+
export * from './login-page';
5+
export * from './private-route';
6+
export * from './stub';
7+
export * from './user-profile';

packages/rmf-auth/lib/keycloak.ts renamed to packages/dashboard/src/auth/keycloak.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Debug from 'debug';
22
import EventEmitter from 'eventemitter3';
3-
import Keycloak, { KeycloakInstance } from 'keycloak-js';
3+
import Keycloak from 'keycloak-js';
44

55
import { Authenticator, AuthenticatorEventType } from './authenticator';
66

@@ -31,7 +31,7 @@ export class KeycloakAuthenticator
3131
*/
3232
constructor(config: Keycloak.KeycloakConfig | string, silentCheckSsoRedirectUri?: string) {
3333
super();
34-
this._inst = Keycloak(config);
34+
this._inst = new Keycloak(config);
3535
this._silentCheckSsoRedirectUri = silentCheckSsoRedirectUri;
3636
}
3737

@@ -118,7 +118,7 @@ export class KeycloakAuthenticator
118118
}
119119

120120
private _initialized = false;
121-
private _inst: KeycloakInstance;
121+
private _inst: Keycloak;
122122
private _silentCheckSsoRedirectUri?: string;
123123
private _user?: string;
124124
private _isAdmin = false;

0 commit comments

Comments
 (0)