department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
97 stars 69 forks source link

Lovell editors cannot create VAMC Detail Pages #12379

Closed omahane closed 1 year ago

omahane commented 1 year ago

Describe the defect

After the content change on Production on Monday, January 1, the Lovell editors reported that they were unable to create a VAMC Detail Page.

To Reproduce

Steps to reproduce the behavior: Log as a

  1. Log in as a Lovell editor
  2. Go to https://prod.cms.va.gov/node/add/health_care_region_detail_page
  3. Fill out required fields
  4. Click Save
  5. An error is shown that says "1 error has been found: Parent link", but the Menu, which includes a dropdown for the Parent Link, is not shown.

AC / Expected behavior

Lovell editors should be able to create and save a VAMC Detail Page in one of the Lovell systems.

Screenshots

screencapture-staging-cms-va-gov-node-add-health-care-region-detail-page-2023-01-31-09_53_55

Labels

(You can delete this section once it's complete)

Team

Please check the team(s) that will do this work.

omahane commented 1 year ago

The solution for this was to change the configuration, specifically the

va_gov_menu_access.paths

and

va_gov_menu_access.locked_paths

Up until now, all systems links ended with "-health-care", but Lovell links do not follow that pattern, having either "-tricare" or "-va" after "-health-care". We changed the config accordingly.

Screen Shot 2023-02-01 at 9 41 26 AM

This is available in the UI at https://prod.cms.va.gov/admin/config/content/va_gov_menu_access

The code this is as follows:

docroot/modules/custom/va_gov_menu_access/va_gov_menu_access.module

  1. instantiates the service defined in va_gov_menu_access/src/Service/MenuReductionService.php
    1. __constructor calls buildMenuAccessRules()
      1. uses the config: va_gov_menu_access.paths and va_gov_menu_access.locked_paths
      2. populates menuRules['universal_parent_menu_items'][] from the config
      3. populates menuRules['universal_locked_paths'][] from the config
      4. populates menuRules['single_locked_paths'][] from the config
  2. va_vog_menu_access.module calls reduceForm() from MenuReductionService.php , which calls
    1. applyVamcMenuRulesForDetailPage
      1. getMenuItemType
        1. checkForDisabledParentWithChildren
          1. iterates through menuRules['universal_parent_menu_items']
        2. checkForTypeDisabledParent
          1. iterates through menuRules['universal_parent_menu_items']
        3. checkForSimpleMatch
          1. iterates through menuRules['universal_parent_menu_items']
      2. addAllowedParent
        1. This looks at each menu parent link and adds "| Disabled" or "| Disabled no-link"
        2. This could be where we see if this is Lovell, if Lovell and to add VA or TRICARE to make it clear to editors about which system a parent link is in, if that's the direction we choose for solving #12303