LittleLittleCloud / StepWise

A code-first workflow engine build with typescript and C#
https://littlelittlecloud.github.io/StepWise/
MIT License
86 stars 3 forks source link

[WebUI] Add a web ui to show workflow and running status #3

Closed LittleLittleCloud closed 2 months ago

LittleLittleCloud commented 2 months ago

Add a stepwise webui to allow user interact with stepwise workflow

Usage

Code

// Create a web host running on 5123 port
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using StepWise.Core;
using StepWise.WebAPI;

var host = Host.CreateDefaultBuilder()
    //.UseEnvironment("Development")
    .ConfigureWebHostDefaults(webBuilder =>
    {
        webBuilder.UseUrls("http://localhost:5123");
    })
    .UseStepWiseServer()
    .Build();

await host.StartAsync();

var stepWiseClient = host.Services.GetRequiredService<StepWiseClient>();

var helloWorldWorkflow = Workflow.CreateFromInstance(new HelloWorld());
var loopWorkflow = Workflow.CreateFromInstance(new Loop());
var cumulativeWorkflow = Workflow.CreateFromInstance(new Cumulative());

stepWiseClient.AddWorkflow(helloWorldWorkflow);
stepWiseClient.AddWorkflow(loopWorkflow);
stepWiseClient.AddWorkflow(cumulativeWorkflow);
stepWiseClient.AddWorkflow(Workflow.CreateFromInstance(new PrepareDinner()));

// Wait for the host to shutdown
await host.WaitForShutdownAsync();

This will start a web ui at localhost 127.0.0.1:5123

Web UI

image