fix: uniform elevation banners across all admin-required pages#504
Conversation
📝 WalkthroughWalkthroughThe PR introduces elevation-state tracking to the application. ChangesElevation State and UI Implementation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@SysManager/SysManager/ViewModels/ServicesViewModel.cs`:
- Around line 45-50: RelaunchElevated only handles the success case and leaves
users uninformed when AdminHelper.RelaunchAsAdmin() returns false; modify
RelaunchElevated to add an else branch that sets the view model's StatusMessage
(or similar existing status property) to a clear failure/cancel message when
RelaunchAsAdmin() returns false so users receive explicit feedback about the
canceled/failed elevation attempt; reference the RelaunchElevated method, the
AdminHelper.RelaunchAsAdmin() call, and the StatusMessage property when making
the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0e355daf-2fdf-47e2-973f-cc172122f700
📒 Files selected for processing (6)
SysManager/SysManager/ViewModels/ServicesViewModel.csSysManager/SysManager/Views/DnsHostsView.xamlSysManager/SysManager/Views/PrivacyView.xamlSysManager/SysManager/Views/ServicesView.xamlSysManager/SysManager/Views/WindowsFeaturesView.xamlSysManager/SysManager/Views/WindowsUpdateView.xaml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build & unit tests
- GitHub Check: Analyze (csharp)
🔇 Additional comments (7)
SysManager/SysManager/ViewModels/ServicesViewModel.cs (1)
28-42: LGTM!SysManager/SysManager/Views/DnsHostsView.xaml (2)
43-51: LGTM!
30-33: Elevation bindings match view-model members (IsElevated+ relaunch commands).DnsHostsViewModel (and the other updated admin page view-models) expose
IsElevatedvia[ObservableProperty] private bool _isElevated;, and the bound commands match:RelaunchElevatedCommandcomes from[RelayCommand] private void RelaunchElevated(), while WindowsUpdate/Cleanup/AppUpdates useRelaunchAsAdminCommandfrom[RelayCommand] private void RelaunchAsAdmin().SysManager/SysManager/Views/PrivacyView.xaml (1)
51-75: LGTM!SysManager/SysManager/Views/ServicesView.xaml (1)
14-18: LGTM!Also applies to: 50-77, 151-151
SysManager/SysManager/Views/WindowsFeaturesView.xaml (1)
57-81: LGTM!SysManager/SysManager/Views/WindowsUpdateView.xaml (1)
38-62: LGTM!
| [RelayCommand] | ||
| private void RelaunchElevated() | ||
| { | ||
| if (AdminHelper.RelaunchAsAdmin()) | ||
| System.Windows.Application.Current?.Shutdown(); | ||
| } |
There was a problem hiding this comment.
Add explicit feedback when elevation relaunch does not succeed.
At Line 48, only the success path is handled. If UAC is canceled or relaunch fails, users get no status update. Set a failure/cancel StatusMessage in the else path so the button outcome is clear.
Suggested patch
[RelayCommand]
private void RelaunchElevated()
{
if (AdminHelper.RelaunchAsAdmin())
System.Windows.Application.Current?.Shutdown();
+ else
+ StatusMessage = "Elevation request canceled or failed.";
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [RelayCommand] | |
| private void RelaunchElevated() | |
| { | |
| if (AdminHelper.RelaunchAsAdmin()) | |
| System.Windows.Application.Current?.Shutdown(); | |
| } | |
| [RelayCommand] | |
| private void RelaunchElevated() | |
| { | |
| if (AdminHelper.RelaunchAsAdmin()) | |
| System.Windows.Application.Current?.Shutdown(); | |
| else | |
| StatusMessage = "Elevation request canceled or failed."; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@SysManager/SysManager/ViewModels/ServicesViewModel.cs` around lines 45 - 50,
RelaunchElevated only handles the success case and leaves users uninformed when
AdminHelper.RelaunchAsAdmin() returns false; modify RelaunchElevated to add an
else branch that sets the view model's StatusMessage (or similar existing status
property) to a clear failure/cancel message when RelaunchAsAdmin() returns false
so users receive explicit feedback about the canceled/failed elevation attempt;
reference the RelaunchElevated method, the AdminHelper.RelaunchAsAdmin() call,
and the StatusMessage property when making the change.
Summary
Replaces all inconsistent elevation UI with a single uniform design across 5 pages.
Design:
Pages updated:
Elevated state messages:
Test plan
Summary by CodeRabbit
Release Notes