This project contains a React web application subproject that submits sequences, and a backend service that read them from configuration. See README files for each of these subprojects for details on build, run, etc.
Important: Keycloak and the Config Service reset on every
csw-servicesrestart. Steps 2, 3, and 7 must be repeated each time.
csw-services start --location --auth --config --event --databaseMust be run after every csw-services restart and before starting the ESW Gateway.
cd ~/Desktop/Prototyping/aps-submitter-prototype
./scripts/setup-tmt-auth.shExpected output:
==> Getting admin token...
OK
==> Creating tmt-backend-app client...
OK
==> Getting tmt-frontend-app client UUID...
OK (UUID: ...)
==> Adding tmt-backend-app audience mapper to tmt-frontend-app...
OK
==> Getting esw-user1 user ID...
OK (UUID: ...)
==> Getting aps-user role ID...
OK (UUID: ...)
==> Assigning aps-user role to esw-user1...
OK
Auth setup complete. You can now start the ESW Gateway.
cat > /tmp/command-role-mapping.conf << 'EOF'
APS.primary.startSequence: [aps-user]
EOF
esw-gateway-server start -p 8090 -l -c /tmp/command-role-mapping.confcd ~/Desktop/Prototyping/aps-sequencer-prototype
sbt "runner/run sequencer -s APS -n primary -m APS_software_only_mode"cd ~/Desktop/Prototyping/aps-submitter-prototype/apssubmitterprototype-backend
source ~/.zshrc
sbt "run start --port 8084"cd ~/Desktop/Prototyping/aps-submitter-prototype/apssubmitterprototype-frontend
npm startMust be run after every csw-services restart (Config Service resets too).
python3 -c "
import json
source = 'APS.sequenceSubmitter'
matrix = [[0.0] * 3 for _ in range(492)]
actuatorOffsets = {
'FloatMatrixKey': {
'keyName': 'actuatorOffsets',
'values': [matrix],
'units': 'millimeter'
}
}
sequence = [
{'_type': 'Setup', 'source': source, 'commandName': 'calc-colorstep', 'paramSet': []},
{'_type': 'Setup', 'source': source, 'commandName': 'cmd-m1cs-moves', 'paramSet': [actuatorOffsets]},
{'_type': 'Setup', 'source': source, 'commandName': 'calc-tt-offsets-to-acts', 'paramSet': []},
{'_type': 'Setup', 'source': source, 'commandName': 'calc-decompose-acts', 'paramSet': []}
]
print(json.dumps(sequence, indent=2))
" > ~/aps-sequence.json
cs launch csw-config-cli -- login
cs launch csw-config-cli -- create /aps/sequences/testmode.json \
--in ~/aps-sequence.json \
--comment "APS software-only mode test sequence"- Open
http://localhost:3000 - Log in with
esw-user1/esw-user1 - Enter config path:
/aps/sequences/testmode.json - Click Load Template
- Click Submit Sequence
Expected response:
{
"_type": "Completed",
"runId": "...",
"result": { "paramSet": [] }
}- The Keycloak admin UI at
http://localhost:8081only shows themasterrealm. The TMT realm must be managed via the API — thesetup-tmt-auth.shscript handles this. - Predefined TMT realm users (password = username):
esw-user1,config-admin1,config-user1,iris-user1,tcs-user1,wfos-user1 - The Config Service resets on
csw-servicesrestart — sequence files must be re-uploaded each time. - Why
tmt-backend-appmust be created manually: the ESW Gateway'sapplication.confreferences this client for token validation, but the embedded Keycloak fromcsw-servicesdoes not include it by default. This appears to be a gap in the development tooling.
The project has following structure:
.
├── src
│ ├── assets
│ ├── components
│ ├── config
│ ├── contexts
│ ├── hooks
│ ├── models
│ ├── routes
│ ├── utils
├── test
├── typesassets: This directory contains all the files (images, audio etc) that are used by the UI component.components: This directory contain all the components created for this UI application.config: This contain the application specific configurations.contexts: This contain contexts like LocationServiceContext to pass and share data to nested react conponents.hooks: This contain helper hooks.useAuth.tsxThis file contain auth related helper hooks and exposes login, logout and auth constants.useQuery.tsxThis file contain hooks to query data asynchronous and expose other constants like loading, error to track query state.
routes: This contain route related files.Routes.tsxThis file uses react-router to describe frontend routes for this application.ProtectedRoute.tsxThis file contain auth protected frontend routes.
utils: This contain common utilities.Http.tshas generic helper functions written over fetch API to do GET, POST requests.api.tsThis file usesHttp.tsand provide application specific functions to do POST requests.resolveBackend.tsThis file contain helper function to resolve location of backend using location service.
test: This directory contains all the tests for the UI application.types: This directory contains all the types that needs to be imported externally for UI application.