Skip to content

Ramon wchm api v2#291

Merged
jkcox merged 4 commits into
developfrom
ramon-wchm-api-v2
Apr 10, 2026
Merged

Ramon wchm api v2#291
jkcox merged 4 commits into
developfrom
ramon-wchm-api-v2

Conversation

@ramon-west-asu
Copy link
Copy Markdown
Contributor

Add new RA contact types by fetching from these new endpoints
/v2/pre-award-ras
/v2/post-award-ras
/v2/after-the-fact-ras
/v2/officers
/v2/departments

This will also resolve issues with old data / wrong contacts due to deprecated database tables in the Data Warehouse. v2 endpoints query the correct database tables.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the WCHM (“Who Can Help Me”) WordPress block to use the new /v2/... API endpoints so it can return correct contact data from the non-deprecated data warehouse tables, and expands the UI to show separate RA contact types.

Changes:

  • Switch department/officer/RA lookups to the new /v2/* endpoints and display Pre-Award, Post-Award, and After-the-Fact contacts separately.
  • Update the block’s base API path wiring (editor + saved markup) and regenerate built build/wchm/* bundles.
  • Update generated asset dependency lists for the updated bundles.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/wchm/save.js Sets the base API path in saved block markup (used by frontend rendering).
src/wchm/edit.js Sets the base API path for editor preview rendering.
src/wchm/components/autoComplete.js Moves fetches to v2 endpoints and renders new contact sections.
build/wchm/index.js Regenerated editor bundle containing the updated API logic and base URL wiring.
build/wchm/index.asset.php Regenerated editor asset manifest.
build/wchm/frontend.js Regenerated frontend bundle containing the updated API logic.
build/wchm/frontend.asset.php Regenerated frontend asset manifest.
Comments suppressed due to low confidence (1)

src/wchm/components/autoComplete.js:23

  • The Azure APIM subscription key is embedded directly in client-side JavaScript. This value will be publicly visible to anyone loading the page (and in the built assets), which usually defeats the purpose of an API key and can allow quota abuse. Consider moving these calls behind a server-side proxy (WordPress endpoint) or injecting a short-lived token at runtime instead of hard-coding the key in the bundle.
            headers: {
              "Content-Type": "application/json",
              "Ocp-Apim-Subscription-Key": "8dd787c43de54148bf5e10686b6b6e20",
            },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/wchm/save.js
Comment thread src/wchm/edit.js
Comment thread src/wchm/components/autoComplete.js
Comment thread src/wchm/components/autoComplete.js
Comment thread src/wchm/components/autoComplete.js Outdated
Comment on lines 113 to 119
if (selectedItemId) {
try {
const response = await fetch(
`${baseApiPath}officer/${selectedItemId}`,
`${baseApiPath}v2/officers/${selectedItemId}`,
{
method: "GET",
headers: {
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /v2/officers/... integration changes the endpoint, but the processing logic for officerData still filters by item.Officer !== "" (see the filtering immediately after the fetch). If the v2 response uses the new contactFullName/title/userID fields you render later, this filter will likely drop all records and the officer section will appear empty. Update the filtering to align with the v2 schema (or remove it if unnecessary).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check this, I tested with deptId B1309 and saw officers, but its a good idea to purge unnecessary fields.

Comment on lines +180 to +183
{preAwardRasData.map((contactInfo) => (
<div className="mb-4">
<h4 className="mb-1">{contactInfo.contactFullName}</h4>
<p className="mb-1">{contactInfo.title}</p>
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elements rendered inside .map(...) are missing a stable key prop (e.g., the <div className="mb-4"> inside preAwardRasData.map). This will trigger React warnings and can cause inefficient or incorrect UI updates when lists change. Provide a unique key (e.g., a contact id or a composite of userID + role).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a key? These are not interactive, but we can add a key for console logs if needed....

Comment thread build/wchm/index.js Outdated
Comment thread build/wchm/frontend.js Outdated
@jkcox jkcox linked an issue Apr 6, 2026 that may be closed by this pull request
5 tasks
@jkcox jkcox added [Type] Maintenance Minor file cleanup and organization tasks javascript Pull requests that update Javascript code labels Apr 6, 2026
@jkcox
Copy link
Copy Markdown
Contributor

jkcox commented Apr 7, 2026

@ramon-west-asu RE: your comments - sounds good... I can take care of those based on your comments if you're busy elsewhere.

I had some minor changes to block.json and some other clean up, I will hold off until your latest push, unless you want me to fully take over.

Copy link
Copy Markdown
Contributor

@jkcox jkcox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging to catch up branch with latest unityblock features. Will create new branch for requested changes

@jkcox jkcox merged commit d74bbd1 into develop Apr 10, 2026
@jkcox jkcox deleted the ramon-wchm-api-v2 branch April 10, 2026 21:33
@jkcox jkcox mentioned this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code [Type] Maintenance Minor file cleanup and organization tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wchm updates

4 participants