Skip to content

Update connections page with new UI#1745

Merged
rmn-snpk merged 17 commits intomainfrom
feat/update-connections-page
Dec 10, 2025
Merged

Update connections page with new UI#1745
rmn-snpk merged 17 commits intomainfrom
feat/update-connections-page

Conversation

@rmn-snpk
Copy link
Copy Markdown

@rmn-snpk rmn-snpk commented Dec 8, 2025

Part of OPS-3164.

image

Available on UX

Summary by CodeRabbit

  • New Features

    • AI configuration status indicator displaying connection enable/disable state
  • Refactor

    • Simplified AI settings form with automatic save-on-change
    • Redesigned AI settings page with improved layout and organization
    • Integrated AWS and MCP tool configuration into unified settings interface

✏️ Tip: You can customize this high-level summary in your review settings.

@linear
Copy link
Copy Markdown

linear Bot commented Dec 8, 2025

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 8, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The changes restructure the AI and MCP settings UI by introducing a configuration indicator component, simplifying the AI settings form to handle connections only with auto-save functionality, removing the dedicated MCP settings form, and refactoring the settings page to present a combined AI/AWS layout with unified mutation flows.

Changes

Cohort / File(s) Change Summary
New Configuration Indicator
packages/react-ui/src/app/features/ai/ai-config-indicator.tsx
Added new functional component displaying AI enabled/disabled status with corresponding icon and localized message
Simplified AI Settings Form
packages/react-ui/src/app/features/ai/ai-settings-form.tsx
Rewrote form to use LocalForm type for connection selection; removed complex schema validation; introduced debounced auto-save on connection changes; updated props and type signatures (providerKey, initialConnection, onSave callback now receives connectionName only)
Removed MCP Settings Form
packages/react-ui/src/app/features/ai/mcp-settings-form.tsx
Deleted comprehensive MCP settings editor including form state, AWS connection handling, dialog wiring, and export constants
Refactored Settings Page
packages/react-ui/src/app/routes/settings/ai/index.tsx
Restructured AI settings UI from single section to combined AI/AWS layout; added AiConfigIndicator; introduced unified mutation flows for AI and MCP settings; removed delete workflows; added conditional guidance messaging and Skeleton placeholder for loading state

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50–70 minutes

  • ai-settings-form.tsx: Verify debounced auto-save logic, effect dependencies, and proper cleanup on unmount; confirm LocalForm state management and callback integration
  • packages/react-ui/src/app/routes/settings/ai/index.tsx: Review mutation flows, query invalidation strategy, error-to-message mapping, and conditional rendering logic
  • mcp-settings-form.tsx deletion: Verify no other files import or depend on the removed component or exported constants
  • Type signature changes: Confirm all consumers of AiSettingsForm props have been updated to match new LocalForm-based interface

Suggested reviewers

  • alexandrudanpop
  • cezudas

Poem

🐰 A simpler form now hops with grace,
Auto-saving through time and space,
The MCP form bids farewell,
Configuration bells now tell,
AI and AWS together dwell!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks substantial detail about the changes, testing status, and rationale. It only references a related issue (OPS-3164) and includes a screenshot without explanation. Add a clear description of what was changed, explain why these changes were made, provide context about the issue, and confirm all testing checklist items have been completed.
Title check ❓ Inconclusive The title 'Update connections page with new UI' is too vague and generic; it uses broad terms like 'update' and 'new UI' without specifying the actual changes made. Provide a more specific title that describes the primary changes, such as 'Refactor AI and MCP settings forms with simplified connection selection' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread packages/react-ui/src/app/features/ai/ai-settings-form.tsx Fixed
Comment thread packages/react-ui/src/app/features/ai/ai-settings-form.tsx Fixed
@rmn-snpk rmn-snpk changed the title Update connections page Update connections page with new UI Dec 8, 2025
Roman Snapko added 2 commits December 8, 2025 15:16
@rmn-snpk
Copy link
Copy Markdown
Author

rmn-snpk commented Dec 9, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (2)
packages/react-ui/src/app/features/ai/ai-config-indicator.tsx (1)

8-26: LGTM! Clean and simple indicator component.

The component follows React best practices with proper conditional rendering and i18n support. Consider adding an explicit return type for consistency with coding guidelines:

-const AiConfigIndicator = ({ enabled }: AiConfigIndicatorProps) => {
+const AiConfigIndicator = ({ enabled }: AiConfigIndicatorProps): JSX.Element => {
packages/react-ui/src/app/features/ai/ai-settings-form.tsx (1)

42-48: Potential issue: form in dependency array may cause unnecessary resets.

The form object from useForm maintains a stable reference, but including it in the dependency array is unconventional. If the reference ever changes, this effect would reset the form unexpectedly. Consider using form.reset directly:

  useEffect(() => {
    const formValue: LocalForm = {
      connection: initialConnection ?? '',
    };
    setInitialFormValue(formValue);
    form.reset(formValue);
-  }, [initialConnection, form]);
+  }, [initialConnection, form.reset]);

Alternatively, if form is confirmed stable, you can safely suppress the lint warning.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e230cd and 5768664.

📒 Files selected for processing (4)
  • packages/react-ui/src/app/features/ai/ai-config-indicator.tsx (1 hunks)
  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx (1 hunks)
  • packages/react-ui/src/app/features/ai/mcp-settings-form.tsx (0 hunks)
  • packages/react-ui/src/app/routes/settings/ai/index.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/react-ui/src/app/features/ai/mcp-settings-form.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx,js,jsx}: Indentation: 2 spaces for TypeScript/JavaScript
