fix(frontend): filter credentials to ones that are supported (#10725)

<!-- Clearly explain the need for these changes: -->
We're showing invalid credential types on the selections  across the app
### Changes 🏗️
We go from (incorrect)
<img width="2551" height="1202" alt="image"
src="https://github.com/user-attachments/assets/e566ed6c-b6c9-4047-80fd-0f2c8cef0bf9"
/>
to this with the fix
<img width="2551" height="1202" alt="image"
src="https://github.com/user-attachments/assets/c720a3d4-9c03-48c5-82a3-d30752bce13c"
/>

<!-- Concisely describe all of the changes made in this pull request:
-->

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  <!-- Put your test plan here: -->
- [x] test the broken agent and upload images proving its no longer
broken
This commit is contained in:
Nicholas Tindle
2025-08-24 16:13:05 -05:00
committed by GitHub
parent 5502256bea
commit a54bed6d68

View File

@@ -94,6 +94,12 @@ export default function useCredentials(
}
const savedCredentials = provider.savedCredentials.filter((c) => {
// First, check if the credential type is supported by this block
const supportedTypes = credsInputSchema.credentials_types;
if (!supportedTypes.includes(c.type)) {
return false;
}
// Filter by OAuth credentials that have sufficient scopes for this block
if (c.type === "oauth2") {
const requiredScopes = credsInputSchema.credentials_scopes;
@@ -108,7 +114,7 @@ export default function useCredentials(
return discriminatorValue && getHostFromUrl(discriminatorValue) == c.host;
}
// Include all other credential types
// Include all other credential types that passed the type check
return true;
});