mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-12-23 09:34:23 +00:00
Fix some lint issues
This commit is contained in:
@@ -4,8 +4,7 @@ import userEvent from '@testing-library/user-event'
|
|||||||
import InstanceList from '@/components/InstanceList'
|
import InstanceList from '@/components/InstanceList'
|
||||||
import { InstancesProvider } from '@/contexts/InstancesContext'
|
import { InstancesProvider } from '@/contexts/InstancesContext'
|
||||||
import { instancesApi } from '@/lib/api'
|
import { instancesApi } from '@/lib/api'
|
||||||
import type { Instance } from '@/types/instance'
|
import { BackendType, type Instance } from '@/types/instance'
|
||||||
import { BackendType } from '@/types/instance'
|
|
||||||
import { AuthProvider } from '@/contexts/AuthContext'
|
import { AuthProvider } from '@/contexts/AuthContext'
|
||||||
|
|
||||||
// Mock the API
|
// Mock the API
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const KeyValueInput: React.FC<KeyValueInputProps> = ({
|
|||||||
// Reset to single empty row if value is explicitly undefined/null
|
// Reset to single empty row if value is explicitly undefined/null
|
||||||
setPairs([{ key: '', value: '' }])
|
setPairs([{ key: '', value: '' }])
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [value])
|
}, [value])
|
||||||
|
|
||||||
// Update parent component when pairs change
|
// Update parent component when pairs change
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ import { render, screen, waitFor } from "@testing-library/react";
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { InstancesProvider, useInstances } from "@/contexts/InstancesContext";
|
import { InstancesProvider, useInstances } from "@/contexts/InstancesContext";
|
||||||
import { instancesApi } from "@/lib/api";
|
import { instancesApi } from "@/lib/api";
|
||||||
import type { Instance } from "@/types/instance";
|
import { BackendType, type Instance } from "@/types/instance";
|
||||||
import { BackendType } from "@/types/instance";
|
|
||||||
import { AuthProvider } from "../AuthContext";
|
import { AuthProvider } from "../AuthContext";
|
||||||
|
|
||||||
// Mock the API module
|
// Mock the API module
|
||||||
|
|||||||
@@ -156,11 +156,14 @@ class HealthService {
|
|||||||
this.callbacks.set(instanceName, new Set())
|
this.callbacks.set(instanceName, new Set())
|
||||||
}
|
}
|
||||||
|
|
||||||
this.callbacks.get(instanceName)!.add(callback)
|
const callbacks = this.callbacks.get(instanceName)
|
||||||
|
if (callbacks) {
|
||||||
|
callbacks.add(callback)
|
||||||
|
|
||||||
// Start health checking if this is the first subscriber
|
// Start health checking if this is the first subscriber
|
||||||
if (this.callbacks.get(instanceName)!.size === 1) {
|
if (callbacks.size === 1) {
|
||||||
this.startHealthCheck(instanceName)
|
this.startHealthCheck(instanceName)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return unsubscribe function
|
// Return unsubscribe function
|
||||||
@@ -214,22 +217,24 @@ class HealthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start new interval with appropriate timing
|
// Start new interval with appropriate timing
|
||||||
const interval = setInterval(async () => {
|
const interval = setInterval(() => {
|
||||||
try {
|
void (async () => {
|
||||||
const health = await this.performHealthCheck(instanceName)
|
try {
|
||||||
this.notifyCallbacks(instanceName, health)
|
const health = await this.performHealthCheck(instanceName)
|
||||||
|
this.notifyCallbacks(instanceName, health)
|
||||||
|
|
||||||
// Check if state changed and adjust interval
|
// Check if state changed and adjust interval
|
||||||
const previousState = this.lastHealthState.get(instanceName)
|
const previousState = this.lastHealthState.get(instanceName)
|
||||||
this.lastHealthState.set(instanceName, health.state)
|
this.lastHealthState.set(instanceName, health.state)
|
||||||
|
|
||||||
if (previousState !== health.state) {
|
if (previousState !== health.state) {
|
||||||
this.adjustPollingInterval(instanceName, health.state)
|
this.adjustPollingInterval(instanceName, health.state)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Health check failed for ${instanceName}:`, error)
|
||||||
|
// Continue polling even on error
|
||||||
}
|
}
|
||||||
} catch (error) {
|
})()
|
||||||
console.error(`Health check failed for ${instanceName}:`, error)
|
|
||||||
// Continue polling even on error
|
|
||||||
}
|
|
||||||
}, pollInterval)
|
}, pollInterval)
|
||||||
|
|
||||||
this.intervals.set(instanceName, interval)
|
this.intervals.set(instanceName, interval)
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ import './index.css'
|
|||||||
import { AuthProvider } from './contexts/AuthContext'
|
import { AuthProvider } from './contexts/AuthContext'
|
||||||
import { ConfigProvider } from './contexts/ConfigContext'
|
import { ConfigProvider } from './contexts/ConfigContext'
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
const rootElement = document.getElementById('root')
|
||||||
|
if (!rootElement) throw new Error('Failed to find the root element')
|
||||||
|
|
||||||
|
ReactDOM.createRoot(rootElement).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<AuthProvider>
|
<AuthProvider>
|
||||||
<ConfigProvider>
|
<ConfigProvider>
|
||||||
|
|||||||
Reference in New Issue
Block a user