Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
951 stars 197 forks source link

⭐ [Enhancement]: Configuration Editor (UI) #2361

Open JerryNixon opened 2 months ago

JerryNixon commented 2 months ago

What is it?

A UI designed to create, view & edit a dab-config.json file.

Why?

The configuration file is getting more complex, easier to get wrong.

Where?

As part of the dotnet tool install process.

How?

The configurator is a Blazor Server app. This is the same approach as the .NET Aspire dashboard. To host a Blazor Server app within a command-line console app (such as how Data API builder's CLI might host a configurator UI), simply use Kestrel, the web server that comes with ASP.NET Core which DAB already uses.

Basic flow:

  1. Configure WebHostBuilder inside the CLI to serve Blazor.
  2. When the CLI starts, spin up Kestrel, which serves Blazor.
  3. The CLI launches the browser to open the configurator.

Server Blazor

Blazor Server uses a persistent SignalR connection to handle UI interactions. UI events (like button clicks) are sent to the server, processed there, and the resulting changes are returned in real time. All app logic, event handling, data binding, and the component lifecycle are managed in C#, allowing you to write both client-side and server-side logic in C#. This eliminates the need for most JavaScript in web development. If needed, JavaScript interop allows optional integration with JavaScript libraries or browser APIs. Razor syntax (HTML + C#) renders dynamic content, and Blazor Server fully supports HTML and CSS, including CSS frameworks (like Bootstrap) and CSS isolation for scoped styling.

File system access

Blazor Server can access local files on the server-side because the app runs on the server. You can use C#'s standard file I/O operations (System.IO) to read, write, or modify files on the server where the Blazor Server app is hosted.

How to launch

From the CLI: dab edit -c dab-config.json

Requirements

  1. Cross-platform
  2. Browser-based (starting with Edge)
  3. Development-only, no authentication
  4. No prerequisites other than dotnet tools microsoft.dataapibuilder
  5. Support environment variables

Features

  1. Add additional data-sources
  2. Add entities from data-source
  3. Visualize relationships
  4. Visualize dab validate
  5. Generate Cosmos schema

Use Cases

Role Feature Purpose
Developer Get started from scratch Create a configuration file and set up entities array.
Developer Add an additional data source Introduce and manage a new data source.
Developer Add entities from database Add more entities to the configuration array.
Developer Validate entities in configuration Verify entities and relationships in the configuration.
Developer Update existing entity Modify an existing entity’s properties or relationships.
Developer Remove an entity Safely remove an entity from the configuration.
Developer Edit runtime settings Adjust performance, caching, or other runtime configurations.
Developer Manage authentication and authorization Configure security settings like authentication providers and role-based access.
Developer Rollback configuration changes Revert to fields or files to default values.

Questions

Related issues that will be closed

JerryNixon commented 1 month ago

Does the dab tool ship the ASP.NET Core runtime? I think it must.