DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17144
Closed
eamiri wants to merge 6 commits into
Closed
DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17144eamiri wants to merge 6 commits into
eamiri wants to merge 6 commits into
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8957
Add PackageManagerNoNetworkModeToolTip to DynamoCoreWpf and InstallButtonNoNetworkModeToolTip to WorkspaceDependencyViewExtension resource bundles (invariant + en-US) with regenerated Designer.cs accessors. These resources back the no-network-mode tooltips for the Packages menu, custom-workspace Publish item, and Workspace References Install button. Implements TASK 1 of DYN-8957.
Attach a disabled-state tooltip to the publishSelected, publishCurrent, and showPM menu items under the Packages menu using the same ToolTipService.ShowOnDisabled + PlacementTarget.IsEnabled DataTrigger pattern as the Sign-In offline button in ShortcutToolbar.xaml. Resource: Resources.PackageManagerNoNetworkModeToolTip. DYN-8957
Add a NoNetworkMode property to WorkspaceDependencyView populated from ViewLoadedParams.StartupParams.NoNetworkMode, then disable the DownloadPackageButton via a Style.Triggers DataTrigger bound to that property. Attach a ToolTipService.ShowOnDisabled tooltip using the InstallButtonNoNetworkModeToolTip resource and the same collapsed-by- default ToolTip pattern as the Packages menu items. DYN-8957
…tension wiring Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Closes https://autodesk.atlassian.net/browse/DYN-8957
h1. Package Manager No-Network Mode Tooltips Implementation Plan
h2. Overview
In no-network mode, every Package Manager (PM) entry point in Dynamo's UI must visibly communicate why it is disabled, rather than appearing arbitrarily greyed out. The existing PM-related menu items and the custom-node Publish context-menu entry are already command-disabled but unannotated; the Workspace References extension's Install button is wired to a raw {{Click}} handler and is not even disabled. This plan adds two localized tooltip resources, attaches them to the four PM menu items through a re-usable XAML pattern, and adds an explicit {{IsEnabled=False}} binding plus tooltip on the Workspace References Install button, mirroring the existing offline Sign-In pattern in {{ShortcutToolbar.xaml}}.
h2. Current State Analysis
h3. Key Discoveries
h2. Desired End State
** {{Packages}} menu → {{Publish Nodes}}, {{Publish Workspace}}, {{Show Package Manager}}
** Custom-workspace context menu → {{Publish}}
** Workspace References extension → {{Install Specified Version}} button
NoNetworkMode|NameInstallButtonResource|Name~NoNetworkModeTooltipResource"}} passes.h2. What We're NOT Doing
h2. Implementation Approach
Match the existing {{SignInOfflineButtonContentToolTip}} pattern: introduce per-feature resource strings, attach {{ToolTipService.ShowOnDisabled="True"}} to each affected control, and use a {{Style.Triggers}} {{DataTrigger}} on {{PlacementTarget.IsEnabled}} (or, for the explicitly-controlled Install button, on a code-behind {{NoNetworkMode}} property) to swap a default-collapsed tooltip into a visible state when the control is disabled. Land the work in five small, reviewable commits — resources first, then each XAML surface, then the extension code-behind + tests — so each step is independently buildable and reviewable.
h3. TASK 1: Add localized resource strings for the new tooltips [HIGH PRIORITY]
Status: DONE
Milestone: Both {{Resources.PackageManagerNoNetworkModeToolTip}} (DynamoCoreWpf) and {{Resources.InstallButtonNoNetworkModeToolTip}} (WorkspaceDependencyViewExtension) resolve from C# code and from XAML {{{x:Static p:Resources.*}}} bindings.
Validation: {{msbuild src/Dynamo.All.sln /p:Configuration=Release}} succeeds and {{Resources.PackageManagerNoNetworkModeToolTip}} / {{Resources.InstallButtonNoNetworkModeToolTip}} are accessible via IntelliSense in their respective namespaces.
Requirements from spec:
Files to Modify:
Implementation Details:
Keep both strings short and parallel in voice to the existing {{SignInOfflineButtonContentToolTip}} ({{Enable Network Mode to be able to sign in.}}). Two separate keys (rather than one shared resource) are intentional because the two tooltips live in two different assemblies — duplicating the string keeps each resource bundle self-contained.
h3. TASK 2: Attach no-network tooltips to the Packages menu items [HIGH PRIORITY]
Status: DONE
Milestone: In no-network mode, hovering any of {{Publish Nodes}}, {{Publish Workspace}}, or {{Show Package Manager}} under the {{Packages}} menu shows {{PackageManagerNoNetworkModeToolTip}}; in normal mode the items show no tooltip.
** [x] Add {{ToolTipService.ShowOnDisabled="True"}}.
** [x] Add a {{MenuItem.ToolTip}} containing a {{ToolTip}} whose {{Style}} (based on {{GenericToolTipLight}}) starts with {{Visibility="Collapsed"}} and a {{Style.Triggers}} {{DataTrigger}} on {{Binding="{Binding PlacementTarget.IsEnabled, RelativeSource={RelativeSource Self}}" Value="False"}} that sets {{Visibility="Visible"}} and {{Content="{x:Static p:Resources.PackageManagerNoNetworkModeToolTip}"}}.
Validation:
Requirements from spec:
Files to Modify:
Implementation Details:
The collapsed-by-default style is important: WPF will still allocate the {{ToolTip}} for an enabled {{MenuItem}}, and {{ToolTipService.ShowOnDisabled}} only suppresses the show-while-disabled blocker. Hiding the tooltip via {{Visibility="Collapsed"}} and revealing it only on {{IsEnabled=False}} prevents an empty tooltip from flashing on enabled items.
h3. TASK 3: Attach no-network tooltip to the custom-workspace Publish context-menu item [MEDIUM PRIORITY]
Status: DONE
Milestone: In no-network mode, right-clicking a custom-node workspace and hovering the {{Publish}} menu entry shows {{PackageManagerNoNetworkModeToolTip}}.
** [x] Add {{ToolTipService.ShowOnDisabled="True"}}.
** [x] Add the same {{MenuItem.ToolTip}} + {{Style.Triggers}} pattern used in Task 2, with content {{PackageManagerNoNetworkModeToolTip}}.
Validation: In no-network mode, open a custom node, right-click anywhere on its workspace canvas → context menu shows a disabled {{Publish}} entry whose tooltip reads the PM no-network message.
Requirements from spec:
Files to Modify:
Implementation Details:
Same XAML pattern as Task 2. Re-using the same resource string is correct: from the user's standpoint these are all "Package Manager publish" actions, regardless of the menu path.
h3. TASK 4: Disable the Workspace References Install button in no-network mode and attach a tooltip [HIGH PRIORITY]
Status: DONE
Milestone: When Dynamo runs with {{--NoNetworkMode}}, the {{Install Specified Version}} button in the Workspace References extension is visibly disabled and shows {{InstallButtonNoNetworkModeToolTip}} on hover. In normal mode it works exactly as before.
** [x] Add a {{public bool NoNetworkMode { get; private set; }}} property with an XML doc comment explaining its purpose.
** [x] In the existing constructor that takes {{ViewLoadedParams p}}, set {{NoNetworkMode = p.StartupParams.NoNetworkMode;}} next to the existing {{loadedParams = p; packageInstaller = p.PackageInstaller;}} assignments.
** [x] Move the existing {{Style="{StaticResource SmallTextButton}"}} into a {{Button.Style}} whose base style is {{SmallTextButton}}.
** [x] Add a {{Style.Triggers}} {{DataTrigger}} on {{Binding="{Binding NoNetworkMode, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="True"}} that sets {{IsEnabled="False"}}.
** [x] Add {{ToolTipService.ShowOnDisabled="True"}}.
** [x] Add a {{Button.ToolTip}} containing a {{ToolTip}} styled like Task 2 (collapsed by default, visible with content {{{x:Static w:Resources.InstallButtonNoNetworkModeToolTip}}} when {{PlacementTarget.IsEnabled}} is {{False}}).
Validation:
Requirements from spec:
Files to Modify:
Implementation Details:
The button uses a {{Click}} event handler ({{DownloadPackage}}) rather than an {{ICommand}}, so there is no {{CanExecute}} path to hang the disabled state on. Binding to {{NoNetworkMode}} on the hosting {{UserControl}} via {{RelativeSource AncestorType=UserControl}} is the lightest viable touch and avoids introducing a DataContext-swapping change. Marking the setter {{private}} is fine — the value never changes after {{Loaded(...)}} returns.
h3. TASK 5: Add regression tests for the new strings and the extension wiring [MEDIUM PRIORITY]
Status: DONE
Milestone: NUnit tests cover (a) presence of both new resource strings and (b) propagation of {{StartupParams.NoNetworkMode}} into {{WorkspaceDependencyView.NoNetworkMode}}.
** [x] Add {{using Dynamo.Wpf.Properties;}} if not already present.
** [x] Add {{[Test] public void WhenNoNetworkModeTooltipResourceRequestedThenItResolvesToNonEmpty()}} asserting {{!string.IsNullOrWhiteSpace(Resources.PackageManagerNoNetworkModeToolTip)}} with a one-line comment noting that the DynamoView.xaml {{PackageManagerMenu}} items depend on this key.
** [x] Add {{[Test] public void WhenInstallButtonResourceStringRequestedThenItResolvesToNonEmpty()}} to the existing fixture, asserting {{!string.IsNullOrWhiteSpace(Resources.InstallButtonNoNetworkModeToolTip)}}.
** [x] Add a new {{[TestFixture] public class WorkspaceDependencyViewExtensionNoNetworkModeTests : DynamoTestUIBase}} that overrides {{CreateStartConfiguration}} to return a {{DefaultStartConfiguration}} with {{NoNetworkMode = true, StartInTestMode = true, ProcessMode = TaskProcessMode.Synchronous}}, etc.
** [x] In that fixture, add {{[Test] public void WhenNoNetworkModeThenWorkspaceReferencesInstallButtonIsDisabled()}} that raises the {{Loaded}} event, registers the extension, builds a {{ViewLoadedParams}}, calls {{viewExtension.Loaded(loadedParams)}}, and asserts {{viewExtension.DependencyView.NoNetworkMode}} is {{true}}. Comment briefly that this flag is what drives the button's {{IsEnabled}} trigger.
Validation:
{code:bash}dotnet test test/DynamoCoreWpf2Tests/DynamoCoreWpf2Tests.csproj --filter "Name
WhenNoNetworkMode|NameWhenInstallButtonResource"{code}All three new tests pass and no existing {{WorkspaceDependencyViewExtensionTests}} tests regress.
Requirements from spec:
Files to Modify:
Implementation Details:
{{DynamoTestUIBase.CreateStartConfiguration}} is the established hook for booting Dynamo with a non-default {{IStartConfiguration}} from a test fixture (other tests use the same pattern). Asserting the flag on {{DependencyView.NoNetworkMode}} is intentionally indirect — directly asserting the {{Button.IsEnabled}} state is brittle because WPF triggers do not fire until the visual tree is fully realized, which is not guaranteed in a headless NUnit run.
h2. Testing Strategy
h3. Unit Tests
h3. Integration Tests
h3. Manual Testing Steps
Build the full solution: {{msbuild src/Dynamo.All.sln /p:Configuration=Release}}.
Launch Dynamo with the no-network flag: {{DynamoSandbox.exe --NoNetworkMode}}.
Open the {{Packages}} menu in the main toolbar; verify all three items ({{Publish Nodes}}, {{Publish Workspace}}, {{Show Package Manager}}) are disabled and hovering each shows {{Enable Network Mode to be able to use Package Manager.}}
Create or open a custom-node workspace, right-click the canvas, verify the {{Publish}} context-menu item is disabled and hovers show the same tooltip.
Open a graph with at least one missing package dependency. Open the Workspace References extension panel from the Extensions menu. Verify the {{Install Specified Version}} button is greyed out and that hovering shows {{Enable Network Mode to be able to install packages.}}
Restart Dynamo without {{--NoNetworkMode}} and confirm none of the controls show a tooltip and all behave normally — the {{Install Specified Version}} button still invokes {{DownloadPackage}} when clicked.
Edge case: open and close the Workspace References extension panel multiple times in no-network mode and confirm the disabled state and tooltip persist ({{NoNetworkMode}} is set in the constructor, not in a per-event handler).
h2. Performance Considerations
The pattern uses WPF data triggers that resolve at tooltip-open time and tooltip-realize time only — no per-frame cost. No additional event subscriptions, timers, or background work are introduced. Resource lookups happen once during XAML parsing.
h2. Migration Notes
No persisted data is affected. The new public {{NoNetworkMode}} property on {{WorkspaceDependencyView}} is additive (no removal or rename of existing members) and therefore does not require a {{PublicAPI.Unshipped.txt}} entry on the public API surface ({{WorkspaceDependencyView}} is not part of the public {{WorkspaceDependencyViewExtension}} API contract — only the {{WorkspaceDependencyViewExtension}} class itself is — but the property is {{public}} for XAML binding visibility). If a {{PublicAPI.Unshipped.txt}} exists for this assembly during review, add {{WorkspaceDependencyViewExtension.WorkspaceDependencyView.NoNetworkMode.get -> bool}} to be safe. The new resource keys are additions to existing {{.resx}} bundles and do not change any existing keys, so no breaking change is introduced.