|
352 | 352 | </button> |
353 | 353 | @if (tweakStatus?.IsManuallyDeployed != true) |
354 | 354 | { |
355 | | - <button class="btn btn-sm btn-danger" @onclick="() => RemoveTweak(def.Id)" disabled="@(_removingTweakId == def.Id || _deployingTweakId == def.Id)"> |
| 355 | + <button class="btn btn-sm btn-danger" @onclick="() => ShowRemoveConfirmation(def.Id)" disabled="@(_removingTweakId == def.Id || _deployingTweakId == def.Id)"> |
356 | 356 | @if (_removingTweakId == def.Id) |
357 | 357 | { |
358 | 358 | <span class="spinner spinner-sm"></span> |
|
399 | 399 | <button class="btn btn-sm btn-secondary" @onclick="RefreshStatus" disabled="@_isLoading"> |
400 | 400 | Check Status |
401 | 401 | </button> |
402 | | - <button class="btn btn-sm btn-danger" @onclick="() => RemoveTweak(def.Id)" disabled="@(_deployingTweakId == def.Id)"> |
403 | | - Remove |
| 402 | + <button class="btn btn-sm btn-danger" @onclick="() => ShowRemoveConfirmation(def.Id)" disabled="@(_removingTweakId == def.Id || _deployingTweakId == def.Id)"> |
| 403 | + @if (_removingTweakId == def.Id) |
| 404 | + { |
| 405 | + <span class="spinner spinner-sm"></span> |
| 406 | + <span>Removing...</span> |
| 407 | + } |
| 408 | + else |
| 409 | + { |
| 410 | + <span>Remove</span> |
| 411 | + } |
404 | 412 | </button> |
405 | 413 | } |
406 | 414 | </div> |
|
462 | 470 | </div> |
463 | 471 | } |
464 | 472 |
|
| 473 | +<!-- Remove Confirmation Modal --> |
| 474 | +@if (_showRemoveConfirm && _pendingRemoveTweakId != null) |
| 475 | +{ |
| 476 | + var removeDef = _tweakDefs.FirstOrDefault(d => d.Id == _pendingRemoveTweakId); |
| 477 | + <div class="pt-modal-overlay" @onclick="CancelRemove"> |
| 478 | + <div class="pt-modal" @onclick:stopPropagation="true"> |
| 479 | + <div class="pt-modal-header"> |
| 480 | + <h3>Confirm Removal</h3> |
| 481 | + </div> |
| 482 | + <div class="pt-modal-body"> |
| 483 | + <p>Are you sure you want to remove <strong>@(removeDef?.Title ?? _pendingRemoveTweakId)</strong>? This will delete the boot script and reverse the tweak's changes on your gateway.</p> |
| 484 | + @if (_pendingRemoveTweakId == "mongodb-ssd") |
| 485 | + { |
| 486 | + <div class="alert alert-warning" style="margin-top: 0.75rem;"> |
| 487 | + <strong>Note:</strong> Removal will briefly stop UniFi Network while migrating MongoDB data back from SSD to eMMC, then restart it. |
| 488 | + </div> |
| 489 | + } |
| 490 | + </div> |
| 491 | + <div class="pt-modal-footer"> |
| 492 | + <button class="btn btn-secondary btn-sm" @onclick="CancelRemove">Cancel</button> |
| 493 | + <button class="btn btn-danger btn-sm" @onclick="ConfirmRemove"> |
| 494 | + Confirm Remove |
| 495 | + </button> |
| 496 | + </div> |
| 497 | + </div> |
| 498 | + </div> |
| 499 | +} |
| 500 | + |
465 | 501 | <style> |
466 | 502 | .pt-container { |
467 | 503 | display: flex; |
|
755 | 791 | private bool _confirmBackupDownloaded; |
756 | 792 | private bool _confirmWarranty; |
757 | 793 | private bool _confirmRisk; |
| 794 | + private bool _showRemoveConfirm; |
| 795 | + private string? _pendingRemoveTweakId; |
758 | 796 | private bool _allConfirmed => _confirmBackup && _confirmBackupDownloaded && _confirmWarranty && _confirmRisk; |
759 | 797 | private bool _canDeploy => _status?.UdmBootInstalled == true && _status?.FirmwareSupported == true; |
760 | 798 | private List<string> _deploySteps = new(); |
|
873 | 911 | _pendingDeployTweakId = null; |
874 | 912 | } |
875 | 913 |
|
| 914 | + private void ShowRemoveConfirmation(string tweakId) |
| 915 | + { |
| 916 | + _pendingRemoveTweakId = tweakId; |
| 917 | + _showRemoveConfirm = true; |
| 918 | + } |
| 919 | + |
| 920 | + private async Task ConfirmRemove() |
| 921 | + { |
| 922 | + _showRemoveConfirm = false; |
| 923 | + if (_pendingRemoveTweakId != null) |
| 924 | + await RemoveTweak(_pendingRemoveTweakId); |
| 925 | + _pendingRemoveTweakId = null; |
| 926 | + } |
| 927 | + |
| 928 | + private void CancelRemove() |
| 929 | + { |
| 930 | + _showRemoveConfirm = false; |
| 931 | + _pendingRemoveTweakId = null; |
| 932 | + } |
| 933 | + |
876 | 934 | private async Task DeployTweak(string tweakId) |
877 | 935 | { |
878 | 936 | _deployingTweakId = tweakId; |
|
0 commit comments