diff --git a/apps/web/src/components/business/QuotaDisplay.tsx b/apps/web/src/components/business/QuotaDisplay.tsx index 0c1a2bb3b..ca44d67f1 100644 --- a/apps/web/src/components/business/QuotaDisplay.tsx +++ b/apps/web/src/components/business/QuotaDisplay.tsx @@ -4,7 +4,18 @@ import React from 'react'; import { Card, Progress, Row, Col, Tag, Space } from 'antd'; import { ProjectOutlined, CloudOutlined, WarningOutlined } from '@ant-design/icons'; -import type { QuotaStatus } from '@/api/subscription'; +interface QuotaStatus { + projects: { + used: number; + limit: number; + status: string; + }; + storage: { + used_gb: number; + limit_gb: number; + status: string; + }; +} interface QuotaDisplayProps { quota: QuotaStatus; diff --git a/apps/web/src/pages/subscription/UpgradeSubscription.tsx b/apps/web/src/pages/subscription/UpgradeSubscription.tsx index 06aaed24e..d784866aa 100644 --- a/apps/web/src/pages/subscription/UpgradeSubscription.tsx +++ b/apps/web/src/pages/subscription/UpgradeSubscription.tsx @@ -1,140 +1,30 @@ -/** - * 订阅升级流程页面 - */ -import React, { useState } from 'react'; -import { useParams, useNavigate } from 'react-router-dom'; -import { Card, Steps, Button, Result, Descriptions, message } from 'antd'; -import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { upgradeSubscription } from '@/api/subscription'; +import React from 'react'; +import { Button, Card, Result } from 'antd'; +import { useNavigate, useParams } from 'react-router-dom'; const UpgradeSubscription: React.FC = () => { const { workspaceId } = useParams<{ workspaceId: string }>(); const navigate = useNavigate(); - const queryClient = useQueryClient(); - const [current, setCurrent] = useState(0); - const [selectedPlan, setSelectedPlan] = useState<'pro' | 'enterprise'>('pro'); - - const upgradeMutation = useMutation({ - mutationFn: () => upgradeSubscription(workspaceId!, selectedPlan), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['workspace', workspaceId] }); - setCurrent(2); - message.success('订阅升级成功!'); - }, - onError: (error: any) => { - message.error(error.response?.data?.message || '升级失败'); - }, - }); - - const steps = [ - { - title: '选择套餐', - content: ( -
- setSelectedPlan('pro')} - className={selectedPlan === 'pro' ? 'selected-plan' : ''} - > -

Pro 套餐

-

¥99/月

- -
- setSelectedPlan('enterprise')} - className={selectedPlan === 'enterprise' ? 'selected-plan' : ''} - > -

Enterprise 套餐

-

¥999/月

- -
-
- ), - }, - { - title: '确认订单', - content: ( - - - - {selectedPlan === 'pro' ? 'Pro' : 'Enterprise'} - - - {selectedPlan === 'pro' ? '¥99' : '¥999'} / 月 - - - 在线支付(待接入) - - - - ), - }, - { - title: '完成', - content: ( - navigate(`/workspaces/${workspaceId}`)} - > - 返回工作空间 - , - ]} - /> - ), - }, - ]; - - const next = () => { - if (current === 0) { - setCurrent(current + 1); - } else if (current === 1) { - upgradeMutation.mutate(); - } - }; - - const prev = () => { - setCurrent(current - 1); - }; return (
-

升级订阅

- -
{steps[current].content}
-
- {current < steps.length - 1 && ( - <> - {current > 0 && ( - , + workspaceId ? ( + - )} - - - )} -
+ ) : null, + ]} + /> +
); }; diff --git a/tests/unit/test_release_scripts.py b/tests/unit/test_release_scripts.py index 1774813a5..f2bf950e0 100644 --- a/tests/unit/test_release_scripts.py +++ b/tests/unit/test_release_scripts.py @@ -121,6 +121,19 @@ def test_web_dockerfile_uses_reachable_base_image_mirror(): assert "FROM nginx:alpine" not in dockerfile +def test_subscription_api_is_not_wired_to_ui_until_backend_exists(): + source_files = list(Path("apps/web/src").rglob("*.ts")) + list(Path("apps/web/src").rglob("*.tsx")) + importers = [] + for path in source_files: + if path.as_posix().endswith("apps/web/src/api/subscription.ts"): + continue + text = path.read_text(encoding="utf-8") + if "@/api/subscription" in text or "../api/subscription" in text: + importers.append(path.as_posix()) + + assert importers == [] + + def test_backup_postgres_writes_manifest_and_version(): script = Path("scripts/backup_postgres.sh").read_text(encoding="utf-8")