Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridge/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "relwave-bridge",
"version": "0.9.0-rc-1",
"version": "0.9.0-rc-5",
"type": "commonjs",
"main": "dist/index.cjs",
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions bridge/src/services/projectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,7 @@ export class ProjectStore {
type?: string;
ssl?: boolean;
name?: string;
url?: string;
} | null {
const get = (...keys: string[]): string | undefined => {
for (const k of keys) {
Expand All @@ -1359,9 +1360,10 @@ export class ProjectStore {
const type = get("DB_TYPE", "DATABASE_TYPE", "DB_ENGINE", "DATABASE_ENGINE");
const sslStr = get("DB_SSL", "DATABASE_SSL");
const name = get("DB_CONNECTION_NAME", "DATABASE_CONNECTION_NAME");
const url = get("DATABASE_URL", "DB_URL");

// Must have at least host or database to be useful
if (!host && !database) return null;
// Must have at least host, database, or url to be useful
if (!host && !database && !url) return null;

const port = portStr ? parseInt(portStr, 10) : undefined;
const ssl = sslStr ? !["false", "0", "no"].includes(sslStr.toLowerCase()) : undefined;
Expand All @@ -1375,6 +1377,7 @@ export class ProjectStore {
type: type?.toLowerCase(),
ssl,
name,
url,
};
}

Expand All @@ -1400,6 +1403,7 @@ export class ProjectStore {
type?: string;
ssl?: boolean;
name?: string;
url?: string;
} | null;
}> {
const sourceMetaPath = path.join(sourcePath, PROJECT_FILES.metadata);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "relwave",
"private": true,
"version": "0.9.0-rc-1",
"version": "0.9.0-rc-5",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "relwave"
version = "0.9.0-rc-1"
version = "0.9.0-rc-5"
description = "A powerful, cross-platform desktop application for database management with native Git version control."
authors = ["yashh56"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "RelWave",
"version": "0.9.0-rc-1",
"version": "0.9.0-rc-5",
"identifier": "tech.relwave.app",
"build": {
"beforeDevCommand": "vite",
Expand Down
99 changes: 71 additions & 28 deletions src/features/database/components/TablesExplorerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ import { ScrollArea } from '@/components/ui/scroll-area';
import { SelectedTable, TableInfo } from "@/features/database/types";
import { CreateTableDialog } from '@/features/schema-explorer/components';
import { useTableExplorerPanel } from '../hooks/useTableExplorerPanel';
import {
ContextMenu,
ContextMenuContent,
ContextMenuItem,
ContextMenuTrigger,
} from "@/components/ui/context-menu";
import InsertDataDialog from '@/features/database/components/InsertDataDialog';
import DropTableDialog from '@/features/schema-explorer/components/DropTableDialog';


interface TablesExplorerPanelProps {
Expand Down Expand Up @@ -36,7 +44,11 @@ export default function TablesExplorerPanel({
setFilter,
toggleFavorite,
filteredTables,
isSelected
isSelected,
insertTableData,
setInsertTableData,
dropTableData,
setDropTableData
} = useTableExplorerPanel({
dbId,
tables,
Expand Down Expand Up @@ -108,36 +120,47 @@ export default function TablesExplorerPanel({
</div>
) : (
filteredTables.map((table) => (
<button
key={`${table.schema}.${table.name}`}
onClick={() => onSelectTable(table.name, table.schema)}
className={`
w-full flex items-center justify-between px-3 py-2 rounded-md
transition-all duration-150 text-left group border border-transparent
${isSelected(table)
? 'bg-primary/10 text-primary border-primary/20 shadow-sm'
: 'hover:bg-muted/55 hover:border-border/50 text-foreground'
}
`}
>
<div className="flex items-center gap-2 flex-1 min-w-0">
<ContextMenu key={`${table.schema}.${table.name}`}>
<ContextMenuTrigger asChild>
<button
onClick={(e) => {
e.stopPropagation();
toggleFavorite(table.name);
}}
className="shrink-0"
onClick={() => onSelectTable(table.name, table.schema)}
className={`
w-full flex items-center justify-between px-3 py-2 rounded-md
transition-all duration-150 text-left group border border-transparent
${isSelected(table)
? 'bg-primary/10 text-primary border-primary/20 shadow-sm'
: 'hover:bg-muted/55 hover:border-border/50 text-foreground'
}
`}
>
<Star
className={`h-3.5 w-3.5 ${favorites.has(table.name)
? 'fill-yellow-500 text-yellow-500'
: 'text-muted-foreground opacity-0 group-hover:opacity-100'
}`}
/>
<div className="flex items-center gap-2 flex-1 min-w-0">
<button
onClick={(e) => {
e.stopPropagation();
toggleFavorite(table.name);
}}
className="shrink-0"
>
<Star
className={`h-3.5 w-3.5 ${favorites.has(table.name)
? 'fill-yellow-500 text-yellow-500'
: 'text-muted-foreground opacity-0 group-hover:opacity-100'
}`}
/>
</button>
<span className="text-sm font-medium truncate font-mono">{table.name}</span>
</div>
</button>
<span className="text-sm font-medium truncate font-mono">{table.name}</span>
</div>
</button>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem onClick={() => setInsertTableData(table)}>
Insert Data
</ContextMenuItem>
<ContextMenuItem onClick={() => setDropTableData(table)} className="text-destructive">
Delete Table
</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
))
)}
</div>
Expand All @@ -155,6 +178,26 @@ export default function TablesExplorerPanel({
onOpenChange={setCreateTableOpen}
schemaName={selectedSchema}
/>

{insertTableData && (
<InsertDataDialog
open={!!insertTableData}
onOpenChange={(open) => !open && setInsertTableData(null)}
dbId={dbId}
schemaName={insertTableData.schema || "public"}
tableName={insertTableData.name}
/>
)}

{dropTableData && (
<DropTableDialog
open={!!dropTableData}
onOpenChange={(open) => !open && setDropTableData(null)}
dbId={dbId}
schemaName={dropTableData.schema || "public"}
tableName={dropTableData.name}
/>
)}
</div>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion src/features/database/hooks/useTableExplorerPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export function useTableExplorerPanel({
}: TablesExplorerPanelProps) {
const [searchQuery, setSearchQuery] = useState('');
const [createTableOpen, setCreateTableOpen] = useState(false);
const [insertTableData, setInsertTableData] = useState<TableInfo | null>(null);
const [dropTableData, setDropTableData] = useState<TableInfo | null>(null);

const [favorites, setFavorites] = useState<Set<string>>(
new Set(JSON.parse(localStorage.getItem('favoriteTables') || '[]'))
Expand Down Expand Up @@ -58,6 +60,10 @@ export function useTableExplorerPanel({
setFilter,
toggleFavorite,
filteredTables,
isSelected
isSelected,
insertTableData,
setInsertTableData,
dropTableData,
setDropTableData
};
}
Loading
Loading