fixed lint issues
This commit is contained in:
parent
b67fe48f72
commit
519d24722e
12 changed files with 54 additions and 46 deletions
|
|
@ -10,7 +10,7 @@ export function Layout() {
|
||||||
// Determine title from current route
|
// Determine title from current route
|
||||||
const getTitle = () => {
|
const getTitle = () => {
|
||||||
const path = location.pathname.replace('/', '');
|
const path = location.pathname.replace('/', '');
|
||||||
if (!path || path === 'dashboard') return 'Dashboard';
|
if (!path || path === 'dashboard') {return 'Dashboard';}
|
||||||
|
|
||||||
// Handle nested routes
|
// Handle nested routes
|
||||||
if (path.includes('/')) {
|
if (path.includes('/')) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { navigation } from '@/lib/constants';
|
import { navigation } from '@/lib/constants';
|
||||||
|
import type { NavigationItem } from '@/lib/constants';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { Dialog, Transition } from '@headlessui/react';
|
import { Dialog, Transition } from '@headlessui/react';
|
||||||
import { XMarkIcon, ChevronDownIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
|
import { XMarkIcon, ChevronDownIcon, ChevronRightIcon } from '@heroicons/react/24/outline';
|
||||||
|
|
@ -101,7 +102,7 @@ function SidebarContent() {
|
||||||
setExpandedItems(newExpanded);
|
setExpandedItems(newExpanded);
|
||||||
};
|
};
|
||||||
|
|
||||||
const isChildActive = (children: any[]) => {
|
const isChildActive = (children: NavigationItem[]) => {
|
||||||
return children.some(child => location.pathname === child.href);
|
return children.some(child => location.pathname === child.href);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -148,7 +149,7 @@ function SidebarContent() {
|
||||||
{item.children.map(child => (
|
{item.children.map(child => (
|
||||||
<li key={child.name}>
|
<li key={child.name}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={child.href!}
|
to={child.href || ''}
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
cn(
|
cn(
|
||||||
isActive
|
isActive
|
||||||
|
|
@ -180,7 +181,7 @@ function SidebarContent() {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<NavLink
|
<NavLink
|
||||||
to={item.href!}
|
to={item.href || ''}
|
||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
cn(
|
cn(
|
||||||
isActive
|
isActive
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,15 @@ interface AddProviderMappingDialogProps {
|
||||||
exchangeId: string;
|
exchangeId: string;
|
||||||
exchangeName: string;
|
exchangeName: string;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onCreateMapping: (request: CreateProviderMappingRequest) => Promise<any>;
|
onCreateMapping: (request: CreateProviderMappingRequest) => Promise<boolean | void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UnmappedExchange {
|
||||||
|
provider_exchange_code: string;
|
||||||
|
provider_exchange_name: string;
|
||||||
|
country_code?: string;
|
||||||
|
currency?: string;
|
||||||
|
symbol_count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddProviderMappingDialog({
|
export function AddProviderMappingDialog({
|
||||||
|
|
@ -21,29 +29,12 @@ export function AddProviderMappingDialog({
|
||||||
const { fetchProviders, fetchUnmappedProviderExchanges } = useExchanges();
|
const { fetchProviders, fetchUnmappedProviderExchanges } = useExchanges();
|
||||||
const [providers, setProviders] = useState<string[]>([]);
|
const [providers, setProviders] = useState<string[]>([]);
|
||||||
const [selectedProvider, setSelectedProvider] = useState('');
|
const [selectedProvider, setSelectedProvider] = useState('');
|
||||||
const [unmappedExchanges, setUnmappedExchanges] = useState<any[]>([]);
|
const [unmappedExchanges, setUnmappedExchanges] = useState<UnmappedExchange[]>([]);
|
||||||
const [selectedProviderExchange, setSelectedProviderExchange] = useState('');
|
const [selectedProviderExchange, setSelectedProviderExchange] = useState('');
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [providersLoading, setProvidersLoading] = useState(false);
|
const [providersLoading, setProvidersLoading] = useState(false);
|
||||||
const [exchangesLoading, setExchangesLoading] = useState(false);
|
const [exchangesLoading, setExchangesLoading] = useState(false);
|
||||||
|
|
||||||
// Load providers on mount
|
|
||||||
useEffect(() => {
|
|
||||||
if (isOpen) {
|
|
||||||
loadProviders();
|
|
||||||
}
|
|
||||||
}, [isOpen, loadProviders]);
|
|
||||||
|
|
||||||
// Load unmapped exchanges when provider changes
|
|
||||||
useEffect(() => {
|
|
||||||
if (selectedProvider) {
|
|
||||||
loadUnmappedExchanges(selectedProvider);
|
|
||||||
} else {
|
|
||||||
setUnmappedExchanges([]);
|
|
||||||
setSelectedProviderExchange('');
|
|
||||||
}
|
|
||||||
}, [selectedProvider, loadUnmappedExchanges]);
|
|
||||||
|
|
||||||
const loadProviders = useCallback(async () => {
|
const loadProviders = useCallback(async () => {
|
||||||
setProvidersLoading(true);
|
setProvidersLoading(true);
|
||||||
try {
|
try {
|
||||||
|
|
@ -71,6 +62,23 @@ export function AddProviderMappingDialog({
|
||||||
[fetchUnmappedProviderExchanges]
|
[fetchUnmappedProviderExchanges]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Load providers on mount
|
||||||
|
useEffect(() => {
|
||||||
|
if (isOpen) {
|
||||||
|
loadProviders();
|
||||||
|
}
|
||||||
|
}, [isOpen, loadProviders]);
|
||||||
|
|
||||||
|
// Load unmapped exchanges when provider changes
|
||||||
|
useEffect(() => {
|
||||||
|
if (selectedProvider) {
|
||||||
|
loadUnmappedExchanges(selectedProvider);
|
||||||
|
} else {
|
||||||
|
setUnmappedExchanges([]);
|
||||||
|
setSelectedProviderExchange('');
|
||||||
|
}
|
||||||
|
}, [selectedProvider, loadUnmappedExchanges]);
|
||||||
|
|
||||||
const handleSubmit = useCallback(
|
const handleSubmit = useCallback(
|
||||||
async (e: React.FormEvent) => {
|
async (e: React.FormEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { DataTable } from '@/components/ui';
|
import { DataTable } from '@/components/ui';
|
||||||
import { PlusIcon, TrashIcon } from '@heroicons/react/24/outline';
|
import { PlusIcon, TrashIcon } from '@heroicons/react/24/outline';
|
||||||
import type { ColumnDef } from '@tanstack/react-table';
|
import type { ColumnDef, Row } from '@tanstack/react-table';
|
||||||
import { useCallback, useMemo, useState } from 'react';
|
import { useCallback, useMemo, useState } from 'react';
|
||||||
import { useExchanges } from '../hooks/useExchanges';
|
import { useExchanges } from '../hooks/useExchanges';
|
||||||
import type { AddProviderMappingDialogState, DeleteDialogState, EditingCell, Exchange } from '../types';
|
import type { AddProviderMappingDialogState, DeleteDialogState, EditingCell, Exchange } from '../types';
|
||||||
|
|
@ -70,7 +70,7 @@ export function ExchangesTable() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleRowExpand = useCallback(
|
const handleRowExpand = useCallback(
|
||||||
async (_row: any) => {
|
(_row: Row<Exchange>) => {
|
||||||
// Row expansion is now handled automatically by TanStack Table
|
// Row expansion is now handled automatically by TanStack Table
|
||||||
// No need to fetch data since all mappings are already loaded
|
// No need to fetch data since all mappings are already loaded
|
||||||
},
|
},
|
||||||
|
|
@ -319,7 +319,6 @@ export function ExchangesTable() {
|
||||||
handleToggleActive,
|
handleToggleActive,
|
||||||
handleAddProviderMapping,
|
handleAddProviderMapping,
|
||||||
handleDeleteExchange,
|
handleDeleteExchange,
|
||||||
handleConfirmDelete,
|
|
||||||
handleRowExpand,
|
handleRowExpand,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -335,7 +334,7 @@ export function ExchangesTable() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderSubComponent = ({ row }: { row: any }) => {
|
const renderSubComponent = ({ row }: { row: Row<Exchange> }) => {
|
||||||
const exchange = row.original as Exchange;
|
const exchange = row.original as Exchange;
|
||||||
const mappings = exchange.provider_mappings || [];
|
const mappings = exchange.provider_mappings || [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export function ProxyStatsCard({ stats }: ProxyStatsCardProps) {
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
const formatDate = (dateString?: string) => {
|
const formatDate = (dateString?: string) => {
|
||||||
if (!dateString) return 'Never';
|
if (!dateString) {return 'Never';}
|
||||||
const date = new Date(dateString);
|
const date = new Date(dateString);
|
||||||
return date.toLocaleString();
|
return date.toLocaleString();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export interface CacheStats {
|
||||||
evictedKeys?: number;
|
evictedKeys?: number;
|
||||||
expiredKeys?: number;
|
expiredKeys?: number;
|
||||||
};
|
};
|
||||||
info?: Record<string, any>;
|
info?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueueStats {
|
export interface QueueStats {
|
||||||
|
|
@ -57,7 +57,7 @@ export interface DatabaseStats {
|
||||||
waiting?: number;
|
waiting?: number;
|
||||||
max: number;
|
max: number;
|
||||||
};
|
};
|
||||||
stats?: Record<string, any>;
|
stats?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SystemHealth {
|
export interface SystemHealth {
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ export function formatUptime(ms: number): string {
|
||||||
const hours = Math.floor(minutes / 60);
|
const hours = Math.floor(minutes / 60);
|
||||||
const days = Math.floor(hours / 24);
|
const days = Math.floor(hours / 24);
|
||||||
|
|
||||||
if (days > 0) return `${days}d ${hours % 24}h`;
|
if (days > 0) {return `${days}d ${hours % 24}h`;}
|
||||||
if (hours > 0) return `${hours}h ${minutes % 60}m`;
|
if (hours > 0) {return `${hours}h ${minutes % 60}m`;}
|
||||||
if (minutes > 0) return `${minutes}m ${seconds % 60}s`;
|
if (minutes > 0) {return `${minutes}m ${seconds % 60}s`;}
|
||||||
return `${seconds}s`;
|
return `${seconds}s`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect, useCallback } from 'react';
|
||||||
import {
|
import {
|
||||||
ArrowPathIcon,
|
ArrowPathIcon,
|
||||||
CircleStackIcon,
|
CircleStackIcon,
|
||||||
|
|
@ -7,7 +7,7 @@ import {
|
||||||
CheckCircleIcon,
|
CheckCircleIcon,
|
||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
import { usePipeline } from './hooks/usePipeline';
|
import { usePipeline } from './hooks/usePipeline';
|
||||||
import type { PipelineOperation } from './types';
|
import type { PipelineOperation, ExchangeStats, ProviderMappingStats, DataClearType } from './types';
|
||||||
|
|
||||||
const operations: PipelineOperation[] = [
|
const operations: PipelineOperation[] = [
|
||||||
// Symbol operations
|
// Symbol operations
|
||||||
|
|
@ -93,14 +93,14 @@ export function PipelinePage() {
|
||||||
const [selectedProvider, setSelectedProvider] = useState('yahoo');
|
const [selectedProvider, setSelectedProvider] = useState('yahoo');
|
||||||
const [clearFirst, setClearFirst] = useState(false);
|
const [clearFirst, setClearFirst] = useState(false);
|
||||||
const [clearDataType, setClearDataType] = useState<'all' | 'exchanges' | 'provider_mappings'>('all');
|
const [clearDataType, setClearDataType] = useState<'all' | 'exchanges' | 'provider_mappings'>('all');
|
||||||
const [stats, setStats] = useState<{ exchanges?: any; providerMappings?: any }>({});
|
const [stats, setStats] = useState<{ exchanges?: ExchangeStats; providerMappings?: ProviderMappingStats }>({});
|
||||||
|
|
||||||
// Load stats on mount
|
// Load stats on mount
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadStats();
|
loadStats();
|
||||||
}, []);
|
}, [loadStats]);
|
||||||
|
|
||||||
const loadStats = async () => {
|
const loadStats = useCallback(async () => {
|
||||||
const [exchangeStats, mappingStats] = await Promise.all([
|
const [exchangeStats, mappingStats] = await Promise.all([
|
||||||
getExchangeStats(),
|
getExchangeStats(),
|
||||||
getProviderMappingStats(),
|
getProviderMappingStats(),
|
||||||
|
|
@ -109,7 +109,7 @@ export function PipelinePage() {
|
||||||
exchanges: exchangeStats,
|
exchanges: exchangeStats,
|
||||||
providerMappings: mappingStats,
|
providerMappings: mappingStats,
|
||||||
});
|
});
|
||||||
};
|
}, [getExchangeStats, getProviderMappingStats]);
|
||||||
|
|
||||||
const handleOperation = async (op: PipelineOperation) => {
|
const handleOperation = async (op: PipelineOperation) => {
|
||||||
switch (op.id) {
|
switch (op.id) {
|
||||||
|
|
@ -368,7 +368,7 @@ export function PipelinePage() {
|
||||||
<label className="block text-xs text-text-muted mb-1">Data Type</label>
|
<label className="block text-xs text-text-muted mb-1">Data Type</label>
|
||||||
<select
|
<select
|
||||||
value={clearDataType}
|
value={clearDataType}
|
||||||
onChange={e => setClearDataType(e.target.value as any)}
|
onChange={e => setClearDataType(e.target.value as DataClearType)}
|
||||||
className="w-full px-2 py-1 text-xs bg-surface border border-border rounded focus:ring-1 focus:ring-warning focus:border-warning"
|
className="w-full px-2 py-1 text-xs bg-surface border border-border rounded focus:ring-1 focus:ring-warning focus:border-warning"
|
||||||
>
|
>
|
||||||
<option value="all">All Data</option>
|
<option value="all">All Data</option>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import type {
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:2003';
|
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:2003';
|
||||||
|
|
||||||
class PipelineApiService {
|
class PipelineApiService {
|
||||||
private async request<T = any>(
|
private async request<T = unknown>(
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
options?: RequestInit
|
options?: RequestInit
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,12 @@ export interface PipelineJobResult {
|
||||||
jobId?: string;
|
jobId?: string;
|
||||||
message?: string;
|
message?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
data?: any;
|
data?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PipelineStatsResult {
|
export interface PipelineStatsResult {
|
||||||
success: boolean;
|
success: boolean;
|
||||||
data?: any;
|
data?: unknown;
|
||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,5 +54,5 @@ export interface PipelineOperation {
|
||||||
method: 'GET' | 'POST';
|
method: 'GET' | 'POST';
|
||||||
category: 'sync' | 'stats' | 'maintenance';
|
category: 'sync' | 'stats' | 'maintenance';
|
||||||
dangerous?: boolean;
|
dangerous?: boolean;
|
||||||
params?: Record<string, any>;
|
params?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
export interface NavigationItem {
|
export interface NavigationItem {
|
||||||
name: string;
|
name: string;
|
||||||
href?: string;
|
href?: string;
|
||||||
icon: any;
|
icon: React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
||||||
children?: NavigationItem[];
|
children?: NavigationItem[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export function registerApplicationServices(
|
||||||
if (config.proxy && config.redis.enabled) {
|
if (config.proxy && config.redis.enabled) {
|
||||||
container.register({
|
container.register({
|
||||||
proxyManager: asFunction(({ cache, logger }) => {
|
proxyManager: asFunction(({ cache, logger }) => {
|
||||||
if (!cache) return null;
|
if (!cache) {return null;}
|
||||||
|
|
||||||
const proxyCache = new NamespacedCache(cache, 'proxy');
|
const proxyCache = new NamespacedCache(cache, 'proxy');
|
||||||
const proxyManager = new ProxyManager(proxyCache, config.proxy, logger);
|
const proxyManager = new ProxyManager(proxyCache, config.proxy, logger);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue