From fb346acc44effecb0121e65ffa8c6a5e2faac0d8 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 18 Dec 2024 14:40:38 -0600 Subject: [PATCH] Move all pages into a nested navigation (#9097) * moving deck chairs * removing a too small function. And removing sample unit test * deleting separate sidebarNav component * moving test fixture * simplyfing a function * simplify data structures * running prettier * checking for search js before adding it * cleanup * adding some doc blocks and minor refactor * docs and cleanup * more comments * more cleanup * more comments more tests * adding all the front-end sites guides * removing extra nav alert in the middle of decouple overview pages * running prettier * going back to old prettier config files. Redo this change under https://github.com/pantheon-systems/documentation/issues/9082 * reporting files * reporting tests * more reporting tools * tests for reporting * more tests and console logging * moving reporting function * more testing of reporting * reporting * getting percentages calculated * adding contributors for exceptions examples * starting to unwind logic error that had percentages reversed * fixing logic * more logic fixing * getting close * 8%! * removing unused stuff * adding to menu * more menus * 55% * migrating and upgrading guides * more guides in menus * 199! * updating exceptions * Adding menu to video template * putting omni items in doc template * starting on DNS * putting everything in a menu * more sidebars * moving simpleLink to helper * breaking out file for submenu * breaking out menus * two more * breaking out menus * assigning menus * a few more assignments * getting doc template with sidebar * dns menus * lots of menu moving * Drupal and WordPress separate menus * moving menus * adding about section * everything in a top level menu * build tools menu link * comment about nested docroot * starting to add a styling file for omnisidebarnav * starting on styling * getting external link indicator working * remove extra arrow in link * removing console.log * workflows() * getting rendering of default docs pages working * code organizing * adding comment * adding comments * reporting on status codes * Moving submenus around * more * Adding label * Add vitest to GitHub actions (#9162) * Add vitest to GHA * Make a clean install * switching from jsx to React.createElement() * Update and rename test.yml to vitest.yml --------- Co-authored-by: Steve Persch Co-authored-by: Steve Persch * moving icon to back and setting to small * testing readme * fixing link * copy fix * changing addsearch back * addsearch back * adding vite.config.ts * some menu restructuring * menu reorgs * fixing page title * drupal notes and DNS titles * Refining menus with Rachel and Chris. And adding some JS todos * more menu tweaks with Rachel and Chris * fixup terminus template and submenu * whitespace to trigger build * more menu tweaking * terminus menu * adding a comment to a md file * working out a top-level nav * Coworking on submenus - integrations * manually bringing over files from main before merging * manually bringing over prettier config change from main * running prettier on some of the files in omniSidebarNav * Apply Prettier formatting * renaming dnsProviders * working on the migrate section * Apply Prettier formatting * Migration submenu edits * Apply Prettier formatting * Combine migration and getstarted submenus * Debug migration nested submenu * Apply Prettier formatting * Fix link to getstarted submenu * test pre-push hook * test pre-push hook * add prettier pre-push hook to .github/hooks * add git hooks section to readme * actually add the changed files to git * White spaces * Apply Prettier formatting * Apply Prettier formatting * Support submenu * Apply Prettier formatting * Move troubleshooting menu from webinfra * Apply Prettier formatting * Edits to support submenu * Apply Prettier formatting * Edits to accountmanagement submenu * Apply Prettier formatting * add comments * Apply Prettier formatting * Coworking session submenu updates * Apply Prettier formatting * finish workflows section * Apply Prettier formatting * web infra submenu * Apply Prettier formatting * more submenu work * Apply Prettier formatting * Add notes for merge blockers * Apply Prettier formatting * certification menu organizing * Apply Prettier formatting * updating links in header * Apply Prettier formatting * clean up a few links * Cleaning up education section * Apply Prettier formatting * cleaning up support menu * prettier * more reordering in troubleshooting * prettier * getting header functioning with menu of links * header cleanup * top level menu fixes * Apply Prettier formatting * moving a guide * Apply Prettier formatting * reviewing pages to delete * prettier * removing unused import * moving pages to delete * bring back search bar * Apply Prettier formatting * removing popover code * Apply Prettier formatting * removing popover code * Apply Prettier formatting * fixing import order * Apply Prettier formatting * landing page layout * landing page layout * Apply Prettier formatting * some comment cleanup * whitespace * cleaning up the drupal upgrade and migration stuff * moving around links * Apply Prettier formatting * menu updates * prettier * updating all-written-paths.txt * more menu updates * prettier * some cleanup * redistributing landing pages * prettier * Adding search to landing page * adding new pages to menu * prettier * Apply Prettier formatting * Deleting the unassignedPages submenu * redistributing some pages that were previously in "pages to delete" * For easier review, reorder based on work done in pr #9335 * Apply Prettier formatting * Finish pagestodelete submenu * Apply Prettier formatting * Delete all-written-paths.txt * Update source/content/guides/drush/04-drupal-commandline.md * removing todos that are done * Update src/components/omniSidebarNav/submenus/support.js * moving some reporting out of index * prettier * Apply suggestions from code review * Apply Prettier formatting * Terminus menu fix * Apply Prettier formatting --------- Co-authored-by: Chris Reynolds Co-authored-by: Rachel Whitton Co-authored-by: Pantheon Bot Co-authored-by: Chris Reynolds --- gatsby-node.js | 42 + gatsby-ssr.js | 1 + .../content/guides/backups/01-introduction.md | 2 +- .../guides/backups/02-access-backups.md | 2 +- .../guides/backups/03-create-backups.md | 2 +- .../guides/backups/04-restore-from-backup.md | 2 +- .../backups/05-code-archives-backups-log.md | 2 +- .../content/guides/backups/06-faqs-backups.md | 2 +- .../content/guides/domains/configure-dns.md | 21 - .../guides/drush/04-drupal-commandline.md | 6 +- .../10-continuous-integration.md | 2 +- .../09-database-connection-errors.md | 6 +- .../content/guides/sso/04-shibboleth-sso.md | 2 +- .../wordpress-developer/07-wordpress-s3.md | 1 + ...timize-wp-options-table-autoloaded-data.md | 2 +- .../omniSidebarNav/all-written-paths.js | 1613 +++++++++++++++++ .../omniSidebarNav/checkStatusCodes.js | 1517 ++++++++++++++++ src/components/omniSidebarNav/getOmniItems.js | 47 +- src/components/omniSidebarNav/helpers.js | 29 +- src/components/omniSidebarNav/helpers.test.js | 2 +- src/components/omniSidebarNav/index.js | 19 + .../omniSidebarNav/reporting-run.js | 0 src/components/omniSidebarNav/reporting.js | 105 ++ .../omniSidebarNav/reporting.test.js | 80 + src/components/omniSidebarNav/style.css | 9 +- .../omniSidebarNav/submenus/about.js | 23 + .../submenus/accountManagement.js | 38 + .../omniSidebarNav/submenus/certification.js | 155 +- .../omniSidebarNav/submenus/frontEndSites.js | 0 .../omniSidebarNav/submenus/getStarted.js | 52 + .../omniSidebarNav/submenus/goLive.js | 30 + .../omniSidebarNav/submenus/pagesToDelete.js | 30 + .../omniSidebarNav/submenus/security.js | 19 + .../omniSidebarNav/submenus/support.js | 122 ++ .../omniSidebarNav/submenus/terminus.js | 53 + .../submenus/webInfrastructure.js | 172 ++ .../omniSidebarNav/submenus/workflows.js | 59 + .../testfixtures/allPaths.testfixture.js | 99 + src/layout/header/index.js | 207 +-- src/pages/glossary.js | 159 +- src/templates/doc.js | 91 +- src/templates/guide.js | 2 +- src/templates/landing.js | 69 +- src/templates/terminuspage.js | 6 +- src/templates/video.js | 53 +- tests/playwright-tests/visuals.spec.ts | 28 + 46 files changed, 4538 insertions(+), 445 deletions(-) delete mode 100644 source/content/guides/domains/configure-dns.md create mode 100644 src/components/omniSidebarNav/all-written-paths.js create mode 100644 src/components/omniSidebarNav/checkStatusCodes.js create mode 100644 src/components/omniSidebarNav/reporting-run.js create mode 100644 src/components/omniSidebarNav/reporting.js create mode 100644 src/components/omniSidebarNav/reporting.test.js create mode 100644 src/components/omniSidebarNav/submenus/about.js create mode 100644 src/components/omniSidebarNav/submenus/accountManagement.js create mode 100644 src/components/omniSidebarNav/submenus/frontEndSites.js create mode 100644 src/components/omniSidebarNav/submenus/getStarted.js create mode 100644 src/components/omniSidebarNav/submenus/goLive.js create mode 100644 src/components/omniSidebarNav/submenus/pagesToDelete.js create mode 100644 src/components/omniSidebarNav/submenus/security.js create mode 100644 src/components/omniSidebarNav/submenus/support.js create mode 100644 src/components/omniSidebarNav/submenus/terminus.js create mode 100644 src/components/omniSidebarNav/submenus/webInfrastructure.js create mode 100644 src/components/omniSidebarNav/submenus/workflows.js create mode 100644 src/components/omniSidebarNav/testfixtures/allPaths.testfixture.js diff --git a/gatsby-node.js b/gatsby-node.js index d431b78b56..7297ca05b9 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -650,5 +650,47 @@ exports.onPreBootstrap = () => { fs.copySync(scriptsCopyFrom, scriptsCopyTo); }; +/* This block is for debugging purposes. It writes the paths of all pages to a file. +exports.onPostBuild = async ({ graphql, getNodes }) => { + // Fetch all pages created by Gatsby + const pages = getNodes().filter((node) => node.internal.type === 'SitePage'); + + //console.log('pages', pages); + //loop over pages and log the path + const pagePaths = pages.map((page) => page.path); + console.log('pagePaths', pagePaths); + pages.forEach((page) => { + console.log('path', page.path); + }); + + // const exceptions = ['https://certification.pantheon.io/', '/404.html']; + // const OmniItems = getOmniItems(); + // const menuReport = calculateNumberOfPathsInMenu(pagePaths, OmniItems, exceptions); + // console.log('menuReport', menuReport); + + fs.writeFile( + 'all-written-paths.txt', + JSON.stringify(pagePaths, null, 2), + (err) => { + if (err) throw err; + console.log('The file has been saved!'); + }, + ); + + // // Read the menu links from your menu file (assuming it's a JSON file) + // const menuFilePath = path.resolve(__dirname, 'src/data/menu.json'); + // const menuData = JSON.parse(fs.readFileSync(menuFilePath, 'utf-8')); + + // // Extract the paths from the menu links + // const menuLinks = menuData.map(item => item.path); + + // // Check how many pages are in the menu + // const pagesInMenu = pages.filter(page => menuLinks.includes(page.path)); + + // console.log(`Total Pages Created by Gatsby: ${pages.length}`); + // console.log(`Total Pages in Menu: ${pagesInMenu.length}`); +}; +*/ + /* todo Should there be an error thrown if a release note category is set that is not allowed? */ /* todo, infer published date from file name. And throw an error if there are files that don't follow the pattern. */ diff --git a/gatsby-ssr.js b/gatsby-ssr.js index 2c636681a8..89d03ef804 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -18,6 +18,7 @@ export const onRenderBody = ({ setPostBodyComponents }) => { src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" />,