ruvector/studio/components/interfaces/Connect/Connect.utils.ts
rUv 814f595995 feat(studio): Add complete RuVector Studio application
Major additions:
- Complete Next.js studio application with 1600+ components
- Docker support (Dockerfile.combined, docker-compose.yml)
- GCP deployment documentation and benchmarks
- SQL benchmark scripts for performance testing
- Sentry integration for monitoring
- Comprehensive test suite and mocks

Studio features:
- Dashboard and admin interfaces
- Data visualization components
- Authentication and user management
- API integration with RuVector backend
- Static data and public assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:04:48 +00:00

55 lines
1.5 KiB
TypeScript

import { ConnectionType, FRAMEWORKS, MOBILES, ORMS } from './Connect.constants'
export function getProjectRef(url: string): string | null {
const regex: RegExp = /https:\/\/([^\.]+)\./
const match: RegExpMatchArray | null = url.match(regex)
if (match) {
return match[1]
} else {
return null
}
}
export const getContentFilePath = ({
connectionObject,
selectedParent,
selectedChild,
selectedGrandchild,
}: {
selectedParent: string
selectedChild: string
selectedGrandchild: string
connectionObject: ConnectionType[]
}) => {
const parent = connectionObject.find((item) => item.key === selectedParent)
if (parent) {
const child = parent.children.find((child) => child.key === selectedChild)
// check grandchild first, then child, then parent as the fallback
if (child) {
const grandchild = child.children.find((grandchild) => grandchild.key === selectedGrandchild)
if (grandchild) {
return `${selectedParent}/${selectedChild}/${selectedGrandchild}`
} else {
return `${selectedParent}/${selectedChild}`
}
} else {
return selectedParent
}
}
return ''
}
export function inferConnectTabFromParentKey(
parentKey: string | null
): 'frameworks' | 'mobiles' | 'orms' | null {
if (!parentKey) return null
if (FRAMEWORKS.find((x: ConnectionType) => x.key === parentKey)) return 'frameworks'
if (MOBILES.find((x: ConnectionType) => x.key === parentKey)) return 'mobiles'
if (ORMS.find((x: ConnectionType) => x.key === parentKey)) return 'orms'
return null
}