Skip to content

navigationtree: a menu-document source is dropped by describe, replaced by exec, and Menu: is silently ignored #1189

Description

@tgolembiewski

mxcli version: v0.24.0 and main (f18c3077); Mendix 11.12.1, MPR v2, macOS

Summary

A navigationtree can draw its items from either a navigation profile (Forms$NavigationSource) or a menu document (Forms$MenuDocumentSource). mxcli supports only the profile. A menu-document source is lost in three ways, and none of them produces a diagnostic:

  1. describe drops it. Atlas_Core.Tablet_Sidebar's tree reads Atlas_Core.Tablet_Menu, and describe layout prints just navigationtree navigationTree3.
  2. exec replaces it. Executing that output writes a Forms$NavigationSource with profile Responsive, so the tablet layout now shows the desktop menu.
  3. Menu: is accepted and ignored. navigationtree nav (Menu: MyFirstModule.Side_Menu) passes check and exec, and is stored as Profile: 'Responsive'.

mx check reports 0 errors in every case.

Repro (blank project)

Round trip of a stock layout:

mxcli describe layout Atlas_Core.Tablet_Sidebar -p app.mpr \
  | sed 's/Atlas_Core.Tablet_Sidebar/MyFirstModule.Tablet_Copy/' > tcopy.mdl
mxcli exec tcopy.mdl -p app.mpr
mxcli describe layout MyFirstModule.Tablet_Copy -p app.mpr | grep navigationtree
#   navigationtree navigationTree3 (Profile: 'Responsive')
mxcli bson dump -p app.mpr --type layout --object Atlas_Core.Tablet_Sidebar     # MenuSource: Forms$MenuDocumentSource, Menu: Atlas_Core.Tablet_Menu
mxcli bson dump -p app.mpr --type layout --object MyFirstModule.Tablet_Copy     # MenuSource: Forms$NavigationSource, NavigationProfile: Responsive

Writing the source directly:

create or modify menu MyFirstModule.Side_Menu (
  menu item 'Home' page MyFirstModule.Home_Web;
);
create layout MyFirstModule.Side_Layout (layouttype: 'Responsive') {
  scrollcontainer layoutContainer {
    region left (Size: 232, SizeMode: 'Pixels') {
      navigationtree navSidebar (Menu: MyFirstModule.Side_Menu)
    }
    region center { placeholder Main }
  }
}

check → Check passed!; exec → Created layout; describe → navigationtree navSidebar (Profile: 'Responsive').

Eight other stock layouts carry a Forms$MenuDocumentSource: Phone_Sidebar's tree, and the SimpleMenuBar of Phone_Default, Phone_BottomBar, Tablet_Default, Tablet_BottomBar and the three Tablet_Split_* layouts. describe already flags SimpleMenuBar as not re-executable, so only the tree loses its source silently.

Cause

  • buildNavigationTreeV3 (mdl/executor/cmd_pages_builder_v3.go) reads only Profile, so any other property is ignored.
  • widgetToGen (mdl/backend/modelsdk/widget_write.go) always writes a NavigationSource and defaults an empty profile to "Responsive".
  • cmd_pages_describe_parse.go reads MenuSource.NavigationProfile only, so a MenuDocumentSource comes out empty.

MenuBar has the same three paths.

Suggested fix

  • Add Menu: Module.MenuName to navigationtree and menubar, written as Forms$MenuDocumentSource (Menu by name, as in the stock layouts).
  • describe prints Menu: for such a tree, so the round trip keeps it.
  • Menu: together with Profile: is an error.
  • check --references resolves the menu document.

Happy to open the PR.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions