refactor(frontend): services/api 迁至 src/api,http 迁至 utils/request
对齐 Vue 后台惯例: - src/api/ 域 API(原 services/api) - src/utils/request.ts HTTP 封装(原 services/http.ts) - src/utils/export.ts 客户端导出工具 - src/utils/index.ts 工具统一出口 全局导入改为 @/api 与 @/utils/request,tsc + build 通过。
This commit is contained in:
1 parent
9bf35b369c
commit
d19a03d427
145 files changed
+156
-142
No files matched your search
@@ -1,7 +1,7 @@
|
||||
// Agent 管理
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const agentApi = {
|
||||
getLatest: () => http.get('/agent/latest'),
|
||||
@@ -1,7 +1,7 @@
|
||||
// AI 智能运维 (LLM 对话/告警分析/容量预测)
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http } from '../http';
|
||||
import { http } from '@/utils/request';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
export interface LLMConfigData {
|
||||
@@ -1,7 +1,7 @@
|
||||
// 用户认证 & LDAP
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, getApiBase, type ListResponse } from '../http';
|
||||
import { http, getApiBase, type ListResponse } from '@/utils/request';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
export const userApi = {
|
||||
@@ -1,7 +1,7 @@
|
||||
// 自动化运维 (定时任务/脚本/Ansible)
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const cronJobApi = {
|
||||
getJobs: async (params?: { page?: number; page_size?: number }) => {
|
||||
@@ -1,7 +1,7 @@
|
||||
// 云账号/平台/账单
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const cloudApi = {
|
||||
getAccounts: async () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
// Dashboard 统计数据
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http } from '../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const dashboardStatsApi = {
|
||||
getStats: async () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
// CI/CD 流水线/发布配置/凭证
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const pipelineApi = {
|
||||
getPipelines: async (params?: { page?: number; page_size?: number }) => {
|
||||
@@ -1,5 +1,5 @@
|
||||
// API 统一出口 — 从各域模块 re-export
|
||||
// 所有 API 方法通过 `import { xxxApi } from "@/services/api"` 访问
|
||||
// 所有 API 方法通过 `import { xxxApi } from "@/api"` 访问 // Logan.Li
|
||||
|
||||
export * from './auth';
|
||||
export * from './dashboard';
|
||||
@@ -0,0 +1,3 @@
|
||||
// Kubernetes API — 子模块 re-export(保持 @/api 导入路径不变) // Logan.Li
|
||||
|
||||
export { kubernetesApi } from './kubernetes/index';
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Kubernetes 集群管理 API // Logan.Li
|
||||
|
||||
import { http, type ListResponse } from '../../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const clusterApi = {
|
||||
getClusters: async () => http.get<ListResponse>('/kubernetes-clusters'),
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Kubernetes API 辅助:流式 URL / WebSocket / 导出 // Logan.Li
|
||||
|
||||
import { buildApiUrl, getAuthToken, getWsBase, http } from '../../http';
|
||||
import { exportAsCSV, exportAsJSON } from '@/lib/export-utils';
|
||||
import { buildApiUrl, getAuthToken, getWsBase, http } from '@/utils/request';
|
||||
import { exportAsCSV, exportAsJSON } from '@/utils/export';
|
||||
|
||||
export { exportAsCSV, exportAsJSON };
|
||||
|
||||
File renamed without changes.
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Kubernetes Namespace API // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const namespaceApi = {
|
||||
getNamespaces: async (clusterCode: string) => http.get(`/kubernetes/${clusterCode}/namespaces`),
|
||||
@@ -1,6 +1,6 @@
|
||||
// Kubernetes 节点 API // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const nodeApi = {
|
||||
getNodes: async (clusterId: number | string) => http.get(`/kubernetes-clusters/${clusterId}/nodes`),
|
||||
@@ -1,6 +1,6 @@
|
||||
// Kubernetes Pod API(日志 / Exec / 文件 / 指标) // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
import {
|
||||
buildPodExecWsUrl,
|
||||
buildPodFileDownloadUrl,
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Kubernetes 命名空间资源 / YAML / 事件 / 容量 API // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const resourceApi = {
|
||||
getNamespaceServices: async (clusterCode: string, namespace: string) =>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Kubernetes 工作负载 API(Deployment / StatefulSet / HPA / CronJob) // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const workloadApi = {
|
||||
scaleDeployment: async (clusterCode: string, namespace: string, name: string, replicas: number) =>
|
||||
@@ -1,7 +1,7 @@
|
||||
// 监控告警 (规则/通知/大屏/Prometheus/Zabbix)
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const alertApi = {
|
||||
getAlerts: async (params?: { page?: number; page_size?: number; status?: string; severity?: string }) => {
|
||||
@@ -1,7 +1,7 @@
|
||||
// 服务器/资产/区域/资源型号
|
||||
// 从 services/api.ts 拆分 — Q3 api.ts 模块化
|
||||
|
||||
import { http, type ListResponse } from '../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const serverApi = {
|
||||
getServers: async (params?: { page?: number; page_size?: number; keyword?: string; status?: string }) => {
|
||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
// 审批流程 API // Logan.Li
|
||||
|
||||
import { http } from '../../http';
|
||||
import { http } from '@/utils/request';
|
||||
|
||||
export const approvalWorkflowApi = {
|
||||
list: async (params?: { category?: string }) => http.get('/approval-workflows', params),
|
||||
@@ -1,6 +1,6 @@
|
||||
// 审计日志 API // Logan.Li
|
||||
|
||||
import { http, type ListResponse } from '../../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const auditApi = {
|
||||
getLogs: async (params?: {
|
||||
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
// 终端会话 / 命令 / 登录日志 API // Logan.Li
|
||||
|
||||
import { http, type ListResponse } from '../../http';
|
||||
import { http, type ListResponse } from '@/utils/request';
|
||||
|
||||
export const terminalSessionApi = {
|
||||
list: async (params?: {
|
||||
@@ -2,7 +2,7 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { agentApi } from '@/services/api';
|
||||
import { agentApi } from '@/api';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { agentApi } from '@/services/api';
|
||||
import { agentApi } from '@/api';
|
||||
import { AgentWizard } from './AgentWizard';
|
||||
import { HostDetailDialog } from './HostDetailDialog';
|
||||
import { isOnline, timeAgo, asList } from './agentUtils';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Agent 告警规则编辑/新建弹窗(自包含表单状态,从 AgentAlerts.tsx 提取) // Logan.Li
|
||||
import { useState, useEffect } from 'react';
|
||||
import { toast } from 'sonner';
|
||||
import { agentApi } from '@/services/api';
|
||||
import { agentApi } from '@/api';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Copy, Check, Terminal, Download, Settings, Play, Cpu, Zap, Loader2, Server, Shield } from 'lucide-react';
|
||||
import { serverApi } from '@/services/api';
|
||||
import { serverApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
interface AgentWizardProps {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 主机详情弹窗:展示历史指标趋势图 + 端口发现列表(从 AgentMonitor.tsx 提取) // Logan.Li
|
||||
import { useState, useEffect } from 'react';
|
||||
import { agentApi } from '@/services/api';
|
||||
import { agentApi } from '@/api';
|
||||
import { isOnline, timeAgo, asList } from './agentUtils';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { alertApi, aiApi } from '@/services/api';
|
||||
import { alertApi, aiApi } from '@/api';
|
||||
import {
|
||||
AlertTriangle,
|
||||
Brain,
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { toast } from 'sonner';
|
||||
import { aiApi, alertApi, agentApi, dashboardStatsApi, type LLMConfigData, type ChatHistoryItem } from '@/services/api';
|
||||
import { aiApi, alertApi, agentApi, dashboardStatsApi, type LLMConfigData, type ChatHistoryItem } from '@/api';
|
||||
import {
|
||||
Bot,
|
||||
Send,
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
Minus,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { dashboardStatsApi, serverApi, alertApi } from '@/services/api';
|
||||
import { dashboardStatsApi, serverApi, alertApi } from '@/api';
|
||||
import { PredictiveCapacityTab } from './PredictiveCapacityTab';
|
||||
import {
|
||||
computePredictions,
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
} from '@/components/ui/dialog';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { approvalApi } from '@/services/api';
|
||||
import { approvalApi } from '@/api';
|
||||
import { parseFields, APPROVAL_TYPE_OPTIONS } from './helpers';
|
||||
|
||||
interface ApprovalCreateDialogProps {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
Plus,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { approvalApi } from '@/services/api';
|
||||
import { approvalApi } from '@/api';
|
||||
import { ApprovalProcessTab } from './ApprovalProcessTab';
|
||||
import { ApprovalTemplateTab } from './ApprovalTemplateTab';
|
||||
import { ApprovalDetailDialog } from './ApprovalDetailDialog';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useState, useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { User, Lock, Palette, Check, Loader2, AlertCircle, Eye, EyeOff } from 'lucide-react';
|
||||
import { useUserStore } from '@/store';
|
||||
import { userApi } from '@/services/api';
|
||||
import { userApi } from '@/api';
|
||||
import { useTheme, THEME_OPTIONS } from '@/hooks/useTheme';
|
||||
import { cn } from '@/lib/utils';
|
||||
import {
|
||||
|
||||
@@ -20,7 +20,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { toast } from 'sonner';
|
||||
import { cronJobApi, scriptApi } from '@/services/api';
|
||||
import { cronJobApi, scriptApi } from '@/api';
|
||||
|
||||
// 定时任务类型定义 // Logan.Li
|
||||
const jobTypes = [
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
PackageOpen,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { cronJobApi } from '@/services/api';
|
||||
import { cronJobApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { getStatusBadge, parseCron } from './cronJobHelpers';
|
||||
import { CronJobFormDialog } from './CronJobFormDialog';
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { History, Loader2, Terminal } from 'lucide-react';
|
||||
import { taskExecutionApi } from '@/services/api';
|
||||
import { taskExecutionApi } from '@/api';
|
||||
import { getStatusBadge } from './cronJobHelpers';
|
||||
|
||||
// 定时任务执行历史弹窗(打开时自动加载,点击行展开输出) // Logan.Li
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { scriptApi, taskExecutionApi } from '@/services/api';
|
||||
import { scriptApi, taskExecutionApi } from '@/api';
|
||||
import {
|
||||
type Script, type ExecutionRecord, mapScript, scriptTypes, genCode,
|
||||
} from './script-helpers';
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { billingApi } from '@/services/api';
|
||||
import { billingApi } from '@/api';
|
||||
import { providerLabels } from './CloudBillingHelpers';
|
||||
|
||||
const emptyRecord = {
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
} from '@/components/ui/select';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { billingApi } from '@/services/api';
|
||||
import { billingApi } from '@/api';
|
||||
import { providerLabels } from './CloudBillingHelpers';
|
||||
|
||||
const emptyRule = { name: '', provider: '', metric: 'daily', threshold: '', operator: '>', enabled: true };
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
RefreshCw,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { cloudApi } from '@/services/api';
|
||||
import { cloudApi } from '@/api';
|
||||
import { CloudBrandIcon, getProviderColor } from '@/components/icons/CloudBrandIcon';
|
||||
|
||||
const providerLabels: Record<string, string> = {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { billingApi } from '@/services/api';
|
||||
import { billingApi } from '@/api';
|
||||
import { formatCurrency, StatCard, TrendChart, providerLabels, providerColors } from './CloudBillingHelpers';
|
||||
import { StatStrip } from '@/components/ui/stat-strip';
|
||||
import { BillingRecordDialog } from './BillingRecordDialog';
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
RefreshCw,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { cloudApi } from '@/services/api';
|
||||
import { cloudApi } from '@/api';
|
||||
|
||||
export function DomainManager() {
|
||||
const [domains, setDomains] = useState<any[]>([]);
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
ExternalLink,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { platformApi } from '@/services/api';
|
||||
import { platformApi } from '@/api';
|
||||
|
||||
const typeLabels: Record<string, string> = {
|
||||
public: '公有云',
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
XCircle,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { regionApi } from '@/services/api';
|
||||
import { regionApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Clock, Server, ArrowRight } from 'lucide-react';
|
||||
import { dashboardStatsApi, serverApi, kubernetesApi } from '@/services/api';
|
||||
import { dashboardStatsApi, serverApi, kubernetesApi } from '@/api';
|
||||
import { StatStrip } from '@/components/ui/stat-strip';
|
||||
import { CostOverviewCard, TopResourceUsageCard, ResourceUsageCard } from './DashboardCharts';
|
||||
import {
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
History,
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
import { getStatusBadge, getEnvBadge } from './releaseHelpers';
|
||||
import { ReleaseDetailDialog } from './ReleaseDetailDialog';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Plus, Key, Globe, Container } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { credentialApi, deployApi } from '@/services/api';
|
||||
import { credentialApi, deployApi } from '@/api';
|
||||
|
||||
interface Repo {
|
||||
id: number; name: string; url: string; credential_id: number | null;
|
||||
|
||||
@@ -34,7 +34,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Di
|
||||
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { credentialApi } from '@/services/api';
|
||||
import { credentialApi } from '@/api';
|
||||
|
||||
// ────── Types ──────
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { deployApi } from '@/services/api';
|
||||
import { deployApi } from '@/api';
|
||||
import CredentialFormDialog from './CredentialFormDialog';
|
||||
import ToolConfigTab from './ToolConfigTab';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { toast } from 'sonner';
|
||||
import { deployApi, userApi, pipelineApi } from '@/services/api';
|
||||
import { deployApi, userApi, pipelineApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
|
||||
interface ItemRole {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
Minimize2,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { pipelineApi } from '@/services/api';
|
||||
import { pipelineApi } from '@/api';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
interface FileItem {
|
||||
|
||||
@@ -42,7 +42,7 @@ import { Switch } from '@/components/ui/switch';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { pipelineApi, deployApi } from '@/services/api';
|
||||
import { pipelineApi, deployApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
|
||||
// ---- types ----
|
||||
|
||||
@@ -40,7 +40,7 @@ import {
|
||||
Package,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { credentialApi, deployApi, pipelineApi } from '@/services/api';
|
||||
import { credentialApi, deployApi, pipelineApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { nameToCode, getStatusBadge } from './pipeline-helpers';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { toast } from 'sonner';
|
||||
import { pipelineApi } from '@/services/api';
|
||||
import { pipelineApi } from '@/api';
|
||||
import { FileBrowserDialog } from './FileBrowserDialog';
|
||||
|
||||
// ═══════════ 阶段定义 (与 PipelineManager 共用) ═══════════
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
interface ReleaseApplyDialogProps {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { AlertCircle, X, Check, Loader2 } from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
interface ReleaseApproveDialogProps {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { Plus, Loader2 } from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
interface ReleaseCreateDialogProps {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Rocket, CheckCircle, Loader2, RotateCcw } from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
import { PIPELINE_STEPS } from './releaseHelpers';
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import {
|
||||
Play,
|
||||
PackageOpen,
|
||||
} from 'lucide-react';
|
||||
import { releaseApi } from '@/services/api';
|
||||
import { releaseApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { getStatusBadge, getEnvironmentBadge } from './releaseManagerHelpers';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '@/components/ui/dialog';
|
||||
import { toast } from 'sonner';
|
||||
import { deployApi } from '@/services/api';
|
||||
import { deployApi } from '@/api';
|
||||
|
||||
interface ToolConfig {
|
||||
id: number; name: string; display_name: string; description: string;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/u
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { deployApi } from '@/services/api';
|
||||
import { deployApi } from '@/api';
|
||||
|
||||
interface Group {
|
||||
id: number; name: string; description: string;
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'xterm/css/xterm.css';
|
||||
import { Maximize2, Minimize2, X, FolderOpen } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useUserStore } from '@/store';
|
||||
import { pipelineApi } from '@/services/api';
|
||||
import { pipelineApi } from '@/api';
|
||||
|
||||
interface WorkspaceTermDialogProps {
|
||||
open: boolean;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Table, TableBody, TableCell, TableHead, TableHeader, TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { RefreshCw, ChevronRight, BarChart3, Download, Cpu, HardDrive } from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
export default function CapacityPage() {
|
||||
const { clusterCode } = useParams<{ clusterCode: string }>();
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
TrendingUp,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
const CHART_COLORS = ['#3B82F6', '#207060', '#F59E0B', '#EF4444', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316'];
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
Activity,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
const NAMESPACE_ICON: Record<string, React.ComponentType<any>> = {
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
FolderOpen,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { PodExecTerminal } from './PodExecTerminal';
|
||||
import { PodLogsViewer } from './PodLogsViewer';
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Save, Loader2, Settings, RefreshCw, Shield, Clock, Network,
|
||||
} from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { SchedulingSection, type ScheduleMode } from './deployment-edit-advanced/SchedulingSection';
|
||||
import { DnsHostSection } from './deployment-edit-advanced/DnsHostSection';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Plus, Trash2, Save, Loader2, Tags, FileText, Hash, Lock } from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
interface DeploymentEditBasicProps {
|
||||
clusterCode: string;
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
import { ContainerGroupSection } from './deployment-edit/ContainerGroupSection';
|
||||
import {
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from 'lucide-react';
|
||||
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
interface Props {
|
||||
clusterCode: string;
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Plus, Trash2, Save, Loader2, HardDrive, Database, Folder, Lock, File, Disc, Server,
|
||||
} from 'lucide-react';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
interface Props {
|
||||
clusterCode: string;
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import {
|
||||
formatK8sTime, formatDuration, elapsedSeconds, statusColor, STATUS_COLORS,
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
Database,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { useUserStore } from '@/store';
|
||||
import { YamlViewer } from './YamlViewer';
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Cell,
|
||||
} from 'recharts';
|
||||
import { RefreshCw, ChevronRight, Bell, AlertTriangle, Info, Activity, Server, Layers } from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
// Color palette for charts
|
||||
const CHART_COLORS = ['#EF4444', '#F59E0B', '#3B82F6', '#8B5CF6', '#EC4899', '#14B8A6', '#F97316', '#6366F1', '#84CC16', '#06B6D4'];
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Cloud, XCircle } from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import {
|
||||
AreaChart,
|
||||
Area,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
// 名称即 code,只允许英文/数字/连字符
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
Container,
|
||||
Download,
|
||||
} from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { toast } from 'sonner';
|
||||
import type { KubernetesCluster } from '@/types';
|
||||
import { KubernetesClusterDetail } from './KubernetesClusterDetail';
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Table, TableBody, TableCell, TableHead, TableHeader, TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { RefreshCw, Search, Server, Loader2 } from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
export function KubernetesNodes() {
|
||||
const [clusters, setClusters] = useState<any[]>([]);
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
Eye,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { DeploymentDetail } from './DeploymentDetail';
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
RefreshCw, Loader2, ChevronRight, Plus, Trash2, Boxes, Container, Network,
|
||||
Shield, Activity, AlertTriangle, CheckCircle2,
|
||||
} from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
interface NamespaceDetail {
|
||||
name: string;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
Clock,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
const RESOURCE_LINKS = [
|
||||
{ type: 'deployments', label: 'Deployments', icon: Boxes, desc: '工作负载副本管理' },
|
||||
|
||||
@@ -19,7 +19,7 @@ import { YamlViewer } from './YamlViewer';
|
||||
import { ResourceVisualEditor } from './ResourceVisualEditor';
|
||||
import { PodExecTerminal } from './PodExecTerminal';
|
||||
import { PodFileBrowser } from './PodFileBrowser';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
type ResourceType =
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
CheckCircle2,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
export default function NodeDetailPage() {
|
||||
const { clusterCode, nodeName } = useParams<{ clusterCode: string; nodeName: string }>();
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
Terminal, Maximize2, Minimize2, X, Loader2, RotateCw, Box,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
export interface PodExecTerminalProps {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// PodFileBrowser.tsx — Pod 容器文件浏览器组件
|
||||
// 作者: Logan <admin@attacker.club>
|
||||
import { useState, useEffect, useCallback, useRef } from 'react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import {
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
RefreshCw, Loader2, Box, History, Clock, Filter, AlertCircle,
|
||||
} from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Table, TableBody, TableCell, TableHead, TableHeader, TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { Cpu, HardDrive, RefreshCw, ChevronRight, Activity } from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
|
||||
export default function PodMetricsPage() {
|
||||
const { clusterCode } = useParams<{ clusterCode: string }>();
|
||||
|
||||
@@ -10,7 +10,7 @@ import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
import { oneDark } from '@codemirror/theme-one-dark';
|
||||
|
||||
@@ -15,7 +15,7 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import {
|
||||
Search, RefreshCw, Loader2, Cloud, Save, Plus, Trash2, Link2, Pencil, RotateCcw,
|
||||
} from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { toast } from 'sonner';
|
||||
import type { TopologyNode, TopologyEdge } from '@/types';
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
ArrowLeft, RotateCcw, FileCode, Activity, Container, Terminal,
|
||||
HardDrive, Minus, Plus, Boxes, Tag, Settings, Database,
|
||||
} from 'lucide-react';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { YamlViewer } from './YamlViewer';
|
||||
import { PodExecTerminal } from './PodExecTerminal';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useState, useEffect, useMemo} from 'react';
|
||||
import { X, Copy, Check, Save, Loader2, Sparkles} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { kubernetesApi } from '@/services/api';
|
||||
import { kubernetesApi } from '@/api';
|
||||
import { cleanYAML } from './k8s-yaml-utils';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { yaml } from '@codemirror/lang-yaml';
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useThemeStore, useUserStore } from '@/store';
|
||||
import { Sidebar } from './Sidebar';
|
||||
import { Header } from './Header';
|
||||
import { Breadcrumb } from './Breadcrumb';
|
||||
import { userApi } from '@/services/api';
|
||||
import { userApi } from '@/api';
|
||||
|
||||
/**
|
||||
* MainLayout - 优化后的主布局组件
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Plus, Trash2, Loader2 } from 'lucide-react';
|
||||
import { alertApi } from '@/services/api';
|
||||
import { alertApi } from '@/api';
|
||||
import { CHANNEL_TYPES, getChannelTypeLabel } from './alertShared';
|
||||
|
||||
const defaultChannelForm = { name: '', type: 'dingtalk', config: '', enabled: true };
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { Search, AlertTriangle, Bell, CheckCircle, Loader2 } from 'lucide-react';
|
||||
import { alertApi } from '@/services/api';
|
||||
import { alertApi } from '@/api';
|
||||
|
||||
export function AlertEventsTab({
|
||||
alerts,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
CartesianGrid,
|
||||
Tooltip,
|
||||
} from 'recharts';
|
||||
import { alertApi } from '@/services/api';
|
||||
import { alertApi } from '@/api';
|
||||
import { AlertEventsTab } from './AlertEventsTab';
|
||||
import { AlertRulesTab } from './AlertRulesTab';
|
||||
import { AlertRuleDialog } from './AlertRuleDialog';
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { alertApi } from '@/services/api';
|
||||
import { alertApi } from '@/api';
|
||||
import { parseChannels, getChannelIcon, getChannelTypeLabel } from './alertShared';
|
||||
|
||||
const emptyRuleForm = {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
} from '@/components/ui/table';
|
||||
import { Settings, Trash2 } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { alertApi } from '@/services/api';
|
||||
import { alertApi } from '@/api';
|
||||
import { renderRuleChannels } from './alertShared';
|
||||
|
||||
const COL_SPAN = 9; // 复选框 + 7 数据列 + 操作列 // Logan.Li
|
||||
|
||||
@@ -16,7 +16,7 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { toast } from 'sonner';
|
||||
import { useConfirm } from '@/components/ui/confirm-dialog';
|
||||
import { alertCenterApi, agentApi, alertApi } from '@/services/api';
|
||||
import { alertCenterApi, agentApi, alertApi } from '@/api';
|
||||
import {
|
||||
type Alert, type AlertRule, mapAlert, getSeverityBadge, getStatusBadge,
|
||||
getChannelTypeLabel,
|
||||
|
||||
Loaded 100 of 145 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user