Skip to content

fix: uniform elevation banners across all admin-required pages#504

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/uniform-elevation-banners
May 22, 2026
Merged

fix: uniform elevation banners across all admin-required pages#504
laurentiu021 merged 1 commit into
mainfrom
fix/uniform-elevation-banners

Conversation

@laurentiu021
Copy link
Copy Markdown
Owner

@laurentiu021 laurentiu021 commented May 22, 2026

Summary

Replaces all inconsistent elevation UI with a single uniform design across 5 pages.

Design:

  • Not elevated: Grey Surface2 banner + shield icon + page-specific reason + blue "Run as administrator" button
  • Elevated: Green compact banner with dot + page-specific confirmation text

Pages updated:

  • Windows Update: "Listing and installing Windows updates requires administrator privileges."
  • Windows Features: "Enabling or disabling Windows features requires administrator privileges."
  • Privacy Toggles: "Some privacy settings write to system-wide registry keys and require administrator privileges."
  • DNS & Hosts: "Changing DNS and editing the hosts file requires administrator privileges."
  • Services: "Starting and stopping Windows services requires administrator privileges." (NEW — didn't have elevation UI before)

Elevated state messages:

  • "Running as administrator — you can list and install updates."
  • "Running as administrator — you can enable and disable Windows features."
  • "Running as administrator — all privacy toggles are available."
  • "Running as administrator — you can change DNS settings and edit the hosts file."
  • "Running as administrator — you can start, stop, and configure services."

Test plan

  • CI passes
  • All 5 pages show grey banner when not elevated
  • All 5 pages show green banner when elevated
  • "Run as administrator" button works (relaunches app)
  • No visual inconsistencies between pages

Summary by CodeRabbit

Release Notes

  • New Features
    • Added administrator privilege status indicators across the application interface
    • Users can now see when features require elevated privileges and relaunch the app as administrator
    • Clear visual banners display whether the app is running with full administrative capabilities
    • Updated multiple views to communicate privilege requirements and current elevation status

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

The PR introduces elevation-state tracking to the application. ServicesViewModel now exposes an IsElevated observable property and a RelaunchElevated command. Five XAML views (DnsHosts, Privacy, Services, WindowsFeatures, WindowsUpdate) are updated with conditional banners that display different UI when the app is or is not running elevated, with a "Run as administrator" button and relaunch binding available in the non-elevated state.

Changes

Elevation State and UI Implementation

Layer / File(s) Summary
Elevation state tracking in ServicesViewModel
SysManager/SysManager/ViewModels/ServicesViewModel.cs
ServicesViewModel adds an IsElevated observable backing field, initializes it in the constructor, and introduces a RelaunchElevated relay command that triggers admin relaunch and closes the current application instance on success.
Elevation UI banners across XAML views
SysManager/SysManager/Views/DnsHostsView.xaml, PrivacyView.xaml, ServicesView.xaml, WindowsFeaturesView.xaml, WindowsUpdateView.xaml
Five views are updated with conditional elevation banners bound to IsElevated. Each displays a "Run as administrator" banner when not elevated (with relaunch button and explanatory text) and a success confirmation banner when elevated. ServicesView also restructures its grid layout with an additional row definition to position the banners above the existing DataGrid and status bar.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • laurentiu021/SystemManager#468: Also modifies ServicesViewModel.cs (changing class modifier to sealed in that PR, while this PR adds the elevation property and command).
  • laurentiu021/SystemManager#502: Also updates DNS & Hosts elevation UI in DnsHostsView.xaml with elevation banner wiring via the view model.
  • laurentiu021/SystemManager#489: Also modifies ServicesView.xaml, restructuring the DataGrid layout (this PR for elevation banner row changes, that PR for virtualization settings).

Poem

🐰 Elevation Quest

With banners of green and red so bright,
The app now shows its elevation light,
When admin calls from high above,
Relaunch flows with operator's love—
Five views in sync, a pattern true and right! 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: introducing uniform elevation banners across multiple admin-required pages, which is the core focus of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/uniform-elevation-banners

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 010e4ac and cceee3f.

📒 Files selected for processing (6)
  • SysManager/SysManager/ViewModels/ServicesViewModel.cs
  • SysManager/SysManager/Views/DnsHostsView.xaml
  • SysManager/SysManager/Views/PrivacyView.xaml
  • SysManager/SysManager/Views/ServicesView.xaml
  • SysManager/SysManager/Views/WindowsFeaturesView.xaml
  • SysManager/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 IsElevated via [ObservableProperty] private bool _isElevated;, and the bound commands match: RelaunchElevatedCommand comes from [RelayCommand] private void RelaunchElevated(), while WindowsUpdate/Cleanup/AppUpdates use RelaunchAsAdminCommand from [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!

Comment on lines +45 to +50
[RelayCommand]
private void RelaunchElevated()
{
if (AdminHelper.RelaunchAsAdmin())
System.Windows.Application.Current?.Shutdown();
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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.

Suggested change
[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.

@laurentiu021 laurentiu021 merged commit de48e7e into main May 22, 2026
5 checks passed
@laurentiu021 laurentiu021 deleted the fix/uniform-elevation-banners branch May 22, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant