-
Notifications
You must be signed in to change notification settings - Fork 4
P2: compact FAT header hierarchy #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
masarray
wants to merge
5
commits into
fix/p1-fat-v2-first-paint-schema
from
fix/p2-fat-compact-header
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6cffe3c
Compact FAT header action hierarchy
masarray c589878
Apply P2 compaction through existing P0 header pass
masarray ca050fe
Compact FAT clock status captions
masarray 2d5ec0c
Compact FAT evidence action captions
masarray fc82cad
Guard P2 compact FAT header scope
masarray File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
IoListTestingWindow.P2CompactHeader.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| using System.Windows; | ||
| using System.Windows.Controls; | ||
|
|
||
| namespace ArIED61850Tester; | ||
|
|
||
| /// <summary> | ||
| /// P2 bench-facing header compaction. | ||
| /// | ||
| /// P0 already separates operational actions from evidence/status actions. P2 only tightens | ||
| /// that existing hierarchy so the FAT header remains readable on normal engineering laptop | ||
| /// widths. Full evidence detail stays in the existing tooltips; protocol, evidence and grid | ||
| /// behavior are intentionally untouched. | ||
| /// </summary> | ||
| public partial class IoListTestingWindow | ||
| { | ||
| private void ConfigureP2CompactHeader() | ||
| { | ||
| if (_p0PrimaryHeaderActions == null || _p0SecondaryHeaderActions == null) | ||
| return; | ||
|
|
||
| _p0PrimaryHeaderActions.Margin = new Thickness(0); | ||
| _p0SecondaryHeaderActions.Margin = new Thickness(0, 3, 0, 0); | ||
|
|
||
| foreach (var button in _p0PrimaryHeaderActions.Children.OfType<Button>()) | ||
| ApplyP2CompactButtonMetrics(button, secondary: false); | ||
|
|
||
| foreach (var button in _p0SecondaryHeaderActions.Children.OfType<Button>()) | ||
| ApplyP2CompactButtonMetrics(button, secondary: true); | ||
|
|
||
| WorkspacePreviewToggle.Content = "Preview"; | ||
| if (_cleanSessionButton != null) | ||
| _cleanSessionButton.Content = "Clean FAT"; | ||
|
|
||
| ApplyP2CompactStatusMetrics(_clockSyncGlobalStatusText, 118, FontWeights.Medium); | ||
| ApplyP2CompactStatusMetrics(_clockSyncEvidenceText, 188, FontWeights.Normal); | ||
| } | ||
|
|
||
| private static void ApplyP2CompactButtonMetrics(Button button, bool secondary) | ||
| { | ||
| button.Padding = secondary | ||
| ? new Thickness(8, 5, 8, 5) | ||
| : new Thickness(9, 6, 9, 6); | ||
| button.Margin = new Thickness(0, 0, 5, 0); | ||
| button.MinWidth = 0; | ||
| button.MinHeight = secondary ? 27 : 29; | ||
| if (secondary) | ||
| { | ||
| button.FontSize = 10.4; | ||
| button.FontWeight = FontWeights.Medium; | ||
| } | ||
| } | ||
|
|
||
| private static void ApplyP2CompactStatusMetrics( | ||
| TextBlock? text, | ||
| double maxWidth, | ||
| FontWeight fontWeight) | ||
| { | ||
| if (text == null) | ||
| return; | ||
|
|
||
| text.MaxWidth = maxWidth; | ||
| text.TextWrapping = TextWrapping.NoWrap; | ||
| text.TextTrimming = TextTrimming.CharacterEllipsis; | ||
| text.FontWeight = fontWeight; | ||
| text.FontSize = 10.2; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
tests/ARSAS.Tests/IoFatP2CompactHeaderRegressionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| namespace ARSAS.Tests; | ||
|
|
||
| public sealed class IoFatP2CompactHeaderRegressionTests | ||
| { | ||
| [Fact] | ||
| public void P2_ReusesP0PrimaryAndSecondaryHeaderHierarchy() | ||
| { | ||
| var p0 = File.ReadAllText(FindRepoFile("IoListTestingWindow.P0BenchUx.cs")); | ||
|
|
||
| Assert.Contains("ConfigureP0AdaptiveHeaderActions();", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ConfigureP2CompactHeader();", p0, StringComparison.Ordinal); | ||
| Assert.Contains("_p0PrimaryHeaderActions", p0, StringComparison.Ordinal); | ||
| Assert.Contains("_p0SecondaryHeaderActions", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, WorkspacePreviewToggle)", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, _timeSyncEvidenceButton)", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, _comtradeEvidenceButton)", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, _cleanSessionButton)", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, _clockSyncGlobalStatusText)", p0, StringComparison.Ordinal); | ||
| Assert.Contains("ReferenceEquals(element, _clockSyncEvidenceText)", p0, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void P2_CompactsSecondaryControlsWithoutHidingEvidenceDetail() | ||
| { | ||
| var header = File.ReadAllText(FindRepoFile("IoListTestingWindow.P2CompactHeader.cs")); | ||
| var clock = File.ReadAllText(FindRepoFile("IoListTestingWindow.ClockSyncUx.cs")); | ||
| var supplemental = File.ReadAllText(FindRepoFile("IoListTestingWindow.SupplementalEvidence.cs")); | ||
|
|
||
| Assert.Contains("WorkspacePreviewToggle.Content = \"Preview\";", header, StringComparison.Ordinal); | ||
| Assert.Contains("_cleanSessionButton.Content = \"Clean FAT\";", header, StringComparison.Ordinal); | ||
| Assert.Contains("TextTrimming.CharacterEllipsis", header, StringComparison.Ordinal); | ||
| Assert.Contains("button.MinWidth = 0;", header, StringComparison.Ordinal); | ||
|
|
||
| Assert.Contains("Text = \"SNTP · —\"", clock, StringComparison.Ordinal); | ||
| Assert.Contains("\"SNTP · ON\"", clock, StringComparison.Ordinal); | ||
| Assert.Contains("\"SNTP · OFF\"", clock, StringComparison.Ordinal); | ||
| Assert.Contains("Rep {snapshot.ReplyCount}", clock, StringComparison.Ordinal); | ||
| Assert.Contains("BuildClockSyncEvidenceToolTip", clock, StringComparison.Ordinal); | ||
| Assert.Contains("Binding: {binding}", clock, StringComparison.Ordinal); | ||
| Assert.Contains("Client request seen: {snapshot.ClientRequestCount}", clock, StringComparison.Ordinal); | ||
| Assert.Contains("Mode 4 reply sent: {snapshot.ReplyCount}", clock, StringComparison.Ordinal); | ||
|
|
||
| Assert.Contains("CreateEvidenceButton(\"Sync · —\"", supplemental, StringComparison.Ordinal); | ||
| Assert.Contains("CreateEvidenceButton(\"Clean FAT\"", supplemental, StringComparison.Ordinal); | ||
| Assert.Contains("$\"Sync · {timeSync.Verdict}\"", supplemental, StringComparison.Ordinal); | ||
| Assert.Contains("timeSync.DisplayText", supplemental, StringComparison.Ordinal); | ||
| Assert.Contains("timeSync.Reason", supplemental, StringComparison.Ordinal); | ||
| Assert.Contains("ied.LatestComtradeRemotePath", supplemental, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void P2_IsPresentationOnlyAndDoesNotTouchFatProtocolEvidenceOrGridSchema() | ||
| { | ||
| var header = File.ReadAllText(FindRepoFile("IoListTestingWindow.P2CompactHeader.cs")); | ||
|
|
||
| Assert.DoesNotContain("SetVirtualizationMode", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("SetIsVirtualizing", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("ReadObject", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("ReadAsync", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("CaptureCurrentEvidence", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("ScheduleSave", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("ARIEC61850", header, StringComparison.OrdinalIgnoreCase); | ||
| Assert.DoesNotContain("grid.Columns", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("ON RELAY TIME", header, StringComparison.Ordinal); | ||
| Assert.DoesNotContain("OFF RELAY TIME", header, StringComparison.Ordinal); | ||
| } | ||
|
|
||
| private static string FindRepoFile(string relativePath) | ||
| { | ||
| DirectoryInfo? directory = new(AppContext.BaseDirectory); | ||
| while (directory != null) | ||
| { | ||
| var candidate = Path.Combine(directory.FullName, relativePath); | ||
| if (File.Exists(candidate)) | ||
| return candidate; | ||
| directory = directory.Parent; | ||
| } | ||
|
|
||
| throw new FileNotFoundException( | ||
| $"Could not locate repository file '{relativePath}' from '{AppContext.BaseDirectory}'."); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.