Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Gate itself remains **U7 / #170** until that PR lands — do not bypass it when
|------|--------|
| U3 CLI `--profile` + shared session polish | In PR (CLI `--managed`/`--no-managed`/`--profile`) |
| U4 Managed VFS / validation parity | Deferred |
| U5 Uninstall / purge GUI | Deferred |
| U5 Uninstall / purge GUI | In PR (context uninstall + Deployed badge; purge menu already shipped) |
| U6 Patcher provenance (ImmutableCheckpoint) | Deferred |
| U7 FOMOD gate (#170) + living-plan sync | Deferred (open PR) |
| U8 `modsync://` Phase 2 OS consume | Deferred |
Expand Down
26 changes: 22 additions & 4 deletions src/ModSync.GUI/Controls/ModListItem.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<!-- Main mod info (always visible) -->
<Grid x:Name="MainModInfo" Grid.Row="0" RowDefinitions="Auto,Auto">
<!-- Row 0: main info across 6 columns -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto,Auto,Auto,Auto">
<Grid Grid.Row="0" ColumnDefinitions="Auto,Auto,*,Auto,Auto,Auto,Auto,Auto">

<!-- Checkbox -->
<CheckBox
Expand Down Expand Up @@ -103,10 +103,28 @@
TextTrimming="CharacterEllipsis" />
</Border>

<!-- Managed deployment badge -->
<Border
x:Name="ManagedDeployedBadge"
Grid.Column="4"
Margin="4,0,4,0"
Padding="6,2"
VerticalAlignment="Top"
Classes="mod-list-item-badge"
CornerRadius="6"
IsVisible="False"
ToolTip.Tip="This mod has a managed deployment manifest for the active profile">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="Deployed"
TextTrimming="CharacterEllipsis" />
</Border>

<!-- Validation Status Icon -->
<TextBlock
x:Name="ValidationIcon"
Grid.Column="4"
Grid.Column="5"
Margin="4,0,8,0"
VerticalAlignment="Top"
FontSize="14"
Expand All @@ -115,7 +133,7 @@
<!-- Drag Handle (Editor Mode Only) -->
<TextBlock
x:Name="DragHandle"
Grid.Column="5"
Grid.Column="6"
VerticalAlignment="Center"
Classes="mod-list-item-drag-handle"
Cursor="Hand"
Expand All @@ -128,7 +146,7 @@
<!-- Download Button -->
<Button
x:Name="DownloadButton"
Grid.Column="6"
Grid.Column="7"
Width="24"
Height="24"
Margin="4,0,0,0"
Expand Down
13 changes: 13 additions & 0 deletions src/ModSync.GUI/Controls/ModListItem.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,22 @@ private void UpdateFromModManagementService()

UpdateValidationState(component);

UpdateManagedDeployedBadge(component);

ContextMenu = mainWindow.BuildContextMenuForComponent(component);
}

private void UpdateManagedDeployedBadge(ModComponent component)
{
Border badge = this.FindControl<Border>("ManagedDeployedBadge");
if (badge is null || component is null)
{
return;
}

badge.IsVisible = ManagedDeploymentActions.IsComponentDeployed(component.Guid);
}

private void UpdateEditorModeVisibility(bool isEditorMode)
{

Expand Down
19 changes: 19 additions & 0 deletions src/ModSync.GUI/Services/ManagedDeploymentActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,25 @@ await ManagedDeploymentLifecycle
}
}

/// <summary>
/// Returns whether a deployment manifest exists for <paramref name="componentGuid"/>
/// under the current managed profile (false in classic mode or on resolve errors).
/// </summary>
public static bool IsComponentDeployed(Guid componentGuid)
{
if (!TryResolveBackend(out IInstallBackend backend, out _, out _))
{
return false;
}

if (backend is ManagedDeploymentInstallBackend managed)
{
return managed.DeploymentService.TryGetManifest(componentGuid, out _);
}

return false;
}

private static bool TryResolveBackend(
out IInstallBackend backend,
out string error,
Expand Down
31 changes: 31 additions & 0 deletions src/ModSync.GUI/Services/MenuBuilderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,37 @@ public ContextMenu BuildContextMenuForComponent(
}),
});

if (ManagedDeploymentActions.IsComponentDeployed(component.Guid))
{
contextMenu.Items.Add(new Separator());
contextMenu.Items.Add(new MenuItem
{
Header = "Uninstall Managed Deployment",
Command = ReactiveCommand.CreateFromTask(async () =>
{
bool? confirmed = await ConfirmationDialog.ShowConfirmationDialogAsync(
_parentWindow,
confirmText:
$"Uninstall the managed deployment for '{component.Name}'?\n\n" +
"Vanilla backups will be restored where available.",
yesButtonText: "Uninstall",
noButtonText: "Cancel");
if (confirmed != true)
{
return;
}

(bool success, string message) = await ManagedDeploymentActions
.UninstallComponentAsync(component.Guid)
.ConfigureAwait(true);
await InformationDialog.ShowInformationDialogAsync(
_parentWindow,
message,
success ? "Uninstall complete" : "Uninstall failed");
}),
});
}

if (editorMode)
{
AddEditorModeMenuItems(contextMenu, component, setCurrentComponent, setTab, tabControl, guiEditTab, rawEditTab, onMoveRelative, onRemoveComponent, onInstallSingle);
Expand Down
Loading