Import from internal git

This commit is contained in:
2025-10-11 13:08:09 +02:00
commit 97aaa715dc
175 changed files with 7014 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
@page "/details/{folder}/{specName}"
@using Generator.Controllers
@using WebServer.Components.Molecule
@using WebServer.Components.Organism
@using Core.SpecConfig
@using Core.Events
@rendermode InteractiveServer
<PageTitle>Details</PageTitle>
<h3>Details</h3>
<p>@SpecName</p>
@if (CanBeGenerated())
{
<div class="d-flex flex-row flex-wrap">
<div class="generation-box m-2">
<ActionCard Action="Generate">
<div class="bi bi-gear-fill"></div>
</ActionCard>
</div>
<div class="publish-box m-2">
<ActionCard Action="Publish">
<div class="bi bi-upload"></div>
</ActionCard>
</div>
</div>
}
<div class="d-flex flex-row">
<ContentViewer Language="yaml">
@GetSpecText()
</ContentViewer>
<div class="action-status">
@_actionState
</div>
</div>
@code {
[Inject] private AnalyzeController AnalyzeController { get; set; } = null!;
[Inject] private GenerationController GenerationController { get; set; } = null!;
[Inject] private PreGenerationController PreGenController { get; set; } = null!;
[Parameter] public string Folder{ get; set; } = null!;
[Parameter] public string SpecName{ get; set; } = null!;
private string? _actionState;
private DisplayEmitter _emitter = null!;
protected override void OnInitialized()
{
_emitter = GenerationController.Emitter;
_emitter.OnSay += DisplayState;
_emitter.OnWarn += DisplayState;
}
private async void DisplayState(object? sender, DisplayEventArgs e)
{
_actionState = e.Content;
await InvokeAsync(StateHasChanged);
}
private async void Generate()
{
_emitter.Say(this, "Starting generation..");
var process = PreGenController.ComputeGeneration(
$"{Folder}/{SpecName}", null, PublishType.No
);
await GenerationController.Launch(process);
_emitter.Say(this,"Generation completed");
}
private void Publish()
{
_emitter.Say(this, "Publishing not available at the moment");
}
private string GetSpecText() => AnalyzeController.GetSpecText(Folder, SpecName);
private bool CanBeGenerated() => AnalyzeController.CanBeGenerated(Folder, SpecName);
}
<style>
.action-status{
width: 300px;
height: 250px;
border: solid black;
border-radius: 4px;
word-wrap: break-word;
}
</style>

View File

@@ -0,0 +1,36 @@
@page "/Error"
@using System.Diagnostics
<PageTitle>Error</PageTitle>
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
@code{
[CascadingParameter] private HttpContext? HttpContext { get; set; }
private string? RequestId { get; set; }
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
}

View File

@@ -0,0 +1,7 @@
@page "/"
<PageTitle>Home</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.

View File

@@ -0,0 +1,14 @@
@page "/specifications"
@using WebServer.Components.Organism
@using Generator.Controllers
@rendermode InteractiveServer
<PageTitle>Specifications</PageTitle>
<h3>Specifications</h3>
<SpecList Data=Controller.ListSpecs().ToList()></SpecList>
@code {
[Inject] private AnalyzeController Controller { get; set; }
}