Skip to content

feat: ALTER NAVIGATION — incremental menu item operations #153

@engalar

Description

@engalar

Problem

CREATE OR REPLACE NAVIGATION requires a full replacement of the navigation profile. Adding or removing a single menu item means:

  1. DESCRIBE NAVIGATION Responsive — read current state
  2. Manually edit the full menu tree
  3. CREATE OR REPLACE NAVIGATION Responsive ... — write it back

This round-trip is error-prone and verbose for small changes.

Proposed Solution

Add ALTER NAVIGATION with incremental operations, consistent with the existing ALTER PAGE / ALTER ENTITY / ALTER SNIPPET pattern.

Syntax

ALTER NAVIGATION Responsive {
  -- Add a top-level menu item
  ADD MENU ITEM 'Reports' PAGE MyModule.Reports_Overview;

  -- Add into a named sub-menu (multi-level: 'Parent > Child')
  ADD MENU ITEM 'Detail' PAGE MyModule.Reports_Detail IN 'Reports';

  -- Add a sub-menu group
  ADD MENU 'Settings' (
    MENU ITEM 'Users' PAGE Administration.Account_Overview;
    MENU ITEM 'Config' PAGE MyModule.Config_Edit;
  );

  -- Remove by caption (exact match, case-sensitive)
  REMOVE MENU ITEM 'Old Feature';

  -- Remove with path disambiguation
  REMOVE MENU ITEM 'Orders' IN 'Admin';

  -- Change home/login page without touching menu structure
  SET HOME PAGE MyModule.NewHome;
  SET LOGIN PAGE Administration.Login;
}

Path Disambiguation

  • IN 'Parent' — appends to the named sub-menu
  • IN 'Parent > Child' — multi-level path, separated by >
  • No IN — operates at the top level

Error Handling

Condition Behavior
Target PAGE/MICROFLOW not found Error (consistent with existing commands)
IN path not found Error: Menu 'Parent > Child' not found
REMOVE caption not found Error (no silent failure)
REMOVE caption ambiguous (multiple matches) Error: suggest using IN to disambiguate
ADD duplicate caption under same parent Error
Profile name not found Error (consistent with existing commands)
Multiple operations, failure mid-way Full rollback, original menu unchanged

Compatibility

  • CREATE OR REPLACE NAVIGATION remains unchanged — full-replacement workflow still works
  • ALTER NAVIGATION is purely additive to the command set
  • References validated by mxcli check --references (PAGE/MICROFLOW targets)

Motivation

When building or updating a Mendix app via MDL scripts, navigation changes are frequent and typically involve one or two items at a time. A fine-grained ALTER NAVIGATION command would make scripts shorter, safer, and easier to review — matching the ergonomics already established by ALTER PAGE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions