Skip to content

fix: s3 button behaviours#1082

Merged
edwinjosechittilappilly merged 3 commits into
IBM_COS_S3_SPIKEfrom
feat-s3
Mar 9, 2026
Merged

fix: s3 button behaviours#1082
edwinjosechittilappilly merged 3 commits into
IBM_COS_S3_SPIKEfrom
feat-s3

Conversation

@edwinjosechittilappilly

Copy link
Copy Markdown
Collaborator

This pull request introduces several improvements to the AWS S3 connector experience, both in the frontend UI and backend connector logic. The main changes include better handling and display of connector states in the UI, improved error handling for S3 bucket loading, and enhanced credential fallback logic in the backend connector.

Frontend UI improvements:

  • Improved the logic for displaying connector status and available actions in ConnectorCard, ensuring that the UI more accurately reflects whether a connector is configured, available, or requires setup. [1] [2] [3] [4] [5]
  • Enhanced the S3 settings dialog to synchronize the list of buckets when defaults load asynchronously, preventing stale or missing bucket selections when the dialog is opened. [1] [2]
  • Added error handling to the S3 bucket upload page to display a user-friendly error message when bucket loading fails, improving the user experience when there are credential or endpoint issues. (frontend/app/upload/[provider]/page.tsxL214-R214, frontend/app/upload/[provider]/page.tsxR324-R327)
  • Updated the AWS logo to use the official AWS brand color for better visual consistency.

Backend connector improvements:

  • Added get_client_id and get_client_secret methods to the S3Connector class, allowing credentials to be pulled from either the config dictionary or environment variables, and providing clear error messages when credentials are missing.

Add env-var fallback getters for S3 credentials and clearer errors: implement get_client_id and get_client_secret to read from config or AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY and raise ValueError when missing. Frontend fixes: treat a connected connector as available in the connector card UI, and surface S3 bucket loading errors on the upload page by including the query error in the response and rendering a descriptive error message when bucket fetch fails.
Connector card: use isConnected alone for active state, treat a connector as configured when isConnected or connector.available, and show a "Configure" action (with Settings2 icon) when onConfigure is provided; also keep existing loading state.

S3 settings dialog: import useEffect and add an effect to sync buckets and selectedBuckets when defaults.bucket_names load asynchronously so defaults are applied after dialog mount.

AWS logo: replace fill="currentColor" with an explicit color (#232F3E) for consistent rendering.
Copilot AI review requested due to automatic review settings March 9, 2026 20:28
@edwinjosechittilappilly edwinjosechittilappilly merged commit 627881d into IBM_COS_S3_SPIKE Mar 9, 2026
7 checks passed
@github-actions github-actions Bot added frontend 🟨 Issues related to the UI/UX backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) labels Mar 9, 2026
@github-actions github-actions Bot deleted the feat-s3 branch March 9, 2026 20:28
@github-actions github-actions Bot added the bug 🔴 Something isn't working. label Mar 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves the AWS S3 connector UX by refining connector state/action rendering in settings, making S3 bucket loading failures visible to users, and enhancing backend credential resolution behavior to support config/env fallback.

Changes:

  • Refines connector card state handling and available actions for direct-config connectors (S3/COS) vs connected connectors.
  • Adds UI synchronization/error handling for S3 settings + bucket status loading flows.
  • Adds S3 connector get_client_id / get_client_secret methods to support config/env fallback and clearer missing-credential errors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/connectors/aws_s3/connector.py Adds credential getter methods with config→env fallback and explicit error messages.
frontend/components/icons/aws-logo.tsx Updates AWS logo fill color to AWS brand color.
frontend/app/upload/[provider]/page.tsx Displays a user-facing error state when S3 bucket status loading fails.
frontend/app/settings/_components/s3-settings-dialog.tsx Syncs bucket selection state when defaults load asynchronously after mount.
frontend/app/settings/_components/connector-card.tsx Adjusts connector state display/actions to better reflect “connected” vs “available”.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +54 to +67
def get_client_id(self) -> str:
"""Return access key from config dict, or AWS_ACCESS_KEY_ID env var as fallback."""
val = self.config.get("access_key") or os.getenv("AWS_ACCESS_KEY_ID")
if val:
return val
raise ValueError(
"S3 credentials not set. Provide 'access_key' in the connector config "
"or set the AWS_ACCESS_KEY_ID environment variable."
)

def get_client_secret(self) -> str:
"""Return secret key from config dict, or AWS_SECRET_ACCESS_KEY env var as fallback."""
val = self.config.get("secret_key") or os.getenv("AWS_SECRET_ACCESS_KEY")
if val:

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

In get_client_id() / get_client_secret(), the env var names are duplicated as string literals ("AWS_ACCESS_KEY_ID" / "AWS_SECRET_ACCESS_KEY") even though the class already defines CLIENT_ID_ENV_VAR / CLIENT_SECRET_ENV_VAR. Using the constants here avoids drift if the env var names ever change and keeps the credential resolution logic consistent with the rest of the connector base classes.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to 76
{isConnected || connector?.available
? `${connector.name} is configured.`
: "Not configured."}

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

connector.available is derived from whether required env vars are present (see ConnectionManager._is_connector_available), not whether the user has actually created/authenticated a connection. Using isConnected || connector.available to display “is configured” can mislabel a connector as configured when it’s merely available (e.g., env vars set but no active connection). Consider basing the “configured” wording strictly on isConnected, and using separate copy for “available to configure” vs “not available” states.

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +60
// Sync bucket state when defaults load asynchronously after dialog mount
useEffect(() => {
if (defaults?.bucket_names?.length) {
setBuckets(defaults.bucket_names);
setSelectedBuckets((prev) =>
prev.length ? prev : defaults.bucket_names,
);
}
}, [defaults?.bucket_names?.join(",")]);

Copilot AI Mar 9, 2026

Copy link

Choose a reason for hiding this comment

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

The useEffect dependency on defaults?.bucket_names?.join(",") can produce collisions when bucket names contain commas (different arrays can stringify to the same value), and it makes the dependency semantics less clear. Prefer depending on defaults?.bucket_names directly (or a stable key like JSON.stringify(defaults.bucket_names)), and keep the deep-compare logic explicit if that’s what you want.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) bug 🔴 Something isn't working. frontend 🟨 Issues related to the UI/UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants