Skip to content

Commit f5a574a

Browse files
committed
Also show warning when scopes are discovered but none are selected
1 parent 7ae1c35 commit f5a574a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/web/src/app/(app)/settings/workspaceAskAgent/workspaceAskAgentPage.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ function OAuthScopesInput({
9090
const [oauthScopeSearchInput, setOAuthScopeSearchInput] = useState("");
9191
const selectedOAuthScopeSet = new Set(selectedOAuthScopes);
9292
const requestedOAuthScopes = getMcpRequestedOAuthScopes(selectedOAuthScopes, customOAuthScopeInput);
93+
const hasDiscoveredResourceScopes = discoveredOAuthScopes.some((scope) => scope !== OFFLINE_ACCESS_SCOPE);
9394
const isOfflineAccessOnly = requestedOAuthScopes.length === 1
9495
&& requestedOAuthScopes[0] === OFFLINE_ACCESS_SCOPE
95-
&& discoveredOAuthScopes.some((scope) => scope !== OFFLINE_ACCESS_SCOPE);
96+
&& hasDiscoveredResourceScopes;
97+
const isNoScopesSelected = requestedOAuthScopes.length === 0 && hasDiscoveredResourceScopes;
9698
const filteredOAuthScopes = useMemo(() => {
9799
const query = oauthScopeSearchInput.trim().toLowerCase();
98100
if (!query) {
@@ -205,10 +207,12 @@ function OAuthScopesInput({
205207
/>
206208
</div>
207209

208-
{isOfflineAccessOnly && (
210+
{(isOfflineAccessOnly || isNoScopesSelected) && (
209211
<p className="flex items-start gap-1.5 text-xs text-muted-foreground">
210212
<AlertTriangleIcon className="h-3.5 w-3.5 shrink-0 text-yellow-600 dark:text-yellow-400" />
211-
Only offline_access is selected. Without any resource scopes, the connector may not be able to access anything.
213+
{isOfflineAccessOnly
214+
? "Only offline_access is selected. Without any resource scopes, the connector may not be able to access anything."
215+
: "No scopes are selected. Without any resource scopes, the connector may not be able to access anything."}
212216
</p>
213217
)}
214218
</div>

0 commit comments

Comments
 (0)