From 21e5b292c443d38aa3a4b1d6981b24f33ec09f7d Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Wed, 6 Dec 2023 09:25:22 -0800 Subject: [PATCH] working query and beginning of page - not clickable sidenav for VA Police --- src/site/constants/content-modeling.js | 1 + .../vamc_system_va_police.drupal.liquid | 214 ++++++++++++++++++ .../graphql/CountEntityTypes.graphql.js | 10 + .../build/drupal/graphql/vaPolice.graphql.js | 86 +++++++ .../stages/build/drupal/individual-queries.js | 3 +- src/site/stages/build/drupal/page.js | 1 + 6 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 src/site/layouts/vamc_system_va_police.drupal.liquid create mode 100644 src/site/stages/build/drupal/graphql/vaPolice.graphql.js diff --git a/src/site/constants/content-modeling.js b/src/site/constants/content-modeling.js index f840750ae2..6ad6f35959 100644 --- a/src/site/constants/content-modeling.js +++ b/src/site/constants/content-modeling.js @@ -41,6 +41,7 @@ const ENTITY_BUNDLES = { VA_FORM: 'va_form', VAMC_OPERATING_STATUS_AND_ALERTS: 'vamc_operating_status_and_alerts', VBA_FACILITY: 'vba_facility', + VA_POLICE_PAGE: 'va_police', }; module.exports = { diff --git a/src/site/layouts/vamc_system_va_police.drupal.liquid b/src/site/layouts/vamc_system_va_police.drupal.liquid new file mode 100644 index 0000000000..b52d748521 --- /dev/null +++ b/src/site/layouts/vamc_system_va_police.drupal.liquid @@ -0,0 +1,214 @@ +{% include "src/site/includes/header.html" %} +{% include "src/site/includes/preview-edit.drupal.liquid" %} +{% include "src/site/includes/breadcrumbs.drupal.liquid" with hideHomeBreadcrumb = true %} + +
+
+
+ {% include 'src/site/navigation/facility_sidebar_nav.drupal.liquid' with sidebarData = facilitySidebar %} +
+
+ {% include "src/site/includes/lovell-switch-link.drupal.liquid" with + entityUrl = entityUrl + %} + +

{{ title }}

+ {% assign image = fieldMedia.entity.image %} + +
+ +
+ +
+ {% assign basePath = entityUrl.path | regionBasePath %} + {% include "src/site/facilities/main_buttons.drupal.liquid" with path = basePath %} +
+ + {% if fieldIntroText != empty %} +
+

{{ fieldIntroText }}

+
+ {% endif %} + +
+

+ Locations

+ {% for main in mainFacilities.entities %} + {% include 'src/site/includes/facilityListing.drupal.liquid' with + entity = main + fieldVaHealthConnectPhone = fieldVaHealthConnectPhone + %} + {% endfor %} + See all locations   + +
+ + + {% comment %} Hide this section for Lovell TRICARE {% endcomment %} + {% if fieldAdministration.entity.entityId != '1039' %} +
+ {% if fieldAdministration.entity.entityId == '1040' %} +

Manage your VA health online

+ {% else %} +

Manage your health online

+ {% endif %} + +
+ {% endif %} + + + +
+ {% include "src/site/paragraphs/facilities/list_of_link_teasers_facility.drupal.liquid" + with paragraph = fieldRelatedLinks.entity + regionNickname = title + %} +
+ + {% assign header = "h3" %} + + {% if newsStoryTeasersFeatured.entities.0.reverseFieldListingNode.entities.length %} + {% assign featuredStories = newsStoryTeasersFeatured.entities.0.reverseFieldListingNode.entities %} +
+

+ Stories

+ + {% for story in featuredStories limit:2 %} + {% assign node = story %} + {% include "src/site/teasers/news_story.drupal.liquid" with node = story %} + {% endfor %} + + See all stories + +
+ {% endif %} + + + {% if eventTeasersFeatured.entities.0.reverseFieldListingNode.entities.length %} +
+

+ Events

+ {% for event in eventTeasersFeatured.entities.0.reverseFieldListingNode.entities %} + {% assign node = event %} + {% include "src/site/teasers/event.drupal.liquid" %} + {% endfor %} + + See all events + +
+ {% elsif eventTeasersAll.entities.0.reverseFieldListingNode.entities.length %} + {% assign upcomingEvents = eventTeasersAll.entities.0.reverseFieldListingNode.entities %} + {% assign sortedEvents = upcomingEvents | filterAndSortEvents %} +
+

+ Events

+ {% for event in sortedEvents limit:1 %} + {% assign node = event %} + {% include "src/site/teasers/event.drupal.liquid" %} + {% endfor %} + + See all events + +
+ {% endif %} + {% include "src/site/facilities/facility_social_links.drupal.liquid" with regionNickname = title %} + +
+ + {% include "src/site/includes/above-footer-elements.drupal.liquid" %} +
+
+
+ {% include "src/site/includes/footer.html" %} + {% include "src/site/includes/debug.drupal.liquid" %} diff --git a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js index 21151c87cb..d3807596ba 100644 --- a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js +++ b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js @@ -71,6 +71,16 @@ const CountEntityTypes = ` count } + vaPolicePage: nodeQuery( + filter: { + conditions: [ + {field: "status", value: ["1"]}, + {field: "type", value: ["vamc_system_va_police"]} + ]} + ) { + count + } + healthServicesListing: nodeQuery( filter: { conditions: [ diff --git a/src/site/stages/build/drupal/graphql/vaPolice.graphql.js b/src/site/stages/build/drupal/graphql/vaPolice.graphql.js new file mode 100644 index 0000000000..9defc93ac6 --- /dev/null +++ b/src/site/stages/build/drupal/graphql/vaPolice.graphql.js @@ -0,0 +1,86 @@ +const { generatePaginatedQueries } = require('../individual-queries-helpers'); + +const draftContentOverride = process.env.UNPUBLISHED_CONTENT === 'true'; +const entityElementsFromPages = require('./entityElementsForPages.graphql'); + +const vaPoliceFragment = ` + fragment vaPoliceFragment on NodeVamcSystemVaPolice { + ${entityElementsFromPages} + ... on NodeVamcSystemVaPolice { + fieldOffice { + entity { + ... on NodeHealthCareRegionPage { + entityLabel + title + } + } + } + title + entityLabel + fieldCcFaq { + fetched + } + fieldCcVaPoliceOverview { + fetched + } + fieldCcTermDefinitionsNation { + fetched + } + fieldCcPoliceReport{ + fetched + } + fieldAdministration { + entity{ + name + path { + alias + pid + langcode + pathauto + } + } + } + } + }`; + +const getVaPoliceSlice = (operationName, offset, limit) => { + return ` + ${vaPoliceFragment} + + query GetVaPolicePages${ + !draftContentOverride ? '($onlyPublishedContent: Boolean!)' : '' + } { + nodeQuery( + limit: ${limit} + offset: ${offset} + filter: { + conditions: [ + ${ + !draftContentOverride + ? '{ field: "status", value: ["1"], enabled: $onlyPublishedContent },' + : '' + } + { field: "type", value: ["vamc_system_va_police"] } + ] + }) { + entities { + ... vaPoliceFragment + } + } + } +`; +}; + +const getVaPoliceQueries = entityCounts => { + return generatePaginatedQueries({ + operationNamePrefix: 'GetVaPolicePages', + entitiesPerSlice: 25, + totalEntities: entityCounts.data.vaPolicePage.count, + getSlice: getVaPoliceSlice, + }); +}; + +module.exports = { + fragment: vaPoliceFragment, + getVaPoliceQueries, +}; diff --git a/src/site/stages/build/drupal/individual-queries.js b/src/site/stages/build/drupal/individual-queries.js index c059c5e557..cfdbe66bd2 100644 --- a/src/site/stages/build/drupal/individual-queries.js +++ b/src/site/stages/build/drupal/individual-queries.js @@ -98,7 +98,7 @@ const { const { getVetCenterQueries } = require('./graphql/vetCenter.graphql'); const { getVbaFacilityQueries } = require('./graphql/vbaFacility.graphql'); - +const { getVaPoliceQueries } = require('./graphql/vaPolice.graphql'); const { GetVetCenterLocations, } = require('./graphql/vetCenterLocations.graphql'); @@ -122,6 +122,7 @@ function getNodeQueries(entityCounts) { GetNodePressReleaseListingPages, ...getNodeEventListingQueries(entityCounts), ...getNodeEventQueries(entityCounts), + ...getVaPoliceQueries(entityCounts), GetNodeStoryListingPages, GetNodeLocationsListingPages, GetNodeLeadershipListingPages, diff --git a/src/site/stages/build/drupal/page.js b/src/site/stages/build/drupal/page.js index bbc71b2897..c268c534d7 100644 --- a/src/site/stages/build/drupal/page.js +++ b/src/site/stages/build/drupal/page.js @@ -452,6 +452,7 @@ function compilePage(page, contentData) { case 'health_care_region_page': case 'press_release': case 'vba_facility': + case 'vamc_system_va_police': pageCompiled = Object.assign( page, facilitySidebarNavItems,