Add Deploy/Redeploy button and fix actor replacement on redeployment
Instances page gains Deploy button that triggers flattening pipeline and sends config to site. Button shows "Redeploy" when instance is stale. Fixed actor name collision on redeployment by scheduling deferred recreation after Context.Stop.
This commit is contained in:
@@ -165,6 +165,9 @@
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-outline-primary btn-sm py-0 px-1 me-1"
|
||||
@onclick="() => DeployInstance(inst)" disabled="@_actionInProgress"
|
||||
title="Flatten template and send config to site">@(isStale ? "Redeploy" : "Deploy")</button>
|
||||
@if (inst.State == InstanceState.Enabled)
|
||||
{
|
||||
<button class="btn btn-outline-warning btn-sm py-0 px-1 me-1"
|
||||
@@ -383,6 +386,30 @@
|
||||
_actionInProgress = false;
|
||||
}
|
||||
|
||||
private async Task DeployInstance(Instance inst)
|
||||
{
|
||||
_actionInProgress = true;
|
||||
try
|
||||
{
|
||||
var user = "system";
|
||||
var result = await DeploymentService.DeployInstanceAsync(inst.Id, user);
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
_toast.ShowSuccess($"Instance '{inst.UniqueName}' deployed (revision {result.Value.RevisionHash?[..8]}).");
|
||||
await LoadDataAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
_toast.ShowError($"Deploy failed: {result.Error}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_toast.ShowError($"Deploy failed: {ex.Message}");
|
||||
}
|
||||
_actionInProgress = false;
|
||||
}
|
||||
|
||||
private async Task DeleteInstance(Instance inst)
|
||||
{
|
||||
var confirmed = await _confirmDialog.ShowAsync(
|
||||
|
||||
@@ -180,9 +180,14 @@ public class DeploymentManagerActor : ReceiveActor, IWithTimers
|
||||
{
|
||||
Context.Stop(existing);
|
||||
_instanceActors.Remove(instanceName);
|
||||
// Wait for the child to be removed from the children collection
|
||||
// by yielding and retrying — Context.Stop is processed before the next message
|
||||
Context.System.Scheduler.ScheduleTellOnce(
|
||||
TimeSpan.FromMilliseconds(500), Self, command, Sender);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the Instance Actor immediately
|
||||
// Create the Instance Actor immediately (no existing actor to replace)
|
||||
CreateInstanceActor(instanceName, command.FlattenedConfigurationJson);
|
||||
|
||||
// Persist to SQLite and clear static overrides asynchronously
|
||||
|
||||
Reference in New Issue
Block a user