Braces required for all control blocks, even single-line
One space between keywords and parentheses: if (condition) {
Use camelCase for variables and functions
Use PascalCase for classes and types
Use UPPER_SNAKE_CASE for constants
Use lowercase with hyphens for file names (e.g., user-profile.ts)
Prefer const over let or var in TypeScript/JavaScript
Prefer arrow functions for callbacks and functional components in TypeScript/JavaScript

Files:

  • packages/react-ui/src/app/features/ai/ai-config-indicator.tsx
  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
  • packages/react-ui/src/app/routes/settings/ai/index.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Use types and interfaces where appropriate in TypeScript
Use explicit return types for exported functions in TypeScript

Files:

  • packages/react-ui/src/app/features/ai/ai-config-indicator.tsx
  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
  • packages/react-ui/src/app/routes/settings/ai/index.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{tsx,ts}: Frontend tech stack must strictly use: React 18, Zustand, react-query v5, shadcn, and Axios with qs package for query strings
Follow best practices for React hooks
Prefer small, composable components and extract helper functions where possible
Use cn utility to group tailwind classnames in React components

Files:

  • packages/react-ui/src/app/features/ai/ai-config-indicator.tsx
  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
  • packages/react-ui/src/app/routes/settings/ai/index.tsx
🧠 Learnings (3)
📚 Learning: 2025-11-25T10:22:44.853Z
Learnt from: CR
Repo: openops-cloud/openops PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-25T10:22:44.853Z
Learning: Applies to **/*.{tsx,ts} : Follow best practices for React hooks

Applied to files:

  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
📚 Learning: 2025-11-25T10:22:44.853Z
Learnt from: CR
Repo: openops-cloud/openops PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-25T10:22:44.853Z
Learning: Use the `react-ui` package for main application logic in the frontend

Applied to files:

  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
📚 Learning: 2025-11-25T10:22:44.853Z
Learnt from: CR
Repo: openops-cloud/openops PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-25T10:22:44.853Z
Learning: Applies to **/*.{tsx,ts} : Frontend tech stack must strictly use: React 18, Zustand, react-query v5, shadcn, and Axios with `qs` package for query strings

Applied to files:

  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx
🧬 Code graph analysis (1)
packages/react-ui/src/app/routes/settings/ai/index.tsx (8)
packages/react-ui/src/app/features/ai/lib/ai-form-utils.ts (3)
  • AiSettingsFormSchema (12-12)
  • AI_SETTINGS_SAVED_SUCCESSFULLY_TOAST (14-18)
  • MCP_SETTINGS_SAVED_SUCCESSFULLY_TOAST (26-30)
packages/ui-components/src/ui/use-toast.tsx (1)
  • toast (213-213)
packages/react-ui/src/app/lib/query-client.ts (1)
  • queryClient (3-3)
packages/react-ui/src/app/constants/query-keys.ts (1)
  • QueryKeys (1-70)
packages/shared/src/lib/common/application-error.ts (1)
  • ApplicationErrorParams (16-71)
packages/react-ui/src/app/features/ai/ai-config-indicator.tsx (1)
  • AiConfigIndicator (28-28)
packages/react-ui/src/app/features/ai/ai-settings-form.tsx (1)
  • AiSettingsForm (95-95)
packages/shared/src/lib/app-connection/connections-utils.ts (1)
  • removeConnectionBrackets (6-16)
🔇 Additional comments (4)
packages/react-ui/src/app/features/ai/ai-settings-form.tsx (3)

57-66: Verify onSave is memoized by the parent to avoid debounce resets.

The debouncedSave function is recreated whenever onSave changes. If the parent component passes an inline callback, this will recreate the debounced function on every render, effectively breaking the debounce behavior.

Ensure the parent wraps onSave in useCallback, or consider using a ref to hold the latest onSave:

+const onSaveRef = React.useRef(onSave);
+useEffect(() => {
+  onSaveRef.current = onSave;
+}, [onSave]);

 const debouncedSave = useMemo(
   () =>
     debounce((connection: string, unchanged: boolean) => {
       if (!unchanged) {
-        onSave(connection);
+        onSaveRef.current(connection);
         setInitialFormValue({ connection });
       }
     }, 300),
-  [onSave],
+  [],
 );

72-76: Good cleanup pattern for the debounced function.

The cleanup effect properly cancels pending debounced calls when the component unmounts or when debouncedSave changes, preventing memory leaks and stale saves.


78-91: Form structure is appropriate for auto-save pattern.

The <form> wrapper without an onSubmit handler is acceptable here since saving is handled via the debounced effect. The structure integrates well with react-hook-form's Form component.

packages/react-ui/src/app/routes/settings/ai/index.tsx (1)

89-157: Well-structured UI layout with proper loading states.

The combined AI and MCP settings layout is clean, with appropriate Skeleton placeholders during loading and conditional guidance text when AI is not configured. The integration of AiConfigIndicator provides clear visual feedback to users.

Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx
Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx Outdated
Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx
Roman Snapko added 2 commits December 9, 2025 09:06
@rmn-snpk rmn-snpk marked this pull request as ready for review December 9, 2025 08:15
Copilot AI review requested due to automatic review settings December 9, 2025 08:15
Copy link
Copy Markdown
Contributor

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 AI connections page with a new UI design. The changes streamline the configuration interface by consolidating AI and MCP settings into a single form component with automatic saving, removing the need for separate save/cancel/delete buttons.

Key Changes:

  • Introduced automatic save-on-change functionality with debouncing for connection selections
  • Added a visual status indicator showing whether OpenOps AI is enabled or disabled
  • Consolidated MCP settings form into the main AI settings form component

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/react-ui/src/app/routes/settings/ai/index.tsx Restructured the AI settings page layout, integrated the new AI config indicator, and consolidated both AI and MCP configuration into unified interface with improved error handling
packages/react-ui/src/app/features/ai/mcp-settings-form.tsx Removed the standalone MCP settings form component
packages/react-ui/src/app/features/ai/ai-settings-form.tsx Refactored to support auto-save functionality with debouncing, removed manual save/cancel buttons, and made the component more generic to handle both AI and MCP connections
packages/react-ui/src/app/features/ai/ai-config-indicator.tsx Added new component to display AI configuration status with visual indicators

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

Comment thread packages/react-ui/src/app/features/ai/ai-settings-form.tsx
Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Dec 9, 2025

Greptile Overview

Greptile Summary

This PR refactors the AI settings page to consolidate AI and MCP tool configuration into a unified interface with improved UX. The changes introduce auto-save functionality with debouncing, remove manual save/cancel buttons, and add a visual indicator for AI configuration status.

Key Changes:

  • Created AiConfigIndicator component to display AI enabled/disabled state
  • Refactored AiSettingsForm to be a generic connection selector with auto-save instead of a full form with manual submission
  • Removed the separate McpSettingsForm component and integrated MCP settings into the main AI settings page
  • Replaced manual save/cancel workflow with debounced auto-save (300ms delay)
  • Simplified the UI by removing delete buttons and validation indicators

Critical Issues Found:

  • The ConnectionSelect component returns bracketed values like {{connections['name']}}, but the AI connection handler (handleSaveAi) doesn't strip these brackets before saving. The MCP handler correctly uses removeConnectionBrackets, creating an inconsistency that will likely break AI functionality.
  • The ai-settings-form.tsx debounced save function also doesn't strip brackets, compounding the issue.

Confidence Score: 2/5

  • This PR contains critical bugs that will break AI connection functionality
  • The refactoring introduces a critical logical error where bracketed connection values from ConnectionSelect aren't stripped before being saved to AI settings. While MCP settings correctly handle this with removeConnectionBrackets, the AI settings don't, creating an inconsistency that will cause runtime failures when the backend tries to use the malformed connection string.
  • packages/react-ui/src/app/features/ai/ai-settings-form.tsx and packages/react-ui/src/app/routes/settings/ai/index.tsx both need the removeConnectionBrackets calls added

Important Files Changed

File Analysis

Filename Score Overview
packages/react-ui/src/app/features/ai/ai-config-indicator.tsx 5/5 New component that displays AI configuration status - simple, well-structured with no issues
packages/react-ui/src/app/features/ai/ai-settings-form.tsx 2/5 Refactored to use debounced auto-save and removed validation, but has a critical bug where bracketed connection values aren't stripped before saving
packages/react-ui/src/app/routes/settings/ai/index.tsx 2/5 Unified AI and MCP settings into single page with improved UX, but AI connection handler doesn't strip brackets which could break functionality

Sequence Diagram

sequenceDiagram
    participant User
    participant AiSettingsPage
    participant AiSettingsForm
    participant ConnectionSelect
    participant API

    User->>AiSettingsPage: Configure AI connection
    AiSettingsPage->>AiSettingsForm: Render form with initialConnection
    AiSettingsForm->>ConnectionSelect: Display connection selector
    
    User->>ConnectionSelect: Select connection
    ConnectionSelect->>AiSettingsForm: field.onChange({{connections['name']}})
    Note over ConnectionSelect,AiSettingsForm: Connection value includes brackets
    
    AiSettingsForm->>AiSettingsForm: watchedConnection triggers useEffect
    AiSettingsForm->>AiSettingsForm: debouncedSave(connection, isFormUnchanged)
    AiSettingsForm->>AiSettingsPage: onSave(connection) after 300ms
    Note over AiSettingsForm,AiSettingsPage: ⚠️ Brackets not stripped for AI
    
    AiSettingsPage->>AiSettingsPage: handleSaveAi(connectionName)
    AiSettingsPage->>API: saveAiSettings({connection: bracketed value})
    Note over AiSettingsPage,API: ⚠️ May cause issues if backend expects plain name
    
    API-->>AiSettingsPage: Success/Error
    AiSettingsPage->>AiSettingsPage: refetch settings
    
    User->>AiSettingsPage: Configure MCP connection
    AiSettingsPage->>AiSettingsForm: Render MCP form
    User->>ConnectionSelect: Select AWS connection
    ConnectionSelect->>AiSettingsForm: field.onChange({{connections['aws-name']}})
    
    AiSettingsForm->>AiSettingsPage: onSave(connection)
    AiSettingsPage->>AiSettingsPage: handleSaveMcp(connectionName)
    Note over AiSettingsPage: ✓ Brackets removed via removeConnectionBrackets
    AiSettingsPage->>API: saveMcpSettings({connectionName: plain name})
    API-->>AiSettingsPage: Success
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread packages/react-ui/src/app/features/ai/ai-settings-form.tsx
Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread packages/react-ui/src/app/routes/settings/ai/index.tsx Outdated
},
const isAiConfigured = !!aiSettings?.[0]?.connection;

const handleSaveAi = useCallback(
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.

nitpick would call it handleSaveAiConfig and for mcp handleSaveMcpConfig

@sonarqubecloud
Copy link
Copy Markdown

@rmn-snpk rmn-snpk merged commit ec48346 into main Dec 10, 2025
24 checks passed
@rmn-snpk rmn-snpk deleted the feat/update-connections-page branch December 10, 2025 08:37
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.

3 participants