76 lines
No EOL
2.5 KiB
TypeScript
76 lines
No EOL
2.5 KiB
TypeScript
import { ColumnConfig } from '../FormGenerator';
|
|
import { EditFieldConfig } from '../Popup';
|
|
|
|
// Import React for component types
|
|
import React from 'react';
|
|
|
|
// Re-export connection-related interfaces from hooks
|
|
export type { Connection, CreateConnectionData } from '../../hooks/useConnections';
|
|
import type { Connection } from '../../hooks/useConnections';
|
|
|
|
// Component Props Interfaces
|
|
export interface ConnectionsTableProps {
|
|
connections: Connection[];
|
|
columns: ColumnConfig[];
|
|
actions: TableAction[];
|
|
isLoading?: boolean;
|
|
isConnecting?: boolean;
|
|
isDisconnecting?: boolean;
|
|
onRowSelect?: (selectedRows: Connection[]) => void;
|
|
onDelete?: (connection: Connection) => Promise<void>;
|
|
onDeleteMultiple?: (connections: Connection[]) => Promise<void>;
|
|
}
|
|
|
|
export interface ConnectionEditModalProps {
|
|
isOpen: boolean;
|
|
connection: Connection | null;
|
|
fields: EditFieldConfig[];
|
|
onSave: (updatedConnection: Connection) => Promise<void>;
|
|
onCancel: () => void;
|
|
}
|
|
|
|
export interface ConnectionsErrorDisplayProps {
|
|
error?: string | null;
|
|
connectError?: string | null;
|
|
disconnectError?: string | null;
|
|
}
|
|
|
|
// Table Action Interface
|
|
export interface TableAction {
|
|
label: string;
|
|
onClick: (connection: Connection) => Promise<void> | void;
|
|
icon: React.ReactNode | ((connection: Connection) => React.ReactNode);
|
|
}
|
|
|
|
// Connection Status Types
|
|
export type ConnectionStatus = 'active' | 'pending' | 'expired' | 'revoked';
|
|
export type ConnectionAuthority = 'local' | 'google' | 'msft';
|
|
|
|
// Handler Function Types
|
|
export interface ConnectionHandlers {
|
|
handleCreateConnection: (type: 'msft' | 'google') => Promise<void>;
|
|
handleConnect: (connection: Connection) => Promise<void>;
|
|
handleDisconnect: (connection: Connection) => Promise<void>;
|
|
handleDelete: (connection: Connection) => Promise<void>;
|
|
handleDeleteMultiple: (connections: Connection[]) => Promise<void>;
|
|
handleConnectOrDisconnect: (connection: Connection) => Promise<void>;
|
|
handleEditConnection: (connection: Connection) => Promise<void>;
|
|
handleSaveConnection: (updatedConnection: Connection) => Promise<void>;
|
|
handleCancelEdit: () => void;
|
|
}
|
|
|
|
// Hook Return Types
|
|
export interface ConnectionsLogicReturn extends ConnectionHandlers {
|
|
connections: Connection[];
|
|
isLoading: boolean;
|
|
isConnecting: boolean;
|
|
isDisconnecting: boolean;
|
|
error: string | null;
|
|
connectError: string | null;
|
|
disconnectError: string | null;
|
|
editPopupOpen: boolean;
|
|
editingConnection: Connection | null;
|
|
connectionColumns: ColumnConfig[];
|
|
connectionEditFields: EditFieldConfig[];
|
|
tableActions: TableAction[];
|
|
}
|