Skip to content

DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17196

Open
eamiri wants to merge 2 commits into
masterfrom
8957-add-tooltips-describing-pm-is-disabled-i
Open

DynamoDS/DYN-8957: Add tooltips describing PM is disabled in no-network mode#17196
eamiri wants to merge 2 commits into
masterfrom
8957-add-tooltips-describing-pm-is-disabled-i

Conversation

@eamiri

@eamiri eamiri commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Closes https://autodesk.atlassian.net/browse/DYN-8957

Package Manager No-Network Mode Tooltips Implementation Plan

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.

Current State Analysis

Key Discoveries

  • The PM-launching MenuItems on the main Packages menu (src/DynamoCoreWpf/Views/Core/DynamoView.xaml:615-619) are already disabled in no-network mode via their bound Commands — they only need tooltips.
  • The custom-workspace Publish context-menu item (src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml:756) shares PublishCurrentWorkspaceCommand with the main menu, so it disables for free and likewise just needs a tooltip.
  • The Workspace References DownloadPackageButton (src/WorkspaceDependencyViewExtension/WorkspaceDependencyView.xaml:250) uses a Click event, not an ICommand. It must be explicitly disabled via a Style.Triggers DataTrigger driven by a NoNetworkMode property exposed on WorkspaceDependencyView, populated from ViewLoadedParams.StartupParams.NoNetworkMode.
  • The PM Window's internal install/publish controls (PackageManagerView.xaml, PackageManagerPackagesControl.xaml, PackageDetailsView.xaml) are unreachable in no-network mode because the entry-menu items that open the window are themselves disabled. They are deliberately out of scope.
  • The Preferences-dialog "Package Manager" hyperlink (PreferencesView.xaml:2028) already has a separate IsHitTestVisible + greyed-out Foreground disable treatment and is not part of this ticket.
  • The reference pattern for a disabled-state tooltip lives on the Sign-In button (src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml, around LoginButton), which uses ToolTipService.ShowOnDisabled="True" and a Style.Triggers DataTrigger on PlacementTarget.IsEnabled.

Desired End State

  • In no-network mode (--NoNetworkMode startup flag set), hovering any of the following disabled controls shows a tooltip explaining that Network Mode must be enabled:
    • Packages menu -> Publish Nodes, Publish Workspace, Show Package Manager
    • Custom-workspace context menu -> Publish
    • Workspace References extension -> Install Specified Version button
  • In normal (network) mode, the same controls behave exactly as before with no tooltip leakage and no visual regression.
  • New tooltip strings are present in both DynamoCoreWpf and WorkspaceDependencyViewExtension resource bundles (invariant + en-US) and surface via the generated Resources.Designer.cs accessors.
  • NUnit regression tests guard against accidental removal of the new resource strings and assert that the Workspace References extension propagates NoNetworkMode from StartupParams when Dynamo boots with that flag.
  • msbuild src/Dynamo.All.sln /p:Configuration=Release builds clean.
  • dotnet test test/DynamoCoreWpf2Tests/DynamoCoreWpf2Tests.csproj --filter "NameNoNetworkMode|NameInstallButtonResource|Name~NoNetworkModeTooltipResource" passes.

