Skip to content

DBQnA: Unified POST data format #2076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PeterYang12
Copy link
Contributor

Description

This commit aligns api "postgres/health" POST data, and use localhost instead of hard-coded ip.

Issues

This commit should fix #2063 .

Type of change

List the type of change like below. Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would break existing design and interface)
  • Others (enhancement, documentation, validation, etc.)

This commit aligns api "postgres/health" POST data, and use localhost
instead of hard-coded ip.

This commit should fix opea-project#2063 .

Signed-off-by: PeterYang12 <yuhan.yang@intel.com>
@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 02:24
Copy link
Contributor

@Copilot 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 API POST data format for the "postgres/health" endpoint by aligning the payload structure and replacing a hard-coded IP with localhost.

  • Updated host value in the database connection configuration
  • Modified the payload from plain formData to a unified connection data object
  • Improved consistency with the backend API expectations
Comments suppressed due to low confidence (1)

DBQnA/ui/react/src/components/DbConnect/DBConnect.tsx:45

  • Confirm that wrapping the entire formData object under the key 'conn_str' matches the API's expected schema. If the API is designed to receive a connection string rather than an object, consider transforming formData into the appropriate format.
let unifiedConnData = {"conn_str":formData};

Copy link

github-actions bot commented Jun 17, 2025

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@@ -9,7 +9,7 @@ const DBConnect: React.FC = () => {
const [formData, setFormData] = useState({
user: 'postgres',
database: 'chinook',
host: '10.223.24.113',
host: '127.0.0.1',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean it assumes UI always run the same machine as postgres?
If UI and postgres on two different machines, can this work?
Should this be configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this mean it assumes UI always run the same machine as postgres? If UI and postgres on two different machines, can this work? Should this be configurable?

Thanks for your review. The 'host ip' can be configured by end user in UI. It's workable on two different machines.
This change just replace a hard coded IP with localhost. IMHO, it shouldn't be 10.223.24.113.

@PeterYang12
Copy link
Contributor Author

Could we merge this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] DBQna: Postgres api is missing in react-UI
3 participants