SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
Enhance OAuth form fields with tooltips for scope input
Muhammad Hamza Khan578426f7f2e9
diff --git a/packages/app/src/builder-ui/components/APICall.class.ts b/packages/app/src/builder-ui/components/APICall.class.tsindex 9c58dd87..2e38abb8 100644--- a/packages/app/src/builder-ui/components/APICall.class.ts+++ b/packages/app/src/builder-ui/components/APICall.class.ts@@ -25,6 +25,7 @@ import { createBadge } from '../ui/badges'; // *** ADDED: Import createBadge ***import { destroyCodeEditor, toggleMode } from '../ui/dom';import { closeTwDialog, twEditValuesWithCallback } from '../ui/tw-dialogs';import { delay, getVaultData, handleKvFieldEditBtn, handleKvFieldEditBtnForParams } from '../utils';+import { attachTooltipV2 } from '../utils/tooltip-wrapper-v2';import { Workspace } from '../workspace/Workspace.class';import { Component } from './Component.class';@@ -2224,6 +2225,16 @@ export class APICall extends Component {scopeInput.value = currentOauthInfo.scope;}+ // Attach tooltip to scope info icon+ const scopeTooltipIcon = dialog.querySelector('#scope-label') as HTMLElement;+ if (scopeTooltipIcon) {+ attachTooltipV2(scopeTooltipIcon, {+ text: 'Enter scopes separated by spaces (e.g., read write profile)',+ position: 'right',+ delayDuration: 300,+ });+ }+// Comprehensive update field visibility functionconst updateFieldVisibility = (selectedValue: string) => {const isOAuth2 = ['Google', 'LinkedIn', 'Custom OAuth2.0'].includes(selectedValue);diff --git a/packages/app/src/builder-ui/helpers/oauth/oauth-modal.helper.ts b/packages/app/src/builder-ui/helpers/oauth/oauth-modal.helper.tsindex 454af5ae..a32d5cf4 100644--- a/packages/app/src/builder-ui/helpers/oauth/oauth-modal.helper.ts+++ b/packages/app/src/builder-ui/helpers/oauth/oauth-modal.helper.ts@@ -103,8 +103,15 @@ export function generateOAuthModalHTML(<div class="col-span-3"><input type="password" id="clientSecret" name="clientSecret" value="${currentOauthInfo.clientSecret || ''}" class="input bg-white border border-gray-300 text-gray-900 rounded block w-full h-9 px-3 py-2 text-sm outline-none focus:outline-none focus:ring-0 focus:border-b-2 focus:border-b-blue-500" /></div></div><div class="grid grid-cols-4 items-center gap-4 form-group" data-oauth-field="scope">- <label for="scope" class="text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70">Scopes</label>- <div class="col-span-3"><textarea id="scope" name="scope" class="input w-full bg-white border text-gray-900 rounded block outline-none focus:outline-none focus:ring-0 text-sm px-3 py-2 border-gray-300 focus:border-b-2 focus:border-b-blue-500 min-h-[70px] resize-none">${currentOauthInfo.scope || ''}</textarea></div>+ <label id="scope-label" for="scope" class="w-fit text-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70 flex items-center">+ Scopes+ <svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 ml-2 cursor-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">+ <circle cx="12" cy="12" r="10"></circle>+ <path d="M12 16v-4"></path>+ <path d="M12 8h.01"></path>+ </svg>+ </label>+ <div class="col-span-3"><textarea id="scope" name="scope" placeholder="Enter scopes separated by spaces (e.g., read write profile)" class="input w-full bg-white border text-gray-900 rounded block outline-none focus:outline-none focus:ring-0 text-sm px-3 py-2 border-gray-300 focus:border-b-2 focus:border-b-blue-500 min-h-[70px] resize-none">${currentOauthInfo.scope || ''}</textarea></div></div></div>diff --git a/packages/app/src/react/features/vault/components/oauth-form-fields.tsx b/packages/app/src/react/features/vault/components/oauth-form-fields.tsxindex 1eae3123..292c4840 100644--- a/packages/app/src/react/features/vault/components/oauth-form-fields.tsx+++ b/packages/app/src/react/features/vault/components/oauth-form-fields.tsx@@ -1,6 +1,6 @@/*** OAuth Form Fields Component- *+ ** Renders the appropriate OAuth form fields based on the selected service type.* Separated into its own component for better modularity and maintainability.*/@@ -9,13 +9,15 @@ import { Input } from '@src/react/shared/components/ui/input';import { Label } from '@src/react/shared/components/ui/label';import { TextArea } from '@src/react/shared/components/ui/newDesign/textarea';import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,} from '@src/react/shared/components/ui/select';+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';import { OAUTH_SERVICES } from '@src/shared/helpers/oauth/oauth.utils';+import { Info } from 'lucide-react';import React from 'react';import type { OAuthConnectionFormData } from '../types/oauth-connection';@@ -27,57 +29,59 @@ interface OAuthFormFieldsProps {* The current form data*/formData: Partial<OAuthConnectionFormData>;-+/*** The currently selected OAuth service*/selectedService: string;-+/*** Whether the form is currently being processed*/isProcessing: boolean;-+/*** Whether vault keys are currently being resolved*/isResolvingVaultKeys: boolean;-+/*** Whether to show OAuth 2.0 specific fields*/showOAuth2Fields: boolean;-+/*** Whether to show OAuth 1.0a specific fields*/showOAuth1Fields: boolean;-+/*** Whether to show Client Credentials specific fields*/showClientCredentialsFields: boolean;-+/*** Whether to show the scope field*/showScopeField: boolean;-+/*** The OAuth 2.0 callback URL (for display only)*/oauth2CallbackURL?: string;-+/*** The OAuth 1.0a callback URL (for display only)*/oauth1CallbackURL?: string;-+/*** Handler for input field changes*/- handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;-+ handleChange: (+ e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>,+ ) => void;+/*** Handler for select field changes*/@@ -334,14 +338,24 @@ export function OAuthFormFields({{/* Scope Field (Common for most OAuth2 flows) */}{showScopeField && (<div className="grid grid-cols-4 items-center gap-4">- <Label htmlFor="scope">Scopes</Label>+ <div className="flex items-center">+ <Label htmlFor="scope">Scopes</Label>+ <Tooltip>+ <TooltipTrigger asChild>+ <Info className="w-4 h-4 cursor-help ml-2" />+ </TooltipTrigger>+ <TooltipContent className="w-52 text-center" side="right">+ <p>Enter scopes separated by spaces (e.g., read write profile)</p>+ </TooltipContent>+ </Tooltip>+ </div><div className="col-span-3"><TextAreaid="scope"name="scope"value={formData.scope || ''}onChange={handleChange}- placeholder="Enter scopes separated by space"+ placeholder="Enter scopes separated by spaces (e.g., read write profile)"disabled={isDisabled}fullWidth={true}/>@@ -353,4 +367,3 @@ export function OAuthFormFields({</>);}-