Skip to content

Conversation

@dominiquekleeven
Copy link
Collaborator

@dominiquekleeven dominiquekleeven commented Apr 8, 2025

Closes #14
Closes #9


Summary

This PR introduces the following changes:


REST API

ModelConfig Management Endpoints

  • Full CRUD support following REST Level 2 principles.
  • Tenancy-aware logic.
  • Request body validation using Pydantic.
  • External validation via OpenRemote when modifying/creating a config:
    • Verifies asset existence.
    • Validates realm correctness.

OpenRemote Utility Endpoints

  • Retrieve assets with datapoint attributes.
  • Retrieve assets by a list of IDs (for display in the overview).
  • Retrieve realm config (minimal schema with styling only).

UI Bundle Endpoint

  • Serves the built front-end bundle from the environment variable: ML_WEB_DIST_DIR
  • The bundle is served at /ui

afbeelding


Web UI Frontend

Note: Currently does not have localization! Still needs to be figured out how we want to handle this for services.

Tech Stack

  • LIT for extending OR components and building the pages.
  • Rspack as a modern Webpack alternative.
  • Vaadin Router for routing.
  • OpenRemote Web Components.

Pages

Model Configs Overview

  • Displays all model configs for the current realm.
  • Embedded in the WIP Services page of the Manager UI.

Model Configs Overview

Model Config Editor

  • Large form for creating or editing a model config.
  • Uses native HTML5 form validation.
  • Searchable dropdown for selecting valid assets.
  • Attribute dropdown updates dynamically based on selected asset.
  • Also embedded in the WIP Services page.

Model Config Editor


Bug Fixes

  • Fixed a bug where regressors with identical attribute names caused dataset creation to fail.

Other

  • Updated the CI workflow to include a quality check flow for the front-end, uses eslint and prettier.
  • Updated the Dockerfile to build the front-end and include it in the image, so that the back-end can serve it.
  • DIR Paths are now constants, and cannot be overriden by ENV.
  • Model files are now properly cleaned up after a config has been deleted.
  • Changed some of the default values for the prophet model configuration.
  • ML_WEBSERVER_ORIGINS was added to specify the allowed origins.
  • Added GZIP middleware to compress responses over 1kb in size

Testing

Automated (Back-End)

  • Tests added for:
    • ModelConfig CRUD endpoints.
    • OpenRemote utility endpoints.
    • Validation of request bodies.

image

Manual (Front-End)

  • Currently tested manually.
  • Uses OpenRemote components.
  • E2E testing could be added later if needed.

Local Testing Instructions

I've updated the README.md with additional setup instructions.

Things to make sure of:

  • Active OR instance (Demo Setup) is running locally
  • Create a service user with Super Admin permissions
  • Pass the credentials via the ML_OR_SERVICE_USER and ML_OR_SERVICE_SECRET environment variables.
    You can also create a .env file in the root directory
    image

And then just follow the README instructions for starting the back-end and front-end.


It is also deployed on test3 and is connected to the OR instance on test3 You can find it in the services page.


@dominiquekleeven
Copy link
Collaborator Author

dominiquekleeven commented Apr 28, 2025

Test3 is up to date with the changes from this PR. I've added a Services page to the Manager that loads the UI as an iframe from the service.

Notably test3 also includes changes from #30, but this doesn't change any of the functionality besides introducing protected endpoints/SSO auth

image
Services page with the iframe loaded

Copy link

@MartinaeyNL MartinaeyNL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've taken a look at your frontend code, and made a few remarks.
Feel free to check them out or ask for clarification 👍

Great work!

Changed `updated` lifecycle function calls to `willUpdate` to avoid double renders

Adjusted tsconfig.json to be more align with what `lit` recommends for publishing

Using `lit` directives instead of ternary operators

Comment improvements

Helper function for the api service to build the base url

Updated todo with corresponding issue annotation

Removed unnecessary div elements

Removed unecessary state decorators
@dominiquekleeven
Copy link
Collaborator Author

@MartinaeyNL Thanks for the review, appreciate it.

I've addressed all the requested changes, feel free to take a look again when you have the chance. Re-requested the review :)

@dominiquekleeven dominiquekleeven requested a review from wborn May 12, 2025 13:02
wborn
wborn previously approved these changes May 12, 2025
@MartinaeyNL
Copy link

I'll walk through the changes one more time. Give me a bit of time 😉

@MartinaeyNL
Copy link

Made 1 comment on the Rspack dependency. When addressed, the PR is OK to merge 👍

Everything still works, testing the bulding, environment variables and serving
@dominiquekleeven dominiquekleeven merged commit fe0e630 into main May 13, 2025
2 checks passed
@dominiquekleeven dominiquekleeven deleted the feature/configuration-ui branch May 13, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Development of new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Model Configuration REST API Endpoints Develop Configuration Web UI

4 participants