What We're NOT Doing

  • Changing the underlying no-network gating logic in DynamoModel, DynamoViewModel, or PackageManagerClientViewModel — those gates are already correct.
  • Adding tooltips inside the PM Window (search results, package details, empty-state publish). They are unreachable in no-network mode.
  • Modifying the Preferences-dialog Package Manager hyperlink — its disabled UX is already implemented and is out of scope.
  • Backfilling translated resources into the non-en-US .resx files; those are handled by the periodic master-localization merge.
  • Refactoring DownloadPackageButton from a Click handler to a bindable ICommand. Out of scope; only its enabled state and tooltip are being changed.
  • Touching DynamoModel.cs template-loading code or any other behavior unrelated to PM-disabled tooltips.

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.

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.

  • Add PackageManagerNoNetworkModeToolTip = Enable Network Mode to be able to use Package Manager. to src/DynamoCoreWpf/Properties/Resources.resx (invariant) and Resources.en-US.resx, placed next to the existing SignInOfflineButtonContentToolTip entry for locality.
  • Add InstallButtonNoNetworkModeToolTip = Enable Network Mode to be able to install packages. to src/WorkspaceDependencyViewExtension/Properties/Resources.resx (invariant) and Resources.en-US.resx, placed next to the existing InstallButtonText entry.
  • Regenerate Resources.Designer.cs for both projects so the new keys surface as public static string properties.
  • Do not edit the other locale .resx files; they are filled in via the master-localization merge.
    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:
  • Provide user-facing messaging explaining that PM is disabled in no-network mode (per https://autodesk.atlassian.net/browse/DYN-6409#icft=DYN-6409 messaging convention).
  • Mirror the existing SignInOfflineButtonContentToolTip precedent for offline messaging.
    Files to Modify:
  • src/DynamoCoreWpf/Properties/Resources.resx — add invariant PackageManagerNoNetworkModeToolTip.
  • src/DynamoCoreWpf/Properties/Resources.en-US.resx — add en-US PackageManagerNoNetworkModeToolTip.
  • src/DynamoCoreWpf/Properties/Resources.Designer.cs — regenerated public static getter.
  • src/WorkspaceDependencyViewExtension/Properties/Resources.resx — add invariant InstallButtonNoNetworkModeToolTip.
  • src/WorkspaceDependencyViewExtension/Properties/Resources.en-US.resx — add en-US InstallButtonNoNetworkModeToolTip.
  • src/WorkspaceDependencyViewExtension/Properties/Resources.Designer.cs — regenerated public static getter.
    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.

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.

  • In src/DynamoCoreWpf/Views/Core/DynamoView.xaml, on the three MenuItem elements publishSelected, publishCurrent, and showPM:
    • Add ToolTipService.ShowOnDisabled="True".
    • 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}".
  • Keep the existing Command bindings — the MenuItem disabled state already comes from CanPublishSelectedNodes / CanPublishCurrentWorkspace / CanShowPackageManager.
    Validation:
  • Launch Dynamo with --NoNetworkMode, open the Packages menu, hover each of the three items -> tooltip appears.
  • Launch Dynamo normally, open the Packages menu, hover each item -> no tooltip is shown.
    Requirements from spec:
  • Add tooltips describing PM is disabled in no-network mode (the explicit ticket ask).
    Files to Modify:
  • src/DynamoCoreWpf/Views/Core/DynamoView.xaml — extend three MenuItem elements inside the PackageManagerMenu block.
    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.

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.

  • In src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml, on the MenuItem named Publish bound to PublishCurrentWorkspaceCommand:
    • Add ToolTipService.ShowOnDisabled="True".
    • Add the same MenuItem.ToolTip + Style.Triggers pattern used in Task 2, with content PackageManagerNoNetworkModeToolTip.
  • Leave the existing Visibility binding on IsHomeSpace intact — it controls whether the item is shown at all (only on custom-node workspaces), independent of enabled state.
    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:
  • Tooltip coverage for the Publish action on custom-node workspaces (parity with the main Packages menu).
    Files to Modify:
  • src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml — extend the Publish MenuItem under the workspace context menu.
    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.

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.

  • In src/WorkspaceDependencyViewExtension/WorkspaceDependencyView.xaml.cs:
    • Add a public bool NoNetworkMode { get; private set; } property with an XML doc comment explaining its purpose.
    • In the existing constructor that takes ViewLoadedParams p, set NoNetworkMode = p.StartupParams.NoNetworkMode; next to the existing loadedParams = p; packageInstaller = p.PackageInstaller; assignments.
  • In src/WorkspaceDependencyViewExtension/WorkspaceDependencyView.xaml, on the DownloadPackageButton:
    • Move the existing Style="{StaticResource SmallTextButton}" into a Button.Style whose base style is SmallTextButton.
    • Add a Style.Triggers DataTrigger on Binding="{Binding NoNetworkMode, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="True" that sets IsEnabled="False".
    • Add ToolTipService.ShowOnDisabled="True".
    • 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).
  • Leave the Visibility="{Binding Path=ShowDownloadButton, Converter={StaticResource BoolToVis}}" binding intact — it remains the gate on whether the button is shown at all.
    Validation:
  • Launch Dynamo with --NoNetworkMode, open a graph that has missing package dependencies, switch to the Workspace References extension -> Install Specified Version is disabled and hovers show the tooltip.
  • Launch Dynamo normally -> the button is enabled and clicking it still invokes DownloadPackage as before.
    Requirements from spec:
  • We also need to disable install package button in workspace references extension and add tooltip. (verbatim from ticket description)
    Files to Modify:
  • src/WorkspaceDependencyViewExtension/WorkspaceDependencyView.xaml.cs — add NoNetworkMode property and constructor wiring.
  • src/WorkspaceDependencyViewExtension/WorkspaceDependencyView.xaml — convert DownloadPackageButton to a Button.Style-driven disable + tooltip.
    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.

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.

  • In test/DynamoCoreWpf2Tests/PackageManager/PackageManagerUnitTests.cs:
    • Add using Dynamo.Wpf.Properties; if not already present.
    • 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.
  • In test/DynamoCoreWpf2Tests/ViewExtensions/WorkspaceDependencyViewExtensionTests.cs:
    • Add [Test] public void WhenInstallButtonResourceStringRequestedThenItResolvesToNonEmpty() to the existing fixture, asserting !string.IsNullOrWhiteSpace(Resources.InstallButtonNoNetworkModeToolTip).
    • Add a new [TestFixture] public class WorkspaceDependencyViewExtensionNoNetworkModeTests : DynamoTestUIBase that overrides CreateStartConfiguration to return a DefaultStartConfiguration with NoNetworkMode = true, StartInTestMode = true, ProcessMode = TaskProcessMode.Synchronous, etc.
    • 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:
