From f0fb81a26e6af916af5cfa437f71a86520656c7c Mon Sep 17 00:00:00 2001 From: Samruddhi Date: Tue, 26 Nov 2024 16:00:01 -0800 Subject: [PATCH 1/3] Search by ProgramName --- blocks/gmo-program-header/gmo-program-header.js | 7 ++++--- scripts/graphql.js | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/blocks/gmo-program-header/gmo-program-header.js b/blocks/gmo-program-header/gmo-program-header.js index 00f8cc6..eeda45e 100644 --- a/blocks/gmo-program-header/gmo-program-header.js +++ b/blocks/gmo-program-header/gmo-program-header.js @@ -1,5 +1,6 @@ import { decorateIcons } from '../../scripts/lib-franklin.js'; -import { graphqlCampaignByName } from '../../scripts/graphql.js'; +//import { graphqlCampaignByName } from '../../scripts/graphql.js'; +import { graphqlProgramByName } from '../../scripts/graphql.js'; import { statusMapping, productList, getMappingArray } from '../../scripts/shared-program.js'; export default async function decorate(block) { @@ -80,9 +81,9 @@ export default async function decorate(block) { const value = this.value; if (value) { - const graphqlData = await graphqlCampaignByName(value); + const graphqlData = await graphqlProgramByName(value); //Get unique values - const searchItems = Array.from(new Set(graphqlData.data.programList.items.map(item => item.campaignName))); + const searchItems = Array.from(new Set(graphqlData.data.programList.items.map(item => item.programName))); autocomplete(value, searchItems); } else diff --git a/scripts/graphql.js b/scripts/graphql.js index 106d531..37993c1 100644 --- a/scripts/graphql.js +++ b/scripts/graphql.js @@ -83,12 +83,12 @@ export async function graphqlAllCampaignsFilter(first,cursor,filter) { } -export async function graphqlCampaignByName(campaignName) { - const queryName = 'getCampaignNameFilter'; - const encodedCampaignName = encodeURIComponent(campaignName); +export async function graphqlProgramByName(programName) { + const queryName = 'getProgramNameFilter'; + const encodedProgramName = encodeURIComponent(programName); const encodedSemiColon = encodeURIComponent(';'); //persisted query URLs have to be encoded together with the first semicolon - const graphqlEndpoint = `${baseApiUrl}/${projectId}/${queryName}${encodedSemiColon}campaignName=${encodedCampaignName}`; + const graphqlEndpoint = `${baseApiUrl}/${projectId}/${queryName}${encodedSemiColon}programName=${encodedProgramName}`; const jwtToken = await getBearerToken(); // Return the fetch promise chain so that it can be awaited outside From 31855f3076a695b7f63766cfffcbd0d745b08cde Mon Sep 17 00:00:00 2001 From: Samruddhi Date: Sun, 1 Dec 2024 19:05:50 -0800 Subject: [PATCH 2/3] filtered based on programName --- blocks/gmo-program-list/gmo-program-list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/gmo-program-list/gmo-program-list.js b/blocks/gmo-program-list/gmo-program-list.js index 163910c..6a902fb 100644 --- a/blocks/gmo-program-list/gmo-program-list.js +++ b/blocks/gmo-program-list/gmo-program-list.js @@ -57,7 +57,7 @@ document.addEventListener('gmoCampaignListBlock', async function() { const searchInputValue = document.getElementById('campaign-search').value; if (searchInputValue!=='') { - graphQLFilterArray.push({type:'campaignName', value:searchInputValue, operator:'='}) + graphQLFilterArray.push({type:'programName', value:searchInputValue, operator:'='}) } currentGraphqlFilter= generateFilterJSON(graphQLFilterArray); From b5e369b37b8111fc5d097659ad8c6ac3af8d14ea Mon Sep 17 00:00:00 2001 From: Samruddhi Date: Mon, 2 Dec 2024 12:47:10 -0800 Subject: [PATCH 3/3] search field text update --- blocks/gmo-program-header/gmo-program-header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/gmo-program-header/gmo-program-header.js b/blocks/gmo-program-header/gmo-program-header.js index eeda45e..e1edebf 100644 --- a/blocks/gmo-program-header/gmo-program-header.js +++ b/blocks/gmo-program-header/gmo-program-header.js @@ -8,7 +8,7 @@ export default async function decorate(block) {
- +