modified: frontend/src/pages/DatabaseSchema.tsx
This commit is contained in:
@@ -15,9 +15,10 @@ import {
|
||||
} from '@xyflow/react';
|
||||
import '@xyflow/react/dist/style.css';
|
||||
import Dagre from '@dagrejs/dagre';
|
||||
import { Database as DatabaseIcon, Loader2, Key, Link, RefreshCw, Search, X, Table2, MessageSquare, Columns } from 'lucide-react';
|
||||
import { Database as DatabaseIcon, Loader2, Key, Link, Search, X, Table2, MessageSquare, Columns } from 'lucide-react';
|
||||
import { databasesApi, schemaApi, TableInfo, SchemaData } from '@/services/api';
|
||||
import { Database } from '@/types';
|
||||
import { useAuthStore } from '@/stores/authStore';
|
||||
|
||||
// Search result type
|
||||
interface SearchResult {
|
||||
@@ -273,6 +274,7 @@ function getLayoutedElements(schema: SchemaData): { nodes: Node[]; edges: Edge[]
|
||||
|
||||
export default function DatabaseSchema() {
|
||||
const queryClient = useQueryClient();
|
||||
const user = useAuthStore((state) => state.user);
|
||||
const [selectedDbId, setSelectedDbId] = useState<string>('');
|
||||
const [searchQuery, setSearchQuery] = useState<string>('');
|
||||
const [selectedTables, setSelectedTables] = useState<Set<string>>(new Set());
|
||||
@@ -581,22 +583,25 @@ export default function DatabaseSchema() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Refresh button hidden but mutation available for future use
|
||||
{selectedDbId && (
|
||||
{selectedDbId && user?.is_superadmin && (
|
||||
<button
|
||||
onClick={() => refreshMutation.mutate()}
|
||||
disabled={refreshMutation.isPending}
|
||||
className="flex items-center gap-2 px-4 py-1.5 bg-primary-600 text-white rounded-md hover:bg-primary-700 disabled:opacity-50 text-sm font-medium"
|
||||
className="flex items-center gap-2 px-3 py-1.5 text-gray-600 hover:text-gray-800 hover:bg-gray-200 rounded-md disabled:opacity-50 text-sm"
|
||||
title="Обновить схему из базы данных"
|
||||
>
|
||||
{refreshMutation.isPending ? (
|
||||
<Loader2 className="animate-spin" size={16} />
|
||||
) : (
|
||||
<RefreshCw size={16} />
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
<path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>
|
||||
<path d="M3 3v5h5"/>
|
||||
<path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/>
|
||||
<path d="M16 21h5v-5"/>
|
||||
</svg>
|
||||
)}
|
||||
Обновить схему
|
||||
</button>
|
||||
)}
|
||||
*/}
|
||||
|
||||
{schema && (
|
||||
<div className="text-sm text-gray-500 ml-auto">
|
||||
|
||||
Reference in New Issue
Block a user