diff --git a/config/facets.facet_source.search_api__views_page__goals__page_1.yml b/config/facets.facet_source.search_api__views_page__goals__page_1.yml new file mode 100644 index 00000000..74bd265e --- /dev/null +++ b/config/facets.facet_source.search_api__views_page__goals__page_1.yml @@ -0,0 +1,9 @@ +uuid: fcf79d3f-f238-4dd6-9faa-fc2c68fb6b2f +langcode: en +status: true +dependencies: { } +id: search_api__views_page__goals__page_1 +name: 'search_api:views_page__goals__page_1' +filter_key: null +url_processor: query_string +breadcrumb: { } diff --git a/config/graphql_compose.settings.yml b/config/graphql_compose.settings.yml index 4fed4bca..c77e363c 100644 --- a/config/graphql_compose.settings.yml +++ b/config/graphql_compose.settings.yml @@ -86,6 +86,9 @@ entity_config: enabled: true indicator: enabled: true + query_load_enabled: true + edges_enabled: true + routes_enabled: true measurement: enabled: true period: diff --git a/config/search_api.index.goals.yml b/config/search_api.index.goals.yml index a1de1900..a3c215a4 100644 --- a/config/search_api.index.goals.yml +++ b/config/search_api.index.goals.yml @@ -8,12 +8,22 @@ dependencies: - search_api.server.database_search module: - node + - storage - taxonomy id: goals name: Goals description: '' read_only: false field_settings: + aggregated_administration: + label: 'Aggregated administration' + property_path: aggregated_field + type: string + configuration: + type: union + fields: + - 'entity:node/field_administration' + - 'entity:storage/field_administration' aggregated_field: label: 'Aggregated field' property_path: aggregated_field @@ -25,6 +35,15 @@ field_settings: - 'entity:node/field_agency' - 'entity:node/field_goals' - 'entity:node/title' + aggregated_type: + label: type + property_path: aggregated_field + type: string + configuration: + type: union + fields: + - 'entity:node/type' + - 'entity:storage/type' field_administration: label: Administration datasource_id: 'entity:node' @@ -53,6 +72,14 @@ datasource_settings: languages: default: true selected: { } + 'entity:storage': + bundles: + default: false + selected: + - indicator + languages: + default: true + selected: { } processor_settings: add_url: { } aggregated_field: { } diff --git a/config/views.view.goals.yml b/config/views.view.goals.yml index eda3fe4a..263c2da2 100644 --- a/config/views.view.goals.yml +++ b/config/views.view.goals.yml @@ -399,10 +399,10 @@ display: options: { } empty: { } sorts: - aggregated_field: - id: aggregated_field + search_api_relevance: + id: search_api_relevance table: search_api_index_goals - field: aggregated_field + field: search_api_relevance relationship: none group_type: group admin_label: '' @@ -684,86 +684,138 @@ display: sort: 50 settings: sort: ASC - field_administration: - id: field_administration + facets_aggregated_administration: + id: facets_aggregated_administration table: search_api_index_goals - field: field_administration + field: facets_aggregated_administration relationship: none group_type: group admin_label: '' - plugin_id: search_api_numeric - operator: '!=' - value: - min: '' - max: '' - value: '54' + plugin_id: facets_filter + operator: '=' + value: '' group: 1 - exposed: false + exposed: true expose: - operator_id: field_administration_op - label: Administration - description: null + operator_id: '' + label: 'Aggregated administration' + description: '' use_operator: false - operator: field_administration_op + operator: '' operator_limit_selection: false operator_list: { } - identifier: field_administration + identifier: aggregated_administration required: false remember: false - multiple: false + multiple: true remember_roles: authenticated: authenticated - min_placeholder: null - max_placeholder: null - placeholder: null + anonymous: '0' + content_editor: '0' + administrator: '0' + next_js_site: '0' is_grouped: false group_info: - label: Administration - description: null - identifier: field_administration + label: '' + description: '' + identifier: '' optional: true widget: select multiple: false remember: false default_group: All default_group_multiple: { } - group_items: - 1: { } - 2: { } - 3: { } - field_administration_1: - id: field_administration_1 + group_items: { } + hierarchy: false + label_display: visible + facet: + query_operator: or + min_count: 1 + show_numbers: false + processor_configs: { } + facets_aggregated_type: + id: facets_aggregated_type table: search_api_index_goals - field: field_administration + field: facets_aggregated_type relationship: none group_type: group admin_label: '' - plugin_id: search_api_numeric + plugin_id: facets_filter operator: '=' - value: - min: '' - max: '' - value: '' + value: '' group: 1 exposed: true expose: - operator_id: field_administration_1_op - label: Administration + operator_id: '' + label: type description: '' use_operator: false - operator: field_administration_1_op + operator: '' operator_limit_selection: false operator_list: { } - identifier: Administration + identifier: aggregated_type required: false remember: false - multiple: false + multiple: true remember_roles: authenticated: authenticated anonymous: '0' content_editor: '0' administrator: '0' next_js_site: '0' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + hierarchy: false + label_display: visible + facet: + query_operator: or + min_count: 1 + show_numbers: true + processor_configs: + raw_value_widget_order: + weights: + sort: 50 + settings: + sort: ASC + aggregated_administration: + id: aggregated_administration + table: search_api_index_goals + field: aggregated_administration + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_string + operator: '!=' + value: + min: '' + max: '' + value: '46' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated min_placeholder: '' max_placeholder: '' placeholder: '' @@ -808,6 +860,221 @@ display: display_plugin: page position: 1 display_options: + filters: + aggregated_field: + id: aggregated_field + table: search_api_index_goals + field: aggregated_field + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_string + operator: '=' + value: + min: '' + max: '' + value: '' + group: 1 + exposed: true + expose: + operator_id: aggregated_field_op + label: 'Aggregated field' + description: '' + use_operator: false + operator: aggregated_field_op + operator_limit_selection: false + operator_list: { } + identifier: aggregated_field + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + content_editor: '0' + administrator: '0' + next_js_site: '0' + min_placeholder: '' + max_placeholder: '' + placeholder: '' + is_grouped: false + group_info: + label: 'Aggregated field' + description: null + identifier: aggregated_field + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: + 1: { } + 2: { } + 3: { } + facets_name: + id: facets_name + table: search_api_index_goals + field: facets_name + relationship: none + group_type: group + admin_label: '' + plugin_id: facets_filter + operator: '=' + value: '' + group: 1 + exposed: true + expose: + operator_id: '' + label: 'Topics » Taxonomy term » Name' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: Topics + required: false + remember: false + multiple: true + remember_roles: + authenticated: authenticated + anonymous: '0' + content_editor: '0' + administrator: '0' + next_js_site: '0' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + hierarchy: false + label_display: visible + facet: + query_operator: or + min_count: 1 + show_numbers: true + processor_configs: + combine_processor: + weights: + build: 5 + settings: { } + raw_value_widget_order: + weights: + sort: 50 + settings: + sort: ASC + facets_aggregated_type: + id: facets_aggregated_type + table: search_api_index_goals + field: facets_aggregated_type + relationship: none + group_type: group + admin_label: '' + plugin_id: facets_filter + operator: '=' + value: '' + group: 1 + exposed: true + expose: + operator_id: '' + label: type + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: aggregated_type + required: false + remember: false + multiple: true + remember_roles: + authenticated: authenticated + anonymous: '0' + content_editor: '0' + administrator: '0' + next_js_site: '0' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + hierarchy: false + label_display: visible + facet: + query_operator: or + min_count: 1 + show_numbers: false + processor_configs: { } + facets_aggregated_administration: + id: facets_aggregated_administration + table: search_api_index_goals + field: facets_aggregated_administration + relationship: none + group_type: group + admin_label: '' + plugin_id: facets_filter + operator: '=' + value: '' + group: 1 + exposed: true + expose: + operator_id: '' + label: 'Aggregated administration' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: aggregated_administration + required: false + remember: false + multiple: true + remember_roles: + authenticated: authenticated + anonymous: '0' + content_editor: '0' + administrator: '0' + next_js_site: '0' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + hierarchy: false + label_display: visible + facet: + query_operator: or + min_count: 1 + show_numbers: false + processor_configs: { } + filter_groups: + operator: AND + groups: + 1: AND + defaults: + filters: false + filter_groups: false display_extenders: { } path: goals cache_metadata: diff --git a/src/frontend/components/field--goal-type.tsx b/src/frontend/components/field--goal-type.tsx index fdabcfda..6d0e34d2 100644 --- a/src/frontend/components/field--goal-type.tsx +++ b/src/frontend/components/field--goal-type.tsx @@ -6,6 +6,10 @@ export function FieldGoalType({ field_goal_type }) { goalTypeName = "Agency priority goal"; goalTypeClasses = "bg-primary-vivid"; break; + case "pma": + goalTypeName = "PMA"; + goalTypeClasses = "bg-primary-vivid"; + break; case "strategic": goalTypeName = "Strategic goal"; goalTypeClasses = "bg-base-darkest"; @@ -18,6 +22,10 @@ export function FieldGoalType({ field_goal_type }) { goalTypeName = "Plan"; goalTypeClasses = "bg-base-darkest"; break; + case "indicator": + goalTypeName = "Indicator"; + goalTypeClasses = "bg-base-darkest"; + break; default: goalTypeName = "Default" goalTypeClasses = "bg-base"; diff --git a/src/frontend/components/field--objectives.tsx b/src/frontend/components/field--objectives.tsx index 912eba77..1585ec93 100644 --- a/src/frontend/components/field--objectives.tsx +++ b/src/frontend/components/field--objectives.tsx @@ -72,13 +72,3 @@ export function FieldObjectives({fieldObjectives} : FieldObjectiveProps) { ); } - - // return( - //
  • - // - // {goal.title} - // - // - //
  • \ No newline at end of file diff --git a/src/frontend/components/field--period.tsx b/src/frontend/components/field--period.tsx index e4a99608..0c050e07 100644 --- a/src/frontend/components/field--period.tsx +++ b/src/frontend/components/field--period.tsx @@ -1,15 +1,17 @@ -export function FieldPeriod({field_period}) { - if (!field_period?.name) { +export function FieldPeriod({startTime, endTime}) { + if (!startTime) { return ( default ) } - let period = field_period.name.startsWith("FY") ? field_period.name.replace(/^[^0-9]+/, '') : field_period.name; + const startDate = new Date(startTime); + const endDate = new Date(endTime) + const dateOptions: Intl.DateTimeFormatOptions = {year: "numeric"} return ( - {period} + {startDate.toLocaleDateString('en-US', dateOptions)}-{endDate.toLocaleDateString('en-US', dateOptions).substr(-2)} ); } diff --git a/src/frontend/components/indicator-chart.tsx b/src/frontend/components/indicator-chart.tsx new file mode 100644 index 00000000..917326a8 --- /dev/null +++ b/src/frontend/components/indicator-chart.tsx @@ -0,0 +1,53 @@ +import { LineChart, Line, CartesianGrid, XAxis, YAxis } from 'recharts'; + +function buildChartData(names, targetValues, actualValues) { + let dataArray = []; + if(!names) { + return []; + } + names.forEach((name, index) => { + dataArray.push({ + name: name, + Targets: targetValues[index], + Actuals: actualValues[index], + }) + }) + return dataArray +} + +const IndicatorChart = ({names, targetValues, values, size}) => { + let height = 300; + let width = 600; + if (!names || !targetValues || !values) { + return null; + } + const data = buildChartData(names, targetValues, values); + if (size === "small") { + width = 300; + height = 150; + } + return ( +
    + + + + + {size !== "small" && ( + <> + + + new Intl.NumberFormat("en-US", { + notation: "compact", + compactDisplay: "short", + }).format(value) + } + /> + + )} + +
    + ) +} + +export default IndicatorChart; diff --git a/src/frontend/components/node--goal--card.tsx b/src/frontend/components/node--goal--card.tsx index 085df651..8bad70d6 100644 --- a/src/frontend/components/node--goal--card.tsx +++ b/src/frontend/components/node--goal--card.tsx @@ -22,7 +22,10 @@ export function NodeGoalCard({ goal, ...props }: NodeGoalCardProps) {
    - +

    {title}

    diff --git a/src/frontend/components/node--plan--card.tsx b/src/frontend/components/node--plan--card.tsx index 4cc78306..2699c916 100644 --- a/src/frontend/components/node--plan--card.tsx +++ b/src/frontend/components/node--plan--card.tsx @@ -9,8 +9,8 @@ interface NodePlanCardProps { goal: NodePlanProps } -export function NodePlanCard({ goal, ...props }: NodePlanCardProps) { - const { title, path, agency, period } = goal; +export function NodePlanCard({ goal, ...props }: any) { + const { title, path, agency, administration } = goal; const { acronym: agencyAcronym, logo: agencyLogo, title: agencyTitle } = agency; return (
    @@ -19,7 +19,10 @@ export function NodePlanCard({ goal, ...props }: NodePlanCardProps) {
    - +

    {title}

    diff --git a/src/frontend/components/node--plan.tsx b/src/frontend/components/node--plan.tsx index bebf3f33..ed371d97 100644 --- a/src/frontend/components/node--plan.tsx +++ b/src/frontend/components/node--plan.tsx @@ -1,5 +1,6 @@ import { useRef, useState } from "react"; import Link from 'next/link' +import Image from "next/image"; import { DrupalNode } from "next-drupal"; import { Icon, Button, ButtonGroup } from "@trussworks/react-uswds"; import Masonry, { ResponsiveMasonry } from "react-responsive-masonry" @@ -157,26 +158,32 @@ export function NodePlan({ node, storageData, ...props }: NodePlanProps) {
      - - {field_goals.map((goal) => { - return ( - -
      -
      -

      {goal.title}

      -
      -
      + gutterBreakpoints={{350: "12px", 750: "16px", 900: "24px"}} + > + + {storageData.goals?.map((goal) => { + return( + +
      +
      +

      {goal.title}

      +
      +
      + {goal?.image?.mediaImage && (
      - {/* A placeholder image */} + {goal.image.mediaImage.alt}
      -
      + )}
      - +
      + ) })} diff --git a/src/frontend/components/objective-indicator.tsx b/src/frontend/components/objective-indicator.tsx index 516be2a5..76502c68 100644 --- a/src/frontend/components/objective-indicator.tsx +++ b/src/frontend/components/objective-indicator.tsx @@ -2,26 +2,11 @@ import { formatDate } from "lib/utils"; import { LineChart, Line, CartesianGrid, XAxis, YAxis } from 'recharts'; import { useState } from "react"; import { Icon } from "@trussworks/react-uswds"; - -function buildChartData(names, targetValues, actualValues) { - let dataArray = []; - if(!names) { - return []; - } - names.forEach((name, index) => { - dataArray.push({ - name: name, - Targets: targetValues[index], - Actuals: actualValues[index], - }) - }) - return dataArray -} +import IndicatorChart from "./indicator-chart"; const ObjectiveIndicator = ({indicator, borders}) => { const [open, setOpen] = useState(false) const { name, measurements } = indicator; - const data = buildChartData(indicator.names, indicator.targetValues, indicator.values); return(
      -
      - - - - - - - -
      + {indicator.notes?.processed && (
      )} diff --git a/src/frontend/components/storage--indicator--card.tsx b/src/frontend/components/storage--indicator--card.tsx new file mode 100644 index 00000000..bd249b24 --- /dev/null +++ b/src/frontend/components/storage--indicator--card.tsx @@ -0,0 +1,47 @@ +import Link from 'next/link' +import { NodePlanProps } from "lib/types"; +import Image from "next/image"; +import AgencyInfoBox from './agency-info-box'; +import { FieldGoalType } from './field--goal-type'; +import { FieldPeriod } from './field--period'; +import IndicatorChart from './indicator-chart'; + +export function StorageIndicatorCard({ goal, ...props }: any) { + const { description, objective } = goal; + const chartData = objective.indicators.find((indicator) => (indicator.id == goal.id)); + return ( +
      + +
      +
      +
      + + +
      +
      +

      {description.value}

      +
      +
      + +
      +
      + +
      +
      +
      + +
      + ); +} diff --git a/src/frontend/components/usa--header.tsx b/src/frontend/components/usa--header.tsx index 3a74cc54..21b06ced 100644 --- a/src/frontend/components/usa--header.tsx +++ b/src/frontend/components/usa--header.tsx @@ -36,25 +36,5 @@ export function USAHeader() { - //
      - //
      - //
      - // - // <Image - // src={PGovLogo} - // width={56} - // height={56} - // alt={"Performance.gov logo"} - // priority - // className="" - // /> - // - // - //
      - // - // {e.preventDefault(); console.log("Search");}} /> - // - //
      - //
      ); } diff --git a/src/frontend/components/view--goal-facets.tsx b/src/frontend/components/view--goal-facets.tsx index 521b62a9..76543872 100644 --- a/src/frontend/components/view--goal-facets.tsx +++ b/src/frontend/components/view--goal-facets.tsx @@ -9,7 +9,7 @@ const ViewGoalFacets = ({handleSearch, handleClose}) => { fetch(url) .then((res) => res.json()) .then((data) => setFacets(data)); - }, []); + }, [url]); const [checkedFacets, setCheckedFacets] = useState([]) diff --git a/src/frontend/components/view--goal-search.tsx b/src/frontend/components/view--goal-search.tsx index bfd074af..0628fee4 100644 --- a/src/frontend/components/view--goal-search.tsx +++ b/src/frontend/components/view--goal-search.tsx @@ -4,6 +4,7 @@ import Masonry, {ResponsiveMasonry} from "react-responsive-masonry" import { NodeGoalProps, NodePlanProps, ViewFilter } from "lib/types"; import { NodeGoalCard } from "./node--goal--card"; import { NodePlanCard } from "./node--plan--card"; +import { StorageIndicatorCard } from "./storage--indicator--card"; import { ViewGoalSearchFulltext } from "./view--goal-search--fulltext"; import ViewGoalFacets from "./view--goal-facets"; import CustomButton from "./button--custom"; @@ -15,16 +16,25 @@ interface ViewGoalSearch { total: number } -const isNodeGoalProps = (goal: NodeGoalProps | NodePlanProps): goal is NodeGoalProps => { - return 'goalType' in goal; -}; +const renderCard = (goal: any) => { + if(goal.goalType) { + return ; + } else if(goal.agency) { + return ; + } else if(goal.objective?.indicators) { + return ; + } else { + return

      Error

      + } +} export default function GoalsSearchView({ filters, goals, total, description }: ViewGoalSearch) { const offsetAmount = 15; const [fulltext, setFulltext] = useState(filters[0]?.value ? filters[0].value : ""); const [administration, setAdministration] = useState("53"); const [totalResults, setTotalResults] = useState(total) - const [displayGoals, setDisplayGoals] = useState(goals) + const [displayGoals, setDisplayGoals] = useState(goals); + const [viewType, setViewType] = useState([]); const [facets, setFacets] = useState(filters[1]?.options ? filters[1].options : []) const [filtersOpen, setFiltersOpen] = useState(false); const [offset, setOffset] = useState(offsetAmount); @@ -37,7 +47,7 @@ export default function GoalsSearchView({ filters, goals, total, description }: e.preventDefault(); } const cleanFacets = facets.map((f) => encodeURIComponent(f)); - const url = `/api/goal-search?fulltext=${fulltext}&facets=${cleanFacets}&administration=${administration}`; + const url = `/api/goal-search?fulltext=${fulltext}&facets=${cleanFacets}&administration=${administration}&type=${viewType}`; setOffset(offsetAmount) try { const response = await fetch(url); @@ -52,7 +62,7 @@ export default function GoalsSearchView({ filters, goals, total, description }: } catch (error) { console.error(error.message); } - }, [fulltext, administration]) + }, [fulltext, administration, viewType]) @@ -100,26 +110,30 @@ export default function GoalsSearchView({ filters, goals, total, description }:
      • setViewType([])} + className={`radius-pill ${viewType.length === 0 ? "active" : ""}`} + text={"Everything"} />
      • + onClick={() => setViewType(["plan"])} + className={`radius-pill ${(viewType.length > 0 && viewType[0]) === "plan" ? "active" : ""}`} + text={"Plans"} + />
      • setViewType(["goal"])} + className={`radius-pill ${(viewType.length > 0 && viewType[0]) === "goal" ? "active" : ""}`} + text={"Goals"} />
      • setViewType(["indicator"])} + className={`radius-pill ${(viewType.length > 0 && viewType[0]) === "indicator" ? "active" : ""}`} + text={"Indicators"} />
      @@ -133,13 +147,9 @@ export default function GoalsSearchView({ filters, goals, total, description }: gutterBreakpoints={{350: "12px", 750: "16px", 900: "24px"}} > - {displayGoals.slice(0, offset).map((goal) => ( - isNodeGoalProps(goal) ? ( - - ) : ( - - ) - ))} + {displayGoals.slice(0, offset).map((goal) => { + return renderCard(goal) + })} @@ -147,7 +157,7 @@ export default function GoalsSearchView({ filters, goals, total, description }:

      - No matching goals. + No matching results.

      diff --git a/src/frontend/lib/graphqlQueries.ts b/src/frontend/lib/graphqlQueries.ts index 671d65a4..3802e7e1 100644 --- a/src/frontend/lib/graphqlQueries.ts +++ b/src/frontend/lib/graphqlQueries.ts @@ -43,7 +43,20 @@ export const graphqlQueries = { targetValue value status - + period { + ... on StoragePeriod { + id + name + dateRange { + end { + time + } + start { + time + } + } + } + } } } } @@ -98,6 +111,21 @@ export const graphqlQueries = { goals { ... on NodeGoal { id + title + path + image { + ... on MediaImage { + id + name + mediaImage { + alt + title + variations(styles: THIRD1X1) { + url + } + } + } + } objectives { ... on NodeObjective { id @@ -146,12 +174,14 @@ export const graphqlQueries = { fulltext: string | string[], facets: string | string[], administration: string | string[], + type: string | string[], ) => `query GoalsQuery { goalsGraphql1(filter: { aggregated_field: "${fulltext}", Topics: ${JSON.stringify(facets)}, - Administration: ${administration} + aggregated_administration: ${JSON.stringify(administration)}, + aggregated_type: ${JSON.stringify(type)}, }) { pageInfo { total @@ -216,6 +246,20 @@ export const graphqlQueries = { plan { ... on NodePlan { id + administration { + ... on StorageAdministration { + id + name + dateRange { + end { + time + } + start { + time + } + } + } + } agency { ... on NodeAgency { id @@ -245,6 +289,20 @@ export const graphqlQueries = { title id path + administration { + ... on StorageAdministration { + id + name + dateRange { + end { + time + } + start { + time + } + } + } + } agency { ... on NodeAgency { id @@ -268,9 +326,70 @@ export const graphqlQueries = { } } } + ...on StorageIndicator { + id + description { + value + } + objective { + ... on NodeObjective { + id + goal { + ... on NodeGoal { + id + path + plan { + ... on NodePlan { + id + administration { + ... on StorageAdministration { + id + name + dateRange { + end { + time + } + start { + time + } + } + } + } + agency { + ... on NodeAgency { + id + acronym + logo { + ... on MediaImage { + id + name + mediaImage { + url + } + } + } + title + } + } + } + } + } + } + indicators { + ... on StorageIndicator { + id + name + values + targetValues + dates + } + } + } + } + } } - } - }`, + } + }`, taxonomyTopics: () => ` query getTopics { diff --git a/src/frontend/pages/[...slug].tsx b/src/frontend/pages/[...slug].tsx index 786a61f5..b75f959c 100644 --- a/src/frontend/pages/[...slug].tsx +++ b/src/frontend/pages/[...slug].tsx @@ -88,8 +88,9 @@ export async function getStaticProps( "field_agency.field_logo", "field_agency.field_logo.field_media_image", "field_goals.field_objectives", + "field_goals.field_image.field_media_image" ]); - params.addFields("node--goal", ["title", "field_objectives", "path"]); + params.addFields("node--goal", ["title", "field_objectives", "path", "field_image"]); params.addFields("node--objective", ["title", "body", "field_indicators"]); } diff --git a/src/frontend/pages/api/goal-search.ts b/src/frontend/pages/api/goal-search.ts index 60729873..3ff4cf1b 100644 --- a/src/frontend/pages/api/goal-search.ts +++ b/src/frontend/pages/api/goal-search.ts @@ -25,11 +25,17 @@ export default async function handler( const administration = req.query.administration ? req.query.administration : "53"; + const type = req.query.type ? req.query.type : []; const response = await drupal.fetch(graphqlUrl.toString(), { method: "POST", withAuth: true, // Make authenticated requests using OAuth. body: JSON.stringify({ - query: graphqlQueries.goalsView(fulltext, facetsList, administration), + query: graphqlQueries.goalsView( + fulltext, + facetsList, + administration, + type, + ), }), }); const { data } = await response.json(); diff --git a/src/frontend/pages/index.tsx b/src/frontend/pages/index.tsx index 5c090314..642bcb78 100644 --- a/src/frontend/pages/index.tsx +++ b/src/frontend/pages/index.tsx @@ -20,9 +20,10 @@ export const getStaticProps = async () => { method: "POST", withAuth: true, // Make authenticated requests using OAuth. body: JSON.stringify({ - query: graphqlQueries.goalsView("", [], "53"), + query: graphqlQueries.goalsView("", [], "53",[]), }), }); + const { data } = await response.json(); return { props: {