1
This commit is contained in:
parent
f6e19d7c24
commit
2bc93a5744
@ -28,11 +28,13 @@
|
|||||||
"@logicflow/extension": "^2.0.13",
|
"@logicflow/extension": "^2.0.13",
|
||||||
"@monaco-editor/react": "^4.6.0",
|
"@monaco-editor/react": "^4.6.0",
|
||||||
"@radix-ui/react-avatar": "^1.1.2",
|
"@radix-ui/react-avatar": "^1.1.2",
|
||||||
|
"@radix-ui/react-dialog": "^1.1.4",
|
||||||
"@radix-ui/react-label": "^2.1.1",
|
"@radix-ui/react-label": "^2.1.1",
|
||||||
"@radix-ui/react-progress": "^1.1.1",
|
"@radix-ui/react-progress": "^1.1.1",
|
||||||
"@radix-ui/react-select": "^2.1.4",
|
"@radix-ui/react-select": "^2.1.4",
|
||||||
"@radix-ui/react-separator": "^1.1.1",
|
"@radix-ui/react-separator": "^1.1.1",
|
||||||
"@radix-ui/react-slot": "^1.1.1",
|
"@radix-ui/react-slot": "^1.1.1",
|
||||||
|
"@radix-ui/react-switch": "^1.1.2",
|
||||||
"@radix-ui/react-tabs": "^1.1.2",
|
"@radix-ui/react-tabs": "^1.1.2",
|
||||||
"@reduxjs/toolkit": "^2.0.1",
|
"@reduxjs/toolkit": "^2.0.1",
|
||||||
"@types/recharts": "^1.8.29",
|
"@types/recharts": "^1.8.29",
|
||||||
|
|||||||
@ -62,6 +62,9 @@ importers:
|
|||||||
'@radix-ui/react-avatar':
|
'@radix-ui/react-avatar':
|
||||||
specifier: ^1.1.2
|
specifier: ^1.1.2
|
||||||
version: 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-dialog':
|
||||||
|
specifier: ^1.1.4
|
||||||
|
version: 1.1.4(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@radix-ui/react-label':
|
'@radix-ui/react-label':
|
||||||
specifier: ^2.1.1
|
specifier: ^2.1.1
|
||||||
version: 2.1.1(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 2.1.1(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@ -77,6 +80,9 @@ importers:
|
|||||||
'@radix-ui/react-slot':
|
'@radix-ui/react-slot':
|
||||||
specifier: ^1.1.1
|
specifier: ^1.1.1
|
||||||
version: 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
version: 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-switch':
|
||||||
|
specifier: ^1.1.2
|
||||||
|
version: 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@radix-ui/react-tabs':
|
'@radix-ui/react-tabs':
|
||||||
specifier: ^1.1.2
|
specifier: ^1.1.2
|
||||||
version: 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@ -877,6 +883,19 @@ packages:
|
|||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@radix-ui/react-dialog@1.1.4':
|
||||||
|
resolution: {integrity: sha512-Ur7EV1IwQGCyaAuyDRiOLA5JIUZxELJljF+MbM/2NC0BYwfuRrbpS30BiQBJrVruscgUkieKkqXYDOoByaxIoA==}
|
||||||
|
peerDependencies:
|
||||||
|
'@types/react': '*'
|
||||||
|
'@types/react-dom': '*'
|
||||||
|
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@types/react':
|
||||||
|
optional: true
|
||||||
|
'@types/react-dom':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@radix-ui/react-direction@1.1.0':
|
'@radix-ui/react-direction@1.1.0':
|
||||||
resolution: {integrity: sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==}
|
resolution: {integrity: sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -1056,6 +1075,19 @@ packages:
|
|||||||
'@types/react':
|
'@types/react':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
'@radix-ui/react-switch@1.1.2':
|
||||||
|
resolution: {integrity: sha512-zGukiWHjEdBCRyXvKR6iXAQG6qXm2esuAD6kDOi9Cn+1X6ev3ASo4+CsYaD6Fov9r/AQFekqnD/7+V0Cs6/98g==}
|
||||||
|
peerDependencies:
|
||||||
|
'@types/react': '*'
|
||||||
|
'@types/react-dom': '*'
|
||||||
|
react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc
|
||||||
|
peerDependenciesMeta:
|
||||||
|
'@types/react':
|
||||||
|
optional: true
|
||||||
|
'@types/react-dom':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@radix-ui/react-tabs@1.1.2':
|
'@radix-ui/react-tabs@1.1.2':
|
||||||
resolution: {integrity: sha512-9u/tQJMcC2aGq7KXpGivMm1mgq7oRJKXphDwdypPd/j21j/2znamPU8WkXgnhUaTrSFNIt8XhOyCAupg8/GbwQ==}
|
resolution: {integrity: sha512-9u/tQJMcC2aGq7KXpGivMm1mgq7oRJKXphDwdypPd/j21j/2znamPU8WkXgnhUaTrSFNIt8XhOyCAupg8/GbwQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -4288,6 +4320,28 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 18.3.16
|
'@types/react': 18.3.16
|
||||||
|
|
||||||
|
'@radix-ui/react-dialog@1.1.4(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
||||||
|
dependencies:
|
||||||
|
'@radix-ui/primitive': 1.1.1
|
||||||
|
'@radix-ui/react-compose-refs': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-context': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-dismissable-layer': 1.1.3(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-focus-guards': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-focus-scope': 1.1.1(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-id': 1.1.0(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-portal': 1.1.3(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-presence': 1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-primitive': 2.0.1(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-slot': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
aria-hidden: 1.2.4
|
||||||
|
react: 18.3.1
|
||||||
|
react-dom: 18.3.1(react@18.3.1)
|
||||||
|
react-remove-scroll: 2.6.2(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
optionalDependencies:
|
||||||
|
'@types/react': 18.3.16
|
||||||
|
'@types/react-dom': 18.3.5(@types/react@18.3.16)
|
||||||
|
|
||||||
'@radix-ui/react-direction@1.1.0(@types/react@18.3.16)(react@18.3.1)':
|
'@radix-ui/react-direction@1.1.0(@types/react@18.3.16)(react@18.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
@ -4459,6 +4513,21 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/react': 18.3.16
|
'@types/react': 18.3.16
|
||||||
|
|
||||||
|
'@radix-ui/react-switch@1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
||||||
|
dependencies:
|
||||||
|
'@radix-ui/primitive': 1.1.1
|
||||||
|
'@radix-ui/react-compose-refs': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-context': 1.1.1(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-primitive': 2.0.1(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-controllable-state': 1.1.0(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-previous': 1.1.0(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
'@radix-ui/react-use-size': 1.1.0(@types/react@18.3.16)(react@18.3.1)
|
||||||
|
react: 18.3.1
|
||||||
|
react-dom: 18.3.1(react@18.3.1)
|
||||||
|
optionalDependencies:
|
||||||
|
'@types/react': 18.3.16
|
||||||
|
'@types/react-dom': 18.3.5(@types/react@18.3.16)
|
||||||
|
|
||||||
'@radix-ui/react-tabs@1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
'@radix-ui/react-tabs@1.1.2(@types/react-dom@18.3.5(@types/react@18.3.16))(@types/react@18.3.16)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@radix-ui/primitive': 1.1.1
|
'@radix-ui/primitive': 1.1.1
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, {useState, useEffect} from 'react';
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import {Badge} from "@/components/ui/badge";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import {Progress} from "@/components/ui/progress";
|
||||||
import { Button } from "@/components/ui/button";
|
import {Button} from "@/components/ui/button";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
|
||||||
import { Input } from "@/components/ui/input";
|
import {Input} from "@/components/ui/input";
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
SelectContent,
|
SelectContent,
|
||||||
@ -12,11 +12,12 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { cn } from "@/lib/utils";
|
import {cn} from "@/lib/utils";
|
||||||
import {
|
import {
|
||||||
Clock,
|
Clock,
|
||||||
Search,
|
Search,
|
||||||
Edit,
|
Edit,
|
||||||
|
Package,
|
||||||
ChevronRight,
|
ChevronRight,
|
||||||
CheckCircle,
|
CheckCircle,
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
@ -25,13 +26,15 @@ import {
|
|||||||
ServerCrash,
|
ServerCrash,
|
||||||
Server
|
Server
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { getEnvironmentList } from '@/pages/Deploy/Environment/List/service';
|
import {getEnvironmentList} from '@/pages/Deploy/Environment/List/service';
|
||||||
import { getDevelopmentLanguages } from '@/pages/Deploy/Application/List/service';
|
import {getDevelopmentLanguages} from '@/pages/Deploy/Application/List/service';
|
||||||
import { getDeploymentConfigPage } from '@/pages/Deploy/Deployment/List/service';
|
import {getDeploymentConfigPage} from '@/pages/Deploy/Deployment/List/service';
|
||||||
import type { Environment } from '@/pages/Deploy/Environment/List/types';
|
import type {Environment} from '@/pages/Deploy/Environment/List/types';
|
||||||
import type { DevelopmentLanguageType } from '@/pages/Deploy/Application/List/types';
|
import type {DevelopmentLanguageType} from '@/pages/Deploy/Application/List/types';
|
||||||
import type { DeploymentConfig, DeploymentConfigQueryParams } from '@/pages/Deploy/Deployment/List/types';
|
import type {DeploymentConfig} from '@/pages/Deploy/Deployment/List/types';
|
||||||
import type { Page } from '@/types/base';
|
import type {Page} from '@/types/base';
|
||||||
|
import type { JsonNode } from '@/types/common';
|
||||||
|
import DeploymentFormModal from './components/DeploymentFormModal';
|
||||||
|
|
||||||
type EnvironmentStatus = 'success' | 'warning' | 'error';
|
type EnvironmentStatus = 'success' | 'warning' | 'error';
|
||||||
|
|
||||||
@ -49,7 +52,7 @@ const EmptyState: React.FC<{ title: string; description: string; icon: React.Rea
|
|||||||
title,
|
title,
|
||||||
description,
|
description,
|
||||||
icon
|
icon
|
||||||
}) => (
|
}) => (
|
||||||
<div className="flex flex-col items-center justify-center p-8 text-center">
|
<div className="flex flex-col items-center justify-center p-8 text-center">
|
||||||
<div className="rounded-full bg-muted p-3 mb-4">
|
<div className="rounded-full bg-muted p-3 mb-4">
|
||||||
{icon}
|
{icon}
|
||||||
@ -62,14 +65,14 @@ const EmptyState: React.FC<{ title: string; description: string; icon: React.Rea
|
|||||||
const LoadingState = () => (
|
const LoadingState = () => (
|
||||||
<div className="flex-1 p-8">
|
<div className="flex-1 p-8">
|
||||||
<div className="flex flex-col items-center justify-center min-h-[400px]">
|
<div className="flex flex-col items-center justify-center min-h-[400px]">
|
||||||
<Loader2 className="h-8 w-8 animate-spin text-primary mb-4" />
|
<Loader2 className="h-8 w-8 animate-spin text-primary mb-4"/>
|
||||||
<p className="text-sm text-muted-foreground">加载中,请稍候...</p>
|
<p className="text-sm text-muted-foreground">加载中,请稍候...</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const Dashboard: React.FC = () => {
|
const Dashboard: React.FC = () => {
|
||||||
const [projectType, setProjectType] = useState("");
|
const [projectType, setProjectType] = useState("ALL");
|
||||||
const [status, setStatus] = useState("");
|
const [status, setStatus] = useState("");
|
||||||
const [environments, setEnvironments] = useState<EnhancedEnvironment[]>([]);
|
const [environments, setEnvironments] = useState<EnhancedEnvironment[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
@ -77,6 +80,8 @@ const Dashboard: React.FC = () => {
|
|||||||
const [deployConfigs, setDeployConfigs] = useState<DeploymentConfig[]>([]);
|
const [deployConfigs, setDeployConfigs] = useState<DeploymentConfig[]>([]);
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
const [currentEnvId, setCurrentEnvId] = useState<number>();
|
const [currentEnvId, setCurrentEnvId] = useState<number>();
|
||||||
|
const [deployModalOpen, setDeployModalOpen] = useState(false);
|
||||||
|
const [selectedConfig, setSelectedConfig] = useState<DeploymentConfig | null>(null);
|
||||||
|
|
||||||
// 获取环境和语言数据
|
// 获取环境和语言数据
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -126,14 +131,13 @@ const Dashboard: React.FC = () => {
|
|||||||
if (!currentEnvId) return;
|
if (!currentEnvId) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const queryParams: DeploymentConfigQueryParams = {
|
const response = await getDeploymentConfigPage({
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
environmentId: currentEnvId,
|
environmentId: currentEnvId,
|
||||||
workflowDefinitionId: 0
|
workflowDefinitionId: 0,
|
||||||
};
|
enabled: undefined
|
||||||
|
});
|
||||||
const response = await getDeploymentConfigPage(queryParams);
|
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
setDeployConfigs(response.content);
|
setDeployConfigs(response.content);
|
||||||
@ -141,7 +145,7 @@ const Dashboard: React.FC = () => {
|
|||||||
setEnvironments(prevEnvs =>
|
setEnvironments(prevEnvs =>
|
||||||
prevEnvs.map(env =>
|
prevEnvs.map(env =>
|
||||||
env.id === currentEnvId
|
env.id === currentEnvId
|
||||||
? { ...env, projectCount: response.totalElements }
|
? {...env, projectCount: response.totalElements}
|
||||||
: env
|
: env
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -158,25 +162,22 @@ const Dashboard: React.FC = () => {
|
|||||||
if (!currentEnvId) return;
|
if (!currentEnvId) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const queryParams: DeploymentConfigQueryParams = {
|
const params: any = {
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
environmentId: currentEnvId,
|
environmentId: currentEnvId,
|
||||||
workflowDefinitionId: 0,
|
|
||||||
enabled: status === 'active' ? true : status === 'paused' ? false : undefined
|
enabled: status === 'active' ? true : status === 'paused' ? false : undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await getDeploymentConfigPage(queryParams);
|
// 如果选择了具体语言(不是"所有"),添加到查询参数
|
||||||
|
if (projectType !== 'ALL') {
|
||||||
|
params.languageType = projectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await getDeploymentConfigPage(params);
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
// 在前端过滤开发语言
|
setDeployConfigs(response.content);
|
||||||
const filteredConfigs = response.content.filter(config => {
|
|
||||||
if (projectType && config.languageType !== projectType) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
setDeployConfigs(filteredConfigs);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to search deployment configs:', error);
|
console.error('Failed to search deployment configs:', error);
|
||||||
@ -185,17 +186,16 @@ const Dashboard: React.FC = () => {
|
|||||||
|
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
setSearchText("");
|
setSearchText("");
|
||||||
setProjectType("");
|
setProjectType("ALL");
|
||||||
setStatus("");
|
setStatus("");
|
||||||
if (currentEnvId) {
|
if (currentEnvId) {
|
||||||
const queryParams: DeploymentConfigQueryParams = {
|
getDeploymentConfigPage({
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
environmentId: currentEnvId,
|
environmentId: currentEnvId,
|
||||||
workflowDefinitionId: 0
|
workflowDefinitionId: 0,
|
||||||
};
|
enabled: undefined
|
||||||
|
}).then(response => {
|
||||||
getDeploymentConfigPage(queryParams).then(response => {
|
|
||||||
if (response) {
|
if (response) {
|
||||||
setDeployConfigs(response.content);
|
setDeployConfigs(response.content);
|
||||||
}
|
}
|
||||||
@ -213,20 +213,20 @@ const Dashboard: React.FC = () => {
|
|||||||
const getStatusIcon = (status: string) => {
|
const getStatusIcon = (status: string) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'success':
|
case 'success':
|
||||||
return <CheckCircle className="h-5 w-5 text-green-500" />;
|
return <CheckCircle className="h-5 w-5 text-green-500"/>;
|
||||||
case 'warning':
|
case 'warning':
|
||||||
return <AlertTriangle className="h-5 w-5 text-yellow-500" />;
|
return <AlertTriangle className="h-5 w-5 text-yellow-500"/>;
|
||||||
case 'error':
|
case 'error':
|
||||||
return <XCircle className="h-5 w-5 text-red-500" />;
|
return <XCircle className="h-5 w-5 text-red-500"/>;
|
||||||
default:
|
default:
|
||||||
return <Clock className="h-5 w-5 text-blue-500" />;
|
return <Clock className="h-5 w-5 text-blue-500"/>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getBuildStatusBadge = (enabled: boolean) => {
|
const getBuildStatusBadge = (enabled: boolean) => {
|
||||||
const config = enabled
|
const config = enabled
|
||||||
? { className: "bg-green-100 text-green-800", text: "活跃" }
|
? {className: "bg-green-100 text-green-800", text: "活跃"}
|
||||||
: { className: "bg-red-100 text-red-800", text: "暂停" };
|
: {className: "bg-red-100 text-red-800", text: "暂停"};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge className={cn("rounded-full", config.className)}>
|
<Badge className={cn("rounded-full", config.className)}>
|
||||||
@ -235,8 +235,16 @@ const Dashboard: React.FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDeploy = (config: DeploymentConfig) => {
|
||||||
|
console.log('Deploy config:', config);
|
||||||
|
console.log('Workflow definition:', config.publishedWorkflowDefinition);
|
||||||
|
console.log('Form variables:', config.publishedWorkflowDefinition?.formVariables);
|
||||||
|
setSelectedConfig(config);
|
||||||
|
setDeployModalOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return <LoadingState />;
|
return <LoadingState/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasEnvironments = environments.length > 0;
|
const hasEnvironments = environments.length > 0;
|
||||||
@ -250,7 +258,7 @@ const Dashboard: React.FC = () => {
|
|||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<EmptyState
|
<EmptyState
|
||||||
icon={<ServerCrash className="h-8 w-8 text-muted-foreground" />}
|
icon={<ServerCrash className="h-8 w-8 text-muted-foreground"/>}
|
||||||
title="暂无环境数据"
|
title="暂无环境数据"
|
||||||
description="当前系统中还没有配置任何环境。请先添加部署环境,然后开始使用部署功能。"
|
description="当前系统中还没有配置任何环境。请先添加部署环境,然后开始使用部署功能。"
|
||||||
/>
|
/>
|
||||||
@ -270,7 +278,7 @@ const Dashboard: React.FC = () => {
|
|||||||
<p className="text-xs text-muted-foreground">个项目</p>
|
<p className="text-xs text-muted-foreground">个项目</p>
|
||||||
<div className="mt-4 space-y-2">
|
<div className="mt-4 space-y-2">
|
||||||
<div className="flex items-center text-sm">
|
<div className="flex items-center text-sm">
|
||||||
<Clock className="mr-2 h-4 w-4 text-muted-foreground" />
|
<Clock className="mr-2 h-4 w-4 text-muted-foreground"/>
|
||||||
最近部署: {env.lastDeployment}
|
最近部署: {env.lastDeployment}
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
@ -278,21 +286,21 @@ const Dashboard: React.FC = () => {
|
|||||||
<span>CPU</span>
|
<span>CPU</span>
|
||||||
<span>{env.cpu}%</span>
|
<span>{env.cpu}%</span>
|
||||||
</div>
|
</div>
|
||||||
<Progress value={env.cpu} className="h-1" />
|
<Progress value={env.cpu} className="h-1"/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex justify-between text-xs">
|
<div className="flex justify-between text-xs">
|
||||||
<span>内存</span>
|
<span>内存</span>
|
||||||
<span>{env.memory}%</span>
|
<span>{env.memory}%</span>
|
||||||
</div>
|
</div>
|
||||||
<Progress value={env.memory} className="h-1" />
|
<Progress value={env.memory} className="h-1"/>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<div className="flex justify-between text-xs">
|
<div className="flex justify-between text-xs">
|
||||||
<span>存储</span>
|
<span>存储</span>
|
||||||
<span>{env.storage}%</span>
|
<span>{env.storage}%</span>
|
||||||
</div>
|
</div>
|
||||||
<Progress value={env.storage} className="h-1" />
|
<Progress value={env.storage} className="h-1"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
@ -331,9 +339,10 @@ const Dashboard: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
<Select value={projectType} onValueChange={setProjectType}>
|
<Select value={projectType} onValueChange={setProjectType}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="开发语言" />
|
<SelectValue placeholder="开发语言"/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
<SelectItem value="ALL">所有</SelectItem>
|
||||||
{languages.map(lang => (
|
{languages.map(lang => (
|
||||||
<SelectItem key={lang.code} value={lang.code}>
|
<SelectItem key={lang.code} value={lang.code}>
|
||||||
{lang.name}
|
{lang.name}
|
||||||
@ -343,7 +352,7 @@ const Dashboard: React.FC = () => {
|
|||||||
</Select>
|
</Select>
|
||||||
<Select value={status} onValueChange={setStatus}>
|
<Select value={status} onValueChange={setStatus}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="项目状态" />
|
<SelectValue placeholder="项目状态"/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="active">活跃</SelectItem>
|
<SelectItem value="active">活跃</SelectItem>
|
||||||
@ -352,7 +361,7 @@ const Dashboard: React.FC = () => {
|
|||||||
</Select>
|
</Select>
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
<Button className="flex-1" onClick={handleSearch}>
|
<Button className="flex-1" onClick={handleSearch}>
|
||||||
<Search className="w-4 h-4 mr-2" />
|
<Search className="w-4 h-4 mr-2"/>
|
||||||
搜索
|
搜索
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outline" className="flex-1" onClick={handleReset}>
|
<Button variant="outline" className="flex-1" onClick={handleReset}>
|
||||||
@ -366,7 +375,7 @@ const Dashboard: React.FC = () => {
|
|||||||
<Card>
|
<Card>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<EmptyState
|
<EmptyState
|
||||||
icon={<Server className="h-8 w-8 text-muted-foreground" />}
|
icon={<Server className="h-8 w-8 text-muted-foreground"/>}
|
||||||
title="暂无项目数据"
|
title="暂无项目数据"
|
||||||
description="当前环境中还没有配置任何项目。请先创建项目,然后开始部署。"
|
description="当前环境中还没有配置任何项目。请先创建项目,然后开始部署。"
|
||||||
/>
|
/>
|
||||||
@ -403,12 +412,12 @@ const Dashboard: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end space-x-2">
|
<div className="flex justify-end space-x-2">
|
||||||
<Button variant="outline" size="sm">
|
<Button variant="outline" size="sm" onClick={() => handleDeploy(config)}>
|
||||||
<Edit className="h-4 w-4 mr-1" />
|
<Package className="h-4 w-4 mr-1"/>
|
||||||
编辑
|
部署
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outline" size="sm">
|
<Button variant="outline" size="sm">
|
||||||
<ChevronRight className="h-4 w-4" />
|
<ChevronRight className="h-4 w-4"/>
|
||||||
详情
|
详情
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -423,6 +432,21 @@ const Dashboard: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{selectedConfig && selectedConfig.publishedWorkflowDefinition && (
|
||||||
|
<>
|
||||||
|
{console.log('Selected config:', selectedConfig)}
|
||||||
|
{console.log('Workflow definition:', selectedConfig.publishedWorkflowDefinition)}
|
||||||
|
{console.log('Form variables:', selectedConfig.publishedWorkflowDefinition.formVariables)}
|
||||||
|
<DeploymentFormModal
|
||||||
|
open={deployModalOpen}
|
||||||
|
onClose={() => {
|
||||||
|
setDeployModalOpen(false);
|
||||||
|
setSelectedConfig(null);
|
||||||
|
}}
|
||||||
|
formSchema={selectedConfig.publishedWorkflowDefinition.formVariables}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user