mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Autofix eslint issues
This commit is contained in:
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|||||||
import Header from "@/components/Header";
|
import Header from "@/components/Header";
|
||||||
import InstanceList from "@/components/InstanceList";
|
import InstanceList from "@/components/InstanceList";
|
||||||
import InstanceModal from "@/components/InstanceModal";
|
import InstanceModal from "@/components/InstanceModal";
|
||||||
import { CreateInstanceOptions, Instance } from "@/types/instance";
|
import { type CreateInstanceOptions, type Instance } from "@/types/instance";
|
||||||
import { useInstances } from "@/contexts/InstancesContext";
|
import { useInstances } from "@/contexts/InstancesContext";
|
||||||
import SystemInfoModal from "./components/SystemInfoModal";
|
import SystemInfoModal from "./components/SystemInfoModal";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event'
|
|||||||
import App from '@/App'
|
import App from '@/App'
|
||||||
import { InstancesProvider } from '@/contexts/InstancesContext'
|
import { InstancesProvider } from '@/contexts/InstancesContext'
|
||||||
import { instancesApi } from '@/lib/api'
|
import { instancesApi } from '@/lib/api'
|
||||||
import { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
|
|
||||||
// Mock the API
|
// Mock the API
|
||||||
vi.mock('@/lib/api', () => ({
|
vi.mock('@/lib/api', () => ({
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ui/src/components/HealthBadge.tsx
|
// ui/src/components/HealthBadge.tsx
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { HealthStatus } from "@/types/instance";
|
import type { HealthStatus } from "@/types/instance";
|
||||||
import { CheckCircle, Loader2, XCircle } from "lucide-react";
|
import { CheckCircle, Loader2, XCircle } from "lucide-react";
|
||||||
|
|
||||||
interface HealthBadgeProps {
|
interface HealthBadgeProps {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ui/src/components/InstanceCard.tsx
|
// ui/src/components/InstanceCard.tsx
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { Instance } from "@/types/instance";
|
import type { Instance } from "@/types/instance";
|
||||||
import { Edit, FileText, Play, Square, Trash2 } from "lucide-react";
|
import { Edit, FileText, Play, Square, Trash2 } from "lucide-react";
|
||||||
import LogsModal from "@/components/LogModal";
|
import LogsModal from "@/components/LogModal";
|
||||||
import HealthBadge from "@/components/HealthBadge";
|
import HealthBadge from "@/components/HealthBadge";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// ui/src/components/InstanceList.tsx
|
// ui/src/components/InstanceList.tsx
|
||||||
import { useInstances } from '@/contexts/InstancesContext'
|
import { useInstances } from '@/contexts/InstancesContext'
|
||||||
import InstanceCard from '@/components/InstanceCard'
|
import InstanceCard from '@/components/InstanceCard'
|
||||||
import { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
import { memo } from 'react'
|
import { memo } from 'react'
|
||||||
|
|
||||||
interface InstanceListProps {
|
interface InstanceListProps {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { CreateInstanceOptions, Instance } from "@/types/instance";
|
import type { CreateInstanceOptions, Instance } from "@/types/instance";
|
||||||
import { getBasicFields, getAdvancedFields } from "@/lib/zodFormUtils";
|
import { getBasicFields, getAdvancedFields } from "@/lib/zodFormUtils";
|
||||||
import { ChevronDown, ChevronRight } from "lucide-react";
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
||||||
import ZodFormField from "@/components/ZodFormField";
|
import ZodFormField from "@/components/ZodFormField";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
import { Label } from '@/components/ui/label'
|
import { Label } from '@/components/ui/label'
|
||||||
import { Checkbox } from '@/components/ui/checkbox'
|
import { Checkbox } from '@/components/ui/checkbox'
|
||||||
import { CreateInstanceOptions } from '@/types/instance'
|
import type { CreateInstanceOptions } from '@/types/instance'
|
||||||
import { getFieldType, basicFieldsConfig } from '@/lib/zodFormUtils'
|
import { getFieldType, basicFieldsConfig } from '@/lib/zodFormUtils'
|
||||||
|
|
||||||
interface ZodFormFieldProps {
|
interface ZodFormFieldProps {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|||||||
import { render, screen } from '@testing-library/react'
|
import { render, screen } from '@testing-library/react'
|
||||||
import userEvent from '@testing-library/user-event'
|
import userEvent from '@testing-library/user-event'
|
||||||
import InstanceCard from '@/components/InstanceCard'
|
import InstanceCard from '@/components/InstanceCard'
|
||||||
import { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
|
|
||||||
// Mock the health hook since we're not testing health logic here
|
// Mock the health hook since we're not testing health logic here
|
||||||
vi.mock('@/hooks/useInstanceHealth', () => ({
|
vi.mock('@/hooks/useInstanceHealth', () => ({
|
||||||
|
|||||||
@@ -4,7 +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 { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
|
|
||||||
// Mock the API
|
// Mock the API
|
||||||
vi.mock('@/lib/api', () => ({
|
vi.mock('@/lib/api', () => ({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|||||||
import { render, screen, waitFor } from '@testing-library/react'
|
import { render, screen, waitFor } from '@testing-library/react'
|
||||||
import userEvent from '@testing-library/user-event'
|
import userEvent from '@testing-library/user-event'
|
||||||
import InstanceModal from '@/components/InstanceModal'
|
import InstanceModal from '@/components/InstanceModal'
|
||||||
import { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
|
|
||||||
describe('InstanceModal - Form Logic and Validation', () => {
|
describe('InstanceModal - Form Logic and Validation', () => {
|
||||||
const mockOnSave = vi.fn()
|
const mockOnSave = vi.fn()
|
||||||
@@ -136,7 +136,7 @@ describe('InstanceModal - Form Logic and Validation', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it('pre-fills form with existing instance data', async () => {
|
it('pre-fills form with existing instance data', () => {
|
||||||
render(
|
render(
|
||||||
<InstanceModal
|
<InstanceModal
|
||||||
open={true}
|
open={true}
|
||||||
@@ -177,7 +177,7 @@ describe('InstanceModal - Form Logic and Validation', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('shows correct button text for running vs stopped instances', async () => {
|
it('shows correct button text for running vs stopped instances', () => {
|
||||||
const runningInstance: Instance = { ...mockInstance, running: true }
|
const runningInstance: Instance = { ...mockInstance, running: true }
|
||||||
|
|
||||||
const { rerender } = render(
|
const { rerender } = render(
|
||||||
@@ -205,7 +205,7 @@ describe('InstanceModal - Form Logic and Validation', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('Auto Restart Configuration', () => {
|
describe('Auto Restart Configuration', () => {
|
||||||
it('shows restart options when auto restart is enabled', async () => {
|
it('shows restart options when auto restart is enabled', () => {
|
||||||
render(
|
render(
|
||||||
<InstanceModal
|
<InstanceModal
|
||||||
open={true}
|
open={true}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { createContext, useContext, useState, useEffect, useCallback, ReactNode } from 'react'
|
import type { ReactNode } from 'react';
|
||||||
import { CreateInstanceOptions, Instance } from '@/types/instance'
|
import { createContext, useContext, useState, useEffect, useCallback } from 'react'
|
||||||
|
import type { CreateInstanceOptions, Instance } from '@/types/instance'
|
||||||
import { instancesApi } from '@/lib/api'
|
import { instancesApi } from '@/lib/api'
|
||||||
|
|
||||||
interface InstancesContextState {
|
interface InstancesContextState {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||||
import { render, screen, waitFor } from '@testing-library/react'
|
import { render, screen, waitFor } from '@testing-library/react'
|
||||||
import { 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 { Instance } from '@/types/instance'
|
import type { Instance } from '@/types/instance'
|
||||||
|
|
||||||
// Mock the API module
|
// Mock the API module
|
||||||
vi.mock('@/lib/api', () => ({
|
vi.mock('@/lib/api', () => ({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ui/src/hooks/useInstanceHealth.ts
|
// ui/src/hooks/useInstanceHealth.ts
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { HealthStatus } from '@/types/instance'
|
import type { HealthStatus } from '@/types/instance'
|
||||||
import { healthService } from '@/lib/healthService'
|
import { healthService } from '@/lib/healthService'
|
||||||
|
|
||||||
export function useInstanceHealth(instanceName: string, isRunning: boolean): HealthStatus | undefined {
|
export function useInstanceHealth(instanceName: string, isRunning: boolean): HealthStatus | undefined {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CreateInstanceOptions, Instance } from "@/types/instance";
|
import type { CreateInstanceOptions, Instance } from "@/types/instance";
|
||||||
|
|
||||||
const API_BASE = "/api/v1";
|
const API_BASE = "/api/v1";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { HealthStatus } from '@/types/instance'
|
import { type HealthStatus } from '@/types/instance'
|
||||||
|
|
||||||
type HealthCallback = (health: HealthStatus) => void
|
type HealthCallback = (health: HealthStatus) => void
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CreateInstanceOptions, getAllFieldKeys } from '@/schemas/instanceOptions'
|
import type { CreateInstanceOptions} from '@/schemas/instanceOptions';
|
||||||
|
import { getAllFieldKeys } from '@/schemas/instanceOptions'
|
||||||
|
|
||||||
// Only define the basic fields we want to show by default
|
// Only define the basic fields we want to show by default
|
||||||
export const basicFieldsConfig: Record<string, {
|
export const basicFieldsConfig: Record<string, {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { CreateInstanceOptions } from '@/schemas/instanceOptions'
|
import type { CreateInstanceOptions } from '@/schemas/instanceOptions'
|
||||||
|
|
||||||
export { type CreateInstanceOptions } from '@/schemas/instanceOptions'
|
export { type CreateInstanceOptions } from '@/schemas/instanceOptions'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user