DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17142
Closed
eamiri wants to merge 5 commits into
Closed
DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17142eamiri wants to merge 5 commits into
eamiri wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8957
Adds PackageManagerNoNetworkModeToolTip to DynamoCoreWpf resources and InstallButtonNoNetworkModeToolTip to WorkspaceDependencyViewExtension resources, mirroring the SignInOfflineButtonContentToolTip precedent.
…-8957) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds a NoNetworkMode property to WorkspaceDependencyView wired from StartupParams, and uses it to disable the Install Specified Version button with the no-network tooltip when Dynamo runs with --NoNetworkMode. Adds NUnit regression tests for the disabled state and tooltip resource strings.
|
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. Add “PM disabled in no-network mode” tooltips Implementation Plan
h2. Overview
Dynamo can be launched with {{--NoNetworkMode}} (a.k.a. “offline mode”). DYN-6409 hardened the Package Manager to refuse network operations under that mode by returning {{false}} from every PM-related {{CanExecute}} predicate. The side-effect is that PM menu items and certain buttons silently appear greyed-out with no hint as to why. This task adds informative tooltips, mirroring the precedent set for the Sign-In button ({{SignInOfflineButtonContentToolTip}} / {{ToolTipService.ShowOnDisabled="True"}} / {{DataTrigger}} on {{IsEnabled=False}}). It also disables the Install Specified Version button inside the Workspace References side-panel (the only PM-touching button that is not yet guarded) and gives it the same tooltip treatment.
h2. Current State Analysis
h3. Key Discoveries:
h2. Desired End State
When Dynamo launches with {{--NoNetworkMode}}:
The Packages menu items in the main menu ({{Publish Nodes to Package Manager}}, {{Publish Current Workspace as New Package}}, {{Package Manager}}) remain greyed-out and show the tooltip {{"Package Manager is disabled in no-network mode."}} when hovered.
The right-click {{Publish}} action on a custom-node workspace ({{WorkspaceView.xaml}}) shows the same tooltip when disabled.
The Install Specified Version button inside the Workspace References panel is now disabled (greyed-out) and shows the tooltip {{"Package install is disabled in no-network mode."}} when hovered.
The Keep Installed Version button and the Refresh icons in Workspace References continue to work, because they are purely local operations.
All existing tests still pass; two new NUnit tests assert the new disabled state and tooltip resource lookups.
Verification: launch {{DynamoSandbox.exe --NoNetworkMode}}, open a graph with a missing package dependency, hover each affected UI surface, and confirm the tooltip text appears.
h2. What We're NOT Doing
h2. Implementation Approach
Replicate the proven {{ShortcutToolbar}} Sign-In offline tooltip pattern in every PM-related UI surface that becomes disabled in NoNetworkMode, and extend the Workspace References extension with a {{NoNetworkMode}} bindable property so its {{DownloadPackageButton}} can be gated identically. All changes are XAML + resource strings + one bindable property; no PM business logic changes.
h3. TASK 1: Add new English resource strings [HIGH PRIORITY]
Status: DONE
Milestone: Resource strings exist and resolve correctly through both {{Resources.Designer.cs}} accessors at compile time.
Validation: {{dotnet build src/DynamoCore.sln -c Release}} succeeds; {{Dynamo.Wpf.Properties.Resources.PackageManagerNoNetworkModeToolTip}} and {{Dynamo.WorkspaceDependency.Properties.Resources.InstallButtonNoNetworkModeToolTip}} compile.
Requirements from spec:
Files to Modify:
Implementation Details:
Use the same {{...}} format as adjacent keys. Place the new keys alphabetically near {{SignInOfflineButtonContentToolTip}} and {{InstallButtonText}} respectively to match existing ordering hygiene.
h3. TASK 2: Attach offline tooltips to PM menu items in {{DynamoView.xaml}} [HIGH PRIORITY]
Status: DONE
Milestone: The three menu children of {{PackageManagerMenu}} (and optionally the parent) show the new tooltip when their hosting commands are disabled.
Validation: Launch {{DynamoSandbox.exe --NoNetworkMode}}; open {{Packages}} menu; hover each item; observe the tooltip. Re-launch without {{--NoNetworkMode}}; confirm tooltips do not appear (or show only when the item is genuinely disabled for another reason such as missing auth).
Requirements from spec:
Files to Modify:
Implementation Details:
XAML snippet shape (per child):
{code:xml}
{code}<MenuItem.ToolTip>
<ToolTip.Style>
<Style TargetType="ToolTip" BasedOn="{StaticResource GenericToolTipLight}">
<Style.Triggers>
</Style.Triggers>
</Style>
</ToolTip.Style>
</MenuItem.ToolTip>
Flipping {{Visibility}} rather than {{Content}} keeps the menu visually clean when the command is enabled.
h3. TASK 3: Attach offline tooltip to the right-click {{Publish}} MenuItem in {{WorkspaceView.xaml}} [MEDIUM PRIORITY]
Status: DONE
Milestone: When right-clicking on a custom-node workspace in offline mode, the {{Publish}} context-menu item shows the new tooltip.
Validation: Open a custom-node workspace under {{--NoNetworkMode}}, right-click empty canvas, hover {{Publish}}, see the tooltip.
Requirements from spec:
Files to Modify:
Implementation Details:
Reuse the snippet from Task 2 with the existing {{Visibility="{Binding Path=IsHomeSpace, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}"}} left intact.
h3. TASK 4: Disable Install button and add tooltip in Workspace References extension [HIGH PRIORITY]
Status: DONE
Milestone: Opening a graph with a missing package dependency in offline mode shows a greyed-out Install Specified Version button whose hover tooltip explains the disablement.
** Add {{IsEnabled="{Binding NoNetworkMode, Converter={StaticResource InverseBooleanConverter}}"}}.
** Add {{ToolTipService.ShowOnDisabled="True"}}.
** Add a conditional {{<Button.ToolTip>}} using the same {{Style.Triggers}} shape as Task 2 but referencing {{{x:Static w:Resources.InstallButtonNoNetworkModeToolTip}}} (the {{w:}} prefix already maps to {{Dynamo.WorkspaceDependency.Properties}}).
Validation: Launch {{DynamoSandbox.exe --NoNetworkMode}}; open {{test/core/packageDependencyTests/PackageDependencyStates.dyn}}; expand a missing-package row; observe the Install button greyed out and the tooltip appearing on hover.
Requirements from spec:
Files to Modify:
Implementation Details:
Property stub (in {{WorkspaceDependencyView.xaml.cs}}, near the existing {{currentWorkspace}} field):
{noformat}///
/// True when Dynamo started in no-network mode. Bound to the Install button's IsEnabled.
///
public bool NoNetworkMode { get; private set; }{noformat}
Constructor change:
{noformat}NoNetworkMode = p.StartupParams.NoNetworkMode;{noformat}
Because {{DataContext = this;}} is already set (line 143), the binding works without further wiring.
XAML for the button:
{code:xml}
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource SmallTextButton}">
<Style.Triggers>
</Style.Triggers>
</Style>
</Button.Style>
<Button.ToolTip>
<ToolTip.Style>
<Style TargetType="ToolTip" BasedOn="{StaticResource GenericToolTipLight}">
<Style.Triggers>
</Style.Triggers>
</Style>
</ToolTip.Style>
</Button.ToolTip>
{code}
Using a {{RelativeSource AncestorType=UserControl}} binding avoids depending on the row’s {{DataContext}} (which is {{PackageDependencyRow}}) and reaches the {{WorkspaceDependencyView}} where {{NoNetworkMode}} lives.
h3. TASK 5: Add NUnit tests [MEDIUM PRIORITY]
Status: DONE
Milestone: New regression tests pass and would fail if the install button regressed to always-enabled or the resource strings disappeared.
Validation: {{dotnet test test/DynamoCoreWpf2Tests/DynamoCoreWpf2Tests.csproj --filter "Name~WhenNoNetworkMode"}} succeeds.
Requirements from spec:
Files to Modify:
Implementation Details:
For the workspace-dependency test, the cleanest path is to instantiate {{WorkspaceDependencyView}} directly with a stubbed {{ViewLoadedParams}}. The view's constructor only consumes {{CurrentWorkspaceModel}}, {{PackageInstaller}}, and {{StartupParams.NoNetworkMode}}, so a small mock satisfies the surface. If the existing fixture starts a real {{DynamoModel}}, a second {{[TestFixture]}} derived from {{DynamoModelTestBase}} with {{NoNetworkMode = true}} in the start config is also acceptable; see {{test/System/IntegrationTests/DynamoApplicationTests.cs:71-83}} for the pattern.
h2. Testing Strategy
h3. Unit Tests:
h3. Integration Tests:
h3. Manual Testing Steps:
Build full UI: {{msbuild src/Dynamo.All.sln /p:Configuration=Release}}.
Launch {{DynamoSandbox.exe --NoNetworkMode}}.
Open the {{Packages}} menu — confirm all three children are greyed out; hover each; confirm the new tooltip appears.
Open a custom-node workspace (e.g. open any {{.dyf}} from {{test/core/CustomNodes/}}); right-click the canvas; confirm {{Publish}} is greyed and the tooltip appears.
Open a graph with a known-missing package dependency (e.g. {{test/core/packageDependencyTests/PackageDependencyStates.dyn}}); open the Workspace References panel; expand a missing-package row; confirm the Install Specified Version button is greyed and the new tooltip appears. Click should be a no-op.
Confirm Keep Installed Version and the Refresh icons still work.
Relaunch without {{--NoNetworkMode}}; confirm every affected control is functional, the new tooltips do not appear, and existing tooltips (e.g. on the Sign-In button) still behave as before.
h2. Performance Considerations
None. The change is XAML data binding + a single boolean property assigned once at construction; no per-frame allocations and no impact on graph evaluation paths.
h2. Migration Notes
None. No public API additions; no preference-settings migrations; no on-disk format changes. The {{master-localization}} merge will pick up the new English resource keys on the next pass and translators will fill in the locale {{.resx}} files automatically.