dotnet test test/DynamoCoreWpf2Tests/DynamoCoreWpf2Tests.csproj --filter "Name~WhenNoNetworkMode|Name~WhenInstallButtonResource"

All three new tests pass and no existing WorkspaceDependencyViewExtensionTests tests regress.
Requirements from spec:

  • Guard against silent breakage of the new resource keys (Dynamo's localization tooling occasionally trims unused entries).
  • Verify that the no-network startup flag actually flows into the extension view, which is the contract Task 4's XAML trigger depends on.
    Files to Modify:
  • test/DynamoCoreWpf2Tests/PackageManager/PackageManagerUnitTests.cs — one new test method.
  • test/DynamoCoreWpf2Tests/ViewExtensions/WorkspaceDependencyViewExtensionTests.cs — one new test method in the existing fixture, plus a new WorkspaceDependencyViewExtensionNoNetworkModeTests fixture.
    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.

Testing Strategy

Unit Tests

  • WhenNoNetworkModeTooltipResourceRequestedThenItResolvesToNonEmpty — PackageManagerNoNetworkModeToolTip resolves non-empty.
  • WhenInstallButtonResourceStringRequestedThenItResolvesToNonEmpty — InstallButtonNoNetworkModeToolTip resolves non-empty.

Integration Tests

  • WhenNoNetworkModeThenWorkspaceReferencesInstallButtonIsDisabled — boots Dynamo with NoNetworkMode = true via DynamoTestUIBase.CreateStartConfiguration, registers WorkspaceDependencyViewExtension, invokes Loaded(loadedParams), and verifies the extension view's NoNetworkMode property reflects the startup configuration.

Manual Testing Steps

  1. Build the full solution: msbuild src/Dynamo.All.sln /p:Configuration=Release.
  2. Launch Dynamo with the no-network flag: DynamoSandbox.exe --NoNetworkMode.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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).

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.

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.

@eamiri eamiri added kiln Created by kiln pr_ready PR is ready for review labels Jun 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8957

@eamiri eamiri added the editing Processing user comment label Jun 26, 2026
@eamiri eamiri marked this pull request as ready for review June 26, 2026 19:32
Copilot AI review requested due to automatic review settings June 26, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

editing Processing user comment kiln Created by kiln pr_ready PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants