Skip to content

Commit 3731c96

Browse files
Merge pull request #67 from DataPupOrg/feature/sql-intellisense
Feature/sql intellisense
2 parents 458c918 + 86a8026 commit 3731c96

File tree

20 files changed

+1231
-649
lines changed

20 files changed

+1231
-649
lines changed

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ src/
3232
│ ├── DatabaseConnection/ # Connection dialog/form
3333
│ ├── DatabaseExplorer/ # Database tree view
3434
│ ├── Layout/ # Layout components
35-
│ ├── QueryEditor/ # SQL editor component
35+
│ ├── QueryWorkspace/ # Query workspace with SQL editor
3636
│ ├── QueryResults/ # Results grid
3737
│ └── ThemeSwitcher/ # Theme selection dropdown
3838
└── lib/
@@ -57,7 +57,7 @@ Currently supports:
5757
1. **No Connection**: Shows MainPanel with connection options and saved connections
5858
2. **Active Connection**: Shows ActiveConnectionLayout with:
5959
- DatabaseExplorer (left panel, resizable)
60-
- QueryWorkspace (right panel) containing QueryEditor and QueryResults
60+
- QueryWorkspace (right panel) containing SqlEditor and QueryResults
6161

6262
## Development Guidelines
6363

@@ -114,7 +114,7 @@ npm run typecheck # if available
114114
- Implement actual database connection logic
115115
- Add database-specific drivers (pg, mysql2, etc.)
116116
- Implement tree view in DatabaseExplorer
117-
- Add query execution in QueryEditor
117+
- Query execution is implemented in QueryWorkspace with SQL intellisense
118118
- Implement results display in QueryResults
119119

120120
## Important Notes

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ data-pup/
8686
│ │ ├── ActiveConnectionLayout/ # Main connected view
8787
│ │ ├── ConnectionCard/ # Connection display cards
8888
│ │ ├── DatabaseExplorer/ # Database tree view
89-
│ │ ├── QueryEditor/ # SQL editor component
9089
│ │ ├── QueryHistory/ # Query history panel
9190
│ │ ├── QueryTabs/ # Tab management
9291
│ │ ├── QueryWorkspace/ # Query workspace container

src/main/database/base.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,17 @@ export abstract class BaseDatabaseManager implements DatabaseManagerInterface {
289289
database?: string
290290
): Promise<{ success: boolean; schema?: TableSchema; message: string }>
291291

292-
getConnectionInfo(connectionId: string): { host: string; port: number; database: string } | null {
292+
getConnectionInfo(
293+
connectionId: string
294+
): { host: string; port: number; database: string; type: string } | null {
293295
const connection = this.connections.get(connectionId)
294296
if (!connection) return null
295297

296298
return {
297299
host: connection.config.host,
298300
port: connection.config.port,
299-
database: connection.config.database
301+
database: connection.config.database,
302+
type: connection.config.type
300303
}
301304
}
302305

src/main/database/clickhouse.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,16 @@ class ClickHouseManager extends BaseDatabaseManager {
456456
return connection?.isConnected || false
457457
}
458458

459-
getConnectionInfo(connectionId: string): { host: string; port: number; database: string } | null {
459+
getConnectionInfo(
460+
connectionId: string
461+
): { host: string; port: number; database: string; type: string } | null {
460462
const connection = this.connections.get(connectionId)
461463
if (connection) {
462464
return {
463465
host: connection.config.host,
464466
port: connection.config.port,
465-
database: connection.config.database
467+
database: connection.config.database,
468+
type: connection.config.type
466469
}
467470
}
468471
return null

src/main/database/interface.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ export interface DatabaseManagerInterface {
184184
): Promise<{ success: boolean; schema?: TableSchema; message: string }>
185185

186186
// Connection info
187-
getConnectionInfo(connectionId: string): { host: string; port: number; database: string } | null
187+
getConnectionInfo(
188+
connectionId: string
189+
): { host: string; port: number; database: string; type: string } | null
188190
getAllConnections(): string[]
189191
getCapabilities(): DatabaseCapabilities
190192

src/main/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,16 @@ ipcMain.handle('db:getAllConnections', async () => {
381381
}
382382
})
383383

384+
ipcMain.handle('db:getConnectionInfo', async (_, connectionId: string) => {
385+
try {
386+
const info = databaseManager.getConnectionInfo(connectionId)
387+
return { success: true, info }
388+
} catch (error) {
389+
console.error('Error getting connection info:', error)
390+
return { success: false, info: null }
391+
}
392+
})
393+
384394
// IPC handler for AI processing
385395
ipcMain.handle('ai:process', async (_, request) => {
386396
try {

src/preload/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ const api = {
4848
executeBulkOperations: (connectionId: string, operations: any[]) =>
4949
ipcRenderer.invoke('db:executeBulkOperations', connectionId, operations),
5050
getPrimaryKeys: (connectionId: string, table: string, database?: string) =>
51-
ipcRenderer.invoke('db:getPrimaryKeys', connectionId, table, database)
51+
ipcRenderer.invoke('db:getPrimaryKeys', connectionId, table, database),
52+
getConnectionInfo: (connectionId: string) =>
53+
ipcRenderer.invoke('db:getConnectionInfo', connectionId)
5254
},
5355
connections: {
5456
getAll: () => ipcRenderer.invoke('connections:getAll'),

src/renderer/components/DatabaseExplorer/DatabaseExplorer.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import { useState, useEffect } from 'react'
22
import { Box, Flex, ScrollArea, Text, Button } from '@radix-ui/themes'
33
import { Badge, Skeleton } from '../ui'
44
import './DatabaseExplorer.css'
5-
import {
6-
ReloadIcon,
7-
ChevronRightIcon,
8-
ChevronDownIcon,
9-
TableIcon
10-
} from '@radix-ui/react-icons'
5+
import { ReloadIcon, ChevronRightIcon, ChevronDownIcon, TableIcon } from '@radix-ui/react-icons'
116

127
interface DatabaseExplorerProps {
138
connectionId: string
@@ -272,7 +267,7 @@ export function DatabaseExplorer({
272267
className={`database-item ${db.expanded ? 'expanded' : ''}`}
273268
p="2"
274269
>
275-
<Box
270+
<Box
276271
className="expand-icon"
277272
onClick={() => toggleDatabase(db.name)}
278273
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}
@@ -347,7 +342,7 @@ export function DatabaseExplorer({
347342
style={{ cursor: obj.type === 'table' ? 'pointer' : 'default' }}
348343
>
349344
{obj.type === 'table' && (
350-
<Box
345+
<Box
351346
className="expand-icon"
352347
onClick={() => toggleTable(db.name, obj.name)}
353348
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}

src/renderer/components/Layout/MainPanel.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Box, Flex, Text, Button, ScrollArea, Heading } from '@radix-ui/themes'
2-
import { Card, Logo } from '../ui'
1+
import { Box, Flex, Text, Button, Heading } from '@radix-ui/themes'
2+
import { Logo } from '../ui'
33
import { DatabaseConnection } from '../DatabaseConnection/DatabaseConnection'
4-
import { QueryEditor } from '../QueryEditor/QueryEditor'
54
import { ThemeSwitcher } from '../ThemeSwitcher'
65
import { ActiveConnectionLayout } from '../ActiveConnectionLayout'
76
import { ConnectionCard, ConnectionCardSkeleton } from '../ConnectionCard'

src/renderer/components/QueryEditor/QueryEditor.css

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)