Categories removed from regular activities#4276
Conversation
WalkthroughAdds a collapsed Categories Expander with a Frame to ActivityDetailsPage XAML and updates ActivityDetailsPage.UpdatePageViewMode to accept an Activity. UI logic now shows/enables/expands the expander based on page view mode, SharedRepository state, and activity linkage; callers (ActivityPage) pass mActivity through. Changes
Sequence Diagram(s)sequenceDiagram
participant AP as ActivityPage
participant ADP as ActivityDetailsPage
participant UI as SetUI
AP->>ADP: UpdatePageViewMode(pageViewMode, activity)
ADP->>ADP: mActivity = activity\n(optional) UpdateActivity(activity)
ADP->>UI: SetUI()
alt View mode
UI->>UI: xCategoriesExpander Visible, Expanded, Disabled
else SharedRepository mode
UI->>UI: xCategoriesExpander Visible & Enabled
else Edit/Other modes
alt activity.IsLinkedItem OR activity.ParentGuid != Guid.Empty
UI->>UI: xCategoriesExpander Visible & Enabled
else
UI->>UI: xCategoriesExpander Collapsed
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml (1)
87-94: Hide frame navigation chrome and avoid accidental focusMinor UX polish: prevent the WPF Frame from showing navigation UI and from receiving focus unexpectedly.
Apply this diff:
- <Expander.Content> - <Frame x:Name="xCategoriesFrame"/> - </Expander.Content> + <Expander.Content> + <Frame x:Name="xCategoriesFrame" + NavigationUIVisibility="Hidden" + Focusable="False"/> + </Expander.Content>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml(1 hunks)Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs(3 hunks)Ginger/Ginger/Activities/ActivityPage.xaml.cs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
Ginger/Ginger/Activities/ActivityPage.xaml.cs (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (1)
UpdatePageViewMode(65-70)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs (3)
Activity(81-1351)Activity(142-149)Activity(940-962)Ginger/GingerCoreCommon/Repository/BusinessFlowLib/BusinessFlow.cs (2)
Activity(1610-1618)Activity(1620-1646)
🔇 Additional comments (3)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
65-70: Make UpdatePageViewMode robust to Activity changesVerified that the only two-argument call to UpdatePageViewMode is in ActivityPage.xaml.cs (mConfigurationsPage.UpdatePageViewMode). No other usages pass an Activity, so applying the conditional flow is safe and prevents stale bindings when the Activity changes.
Locations to update:
- Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (method UpdatePageViewMode)
Apply this diff:
public void UpdatePageViewMode(Ginger.General.eRIPageViewMode pageViewMode, Activity activity) { mPageViewMode = pageViewMode; - mActivity = activity; - SetUI(); + if (!ReferenceEquals(mActivity, activity)) + { + UpdateActivity(activity); + } + else + { + SetUI(); + } }
91-94: Confirm Category Expander Visibility in View ModesCurrently, in SetUI() for View/ViewAndExecute (lines 91–93), the expander is always shown (Visible, Expanded, Disabled), whereas in Edit modes it’s only shown for linked/shared activities. If the intent of this PR is to hide Categories entirely for regular activities, you’ll need to apply the same conditional logic in the View branches:
--- a/Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs +++ b/Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs @@ private void SetUI() - xCategoriesExpander.Visibility = Visibility.Visible; - xCategoriesExpander.IsExpanded = true; - xCategoriesExpander.IsEnabled = false; + // Show only for linked/shared activities in View modes + bool showCategoriesInView = mActivity != null + && (mActivity.Type == Amdocs.Ginger.Repository.eSharedItemType.Link + || mActivity.ParentGuid != Guid.Empty); + xCategoriesExpander.Visibility = showCategoriesInView + ? Visibility.Visible + : Visibility.Collapsed; + xCategoriesExpander.IsExpanded = showCategoriesInView; + xCategoriesExpander.IsEnabled = false;Please verify that hiding the Categories expander for regular activities in View/ViewAndExecute modes aligns with the PR’s goals.
Ginger/Ginger/Activities/ActivityPage.xaml.cs (1)
167-168: LGTM: Caller updated to new API signaturePassing mActivity into UpdatePageViewMode aligns with the new signature and ensures the details page has the current Activity context.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (1)
127-131: Bug: SharedRepo column width is collapsed and never restoredYou collapse xSharedRepoInstanceUCCol to width 0 in SharedReposiotry mode but never restore it when leaving that mode. The column will remain collapsed for subsequent SetUI calls.
Recommend capturing the initial width and restoring it when not in SharedReposiotry mode.
Proposed implementation (outside the selected lines):
// Add fields to the class private GridLength _sharedRepoInitialWidth; private bool _sharedRepoWidthCaptured; // In constructor, after InitializeComponent(): if (!_sharedRepoWidthCaptured) { _sharedRepoInitialWidth = xSharedRepoInstanceUCCol.Width; _sharedRepoWidthCaptured = true; }Inside SetUI(), in the SharedReposiotry branch (keep your current code that sets width to 0), and add at the end of SetUI():
// Restore column width when not in SharedReposiotry mode if (mPageViewMode != Ginger.General.eRIPageViewMode.SharedReposiotry) { if (_sharedRepoWidthCaptured && Math.Abs(xSharedRepoInstanceUCCol.Width.Value) < double.Epsilon) { xSharedRepoInstanceUCCol.Width = _sharedRepoInitialWidth; xSharedRepoInstanceUC.Visibility = Visibility.Visible; } }Optionally verify where the column is defined to confirm the initial width captured matches the XAML default:
#!/bin/bash rg -n -A 2 -B 2 'xSharedRepoInstanceUCCol|xSharedRepoInstanceUC' -- '*.xaml' '*/ActivityDetailsPage*'
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-07-26T22:04:12.930Z
Learnt from: IamRanjeetSingh
PR: Ginger-Automation/Ginger#0
File: :0-0
Timestamp: 2024-07-26T22:04:12.930Z
Learning: The comment regarding the use of `referenceActivity.Guid` instead of `itemCopy.Guid` in the `MarkActivityAsLink` method is considered outdated by the user IamRanjeetSingh.
Applied to files:
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs
🧬 Code Graph Analysis (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs (3)
Activity(81-1351)Activity(142-149)Activity(940-962)Ginger/Ginger/Actions/ActionEditPages/ActWebSmartSyncEditPage.xaml.cs (1)
Visibility(124-139)
🔇 Additional comments (2)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
91-94: LGTM: predictable read-only Categories in View modesMaking Categories visible, expanded, and disabled in View/View+Execute gives users consistent read-only visibility without edit affordances. Looks good.
113-121: Correct: guarded and semantic check for linked itemsGood null-guard and usage of IsLinkedItem combined with ParentGuid check. This aligns with intent to show Categories only for linked/parented activities in edit modes.
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-07-26T22:04:12.930Z
Learnt from: IamRanjeetSingh
PR: Ginger-Automation/Ginger#0
File: :0-0
Timestamp: 2024-07-26T22:04:12.930Z
Learning: The comment regarding the use of `referenceActivity.Guid` instead of `itemCopy.Guid` in the `MarkActivityAsLink` method is considered outdated by the user IamRanjeetSingh.
Applied to files:
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs
🧬 Code Graph Analysis (1)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs (3)
Activity(81-1351)Activity(142-149)Activity(940-962)Ginger/Ginger/Activities/ActivityPage.xaml.cs (1)
UpdateActivity(230-250)
🔇 Additional comments (2)
Ginger/Ginger/Activities/ActivityDetailsPage.xaml.cs (2)
94-97: View/Execute mode: Correctly shows and locks CategoriesMaking the Categories expander visible, expanded, and read-only in View/Execute mode matches the intent to allow viewing without editing.
116-124: Null-guard + IsLinkedItem usage — thanks for addressing the earlier suggestionCondition now guards against null and uses IsLinkedItem with ParentGuid fallback; visibility/enabled states look correct for linked items only.
…ked activities
Thank you for your contribution.
Before submitting this PR, please make sure:
Summary by CodeRabbit