101 lines
2.5 KiB
Plaintext
101 lines
2.5 KiB
Plaintext
@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> |