Skip to content

Render view components

The shared layouts invoke three view components for the page chrome. Each returns its own view or the shared error view.

Field Value
Operation ID OP-14
Trigger Layout rendering
Inputs BusinessOnlineMenu, current page name, BolPolicyModel, error message
Outputs HTML fragments
Primary components BolSideMenuViewComponent, BolTopMenuViewComponent, BolPolicyHeaderViewComponent
Entry point src/BolMiddleware/ViewComponents/BolSideMenuViewComponent.cs

Steps

  1. The side and top menu components receive the menu and current page. If the menu is null they return the Error view (BR-BOLMIDDLEWARE-016).
  2. Otherwise they build a BolMenuViewModel and return the component view, which lists favorites and menu items through _BolMenuItemPartial. The top menu filters items by the configured AppMenuCategory.
  3. The policy header component returns the Error view when the error message is not empty (BR-BOLMIDDLEWARE-017); otherwise it renders the policy header view, which uses Build policy dropdown when allowed.
  4. The page header partial shows profile and logoff links only for external users, using account.saif.com for production environments and account-qa.saif.com otherwise (BR-BOLMIDDLEWARE-018).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Layout renders]) --> D1{Menu is null?}
    D1 -->|Yes| E1([Error view])
    D1 -->|No| S1[Render menu view]
    S1 --> D2{Policy error message?}
    D2 -->|Yes| E2([Error view with message])
    D2 -->|No| S2[Render policy header]
    S2 --> D3{External user?}
    D3 -->|Yes| S3[Show profile and logoff links]
    D3 -->|No| EndOk([Done])
    S3 --> EndOk

Failure and edge-case behavior

  • InvokeAsync methods are declared async but never await, so the compiler warns and the work is synchronous.
  • The layouts pass an extra showPolicyDropdown argument to BolPolicyHeader that the component does not declare.
  • _MenuOnlyLayout references the static assets under _content/bolMiddleware in lowercase, which can fail on case-sensitive hosts.
  • The header partial treats any environment name containing prod, including preprod, as production.

Sources

  • src/BolMiddleware/ViewComponents/BolSideMenuViewComponent.cs
  • src/BolMiddleware/ViewComponents/BolTopMenuViewComponent.cs
  • src/BolMiddleware/ViewComponents/BolPolicyHeaderViewComponent.cs
  • src/BolMiddleware/Pages/Components/BolSideMenu/default.cshtml
  • src/BolMiddleware/Pages/Components/BolTopMenu/default.cshtml
  • src/BolMiddleware/Pages/Components/BolPolicyHeader/default.cshtml
  • src/BolMiddleware/Pages/Shared/_BolPageHeaderPartial.cshtml
  • src/BolMiddleware/Pages/Shared/_MenuOnlyLayout.cshtml