Skip to content

Commit f50cac9

Browse files
committed
merge PR #7 (DevilGenius:dev) and resolve local conflicts
- Merge feat(accounts) table styling and backend test additions - Keep PR version for AccountsPage grid layout conflicts - Include local Makefile changes for kiro plugin support
1 parent 81024ab commit f50cac9

2 files changed

Lines changed: 36 additions & 17 deletions

File tree

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ PLAYGROUND_DIR := ../airgate-playground
1313
PLAYGROUND_PLUGIN := $(PLAYGROUND_DIR)/web
1414
EPAY_PLUGIN := ../airgate-epay/web
1515
HEALTH_PLUGIN := ../airgate-health/web
16+
KIRO_PLUGIN := ../airgate-kiro/web
1617
# build-plugins 阶段(生产)同步各插件的 admin dist/index.js 到
1718
# core 的 plugin assets dir;health 的公开状态页仍走 /status 反代,不经过这套 assets。
1819
OPENAI_ASSETS := $(BACKEND_DIR)/data/plugins/gateway-openai/assets
1920
CLAUDE_ASSETS := $(BACKEND_DIR)/data/plugins/gateway-anthropic/assets
2021
PLAYGROUND_ASSETS := $(BACKEND_DIR)/data/plugins/airgate-playground/assets
2122
EPAY_ASSETS := $(BACKEND_DIR)/data/plugins/payment-epay/assets
2223
HEALTH_ASSETS := $(BACKEND_DIR)/data/plugins/airgate-health/assets
24+
KIRO_ASSETS := $(BACKEND_DIR)/data/plugins/gateway-kiro/assets
2325
BINARY := $(BACKEND_DIR)/server
2426
WEBDIST := $(BACKEND_DIR)/internal/web/webdist
2527
GO := GOTOOLCHAIN=local go
@@ -28,7 +30,7 @@ GO := GOTOOLCHAIN=local go
2830
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
2931
LDFLAGS := -X github.com/DouDOU-start/airgate-core/internal/version.Version=$(VERSION)
3032

31-
.PHONY: help dev dev-backend dev-frontend dev-sdk dev-plugins dev-plugin-openai dev-plugin-claude dev-plugin-playground dev-plugin-epay dev-plugin-health \
33+
.PHONY: help dev dev-backend dev-frontend dev-sdk dev-plugins dev-plugin-openai dev-plugin-claude dev-plugin-playground dev-plugin-epay dev-plugin-health dev-plugin-kiro \
3234
build build-backend build-frontend \
3335
build-plugins sync-plugins \
3436
ent lint fmt test clean install ci pre-commit setup-hooks \
@@ -58,11 +60,13 @@ dev-plugins: ## 启动所有插件前端 watch 模式
5860
@echo " - playground → ../airgate-playground/web/dist/"
5961
@echo " - epay → ../airgate-epay/web/dist/"
6062
@echo " - health → ../airgate-health/web/dist/ (含 admin index.js + standalone status page)"
63+
@echo " - kiro → ../airgate-kiro/web/dist/"
6164
@$(MAKE) dev-plugin-openai &
6265
@$(MAKE) dev-plugin-claude &
6366
@$(MAKE) dev-plugin-playground &
6467
@$(MAKE) dev-plugin-epay &
6568
@$(MAKE) dev-plugin-health &
69+
@$(MAKE) dev-plugin-kiro &
6670
@wait
6771

6872
dev-plugin-openai: ## 单独 watch openai 插件前端(输出到 ../airgate-openai/web/dist)
@@ -100,6 +104,13 @@ dev-plugin-health: ## 单独 watch health 插件前端(同时 watch admin inde
100104
echo "跳过 health 插件前端 watch:$(HEALTH_PLUGIN) 不存在"; \
101105
fi
102106

107+
dev-plugin-kiro: ## 单独 watch kiro 插件前端(输出到 ../airgate-kiro/web/dist)
108+
@if [ -d $(KIRO_PLUGIN) ]; then \
109+
cd $(KIRO_PLUGIN) && npx vite build --watch; \
110+
else \
111+
echo "跳过 kiro 插件前端 watch:$(KIRO_PLUGIN) 不存在"; \
112+
fi
113+
103114
dev-backend: ## 启动后端(带热重载,需要 air)
104115
@cd $(BACKEND_DIR) && \
105116
if command -v air > /dev/null 2>&1; then \
@@ -186,6 +197,15 @@ sync-plugins: ## 构建插件前端并同步 admin 资源到 data/plugins/
186197
else \
187198
echo "跳过 health 插件前端构建:$(HEALTH_PLUGIN) 不存在"; \
188199
fi
200+
@if [ -d $(KIRO_PLUGIN) ]; then \
201+
echo "构建并同步 kiro 插件前端..."; \
202+
(cd $(KIRO_PLUGIN) && npm run build); \
203+
mkdir -p $(KIRO_ASSETS); \
204+
cp $(KIRO_PLUGIN)/dist/index.js $(KIRO_ASSETS)/index.js; \
205+
echo "kiro 插件前端已同步到 $(KIRO_ASSETS)/"; \
206+
else \
207+
echo "跳过 kiro 插件前端构建:$(KIRO_PLUGIN) 不存在"; \
208+
fi
189209

190210
# ===================== 代码生成 =====================
191211

web/src/pages/admin/AccountsPage.tsx

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ export default function AccountsPage() {
859859
...[{
860860
key: 'usage_window',
861861
title: t('accounts.usage_window'),
862-
width: '560px',
862+
width: '240px',
863863
align: 'center' as const,
864864
hideOnMobile: true,
865865
render: (row: AccountResp) => {
@@ -1024,13 +1024,13 @@ export default function AccountsPage() {
10241024
</span>
10251025
)
10261026
: formatCompact(todayStats?.requests ?? 0, false);
1027-
const todayMetricClass = 'inline-grid h-5 min-w-0 grid-cols-[3.5rem_minmax(0,1fr)] items-center gap-1 rounded-[var(--field-radius)] border px-1.5 text-[11px] leading-none shadow-sm';
1027+
const todayMetricClass = 'inline-grid h-5 min-w-0 grid-cols-[2.5rem_minmax(0,1fr)] items-center gap-0.5 rounded-[var(--field-radius)] border px-1 text-[11px] leading-none shadow-sm';
10281028
const todayMetricStyle = (color: string, foreground = color) => ({
10291029
background: `color-mix(in srgb, ${color} 10%, transparent)`,
10301030
borderColor: `color-mix(in srgb, ${color} 22%, var(--ag-border))`,
10311031
color: foreground,
10321032
});
1033-
const todayMetricColumnClass = 'grid w-[18rem] justify-self-end grid-cols-2 gap-1';
1033+
const todayMetricColumnClass = 'grid w-full grid-cols-2 gap-0.5';
10341034
const todayMetricChips = hasTodayStats && todayStats ? (
10351035
<div
10361036
className={todayMetricColumnClass}
@@ -1084,30 +1084,30 @@ export default function AccountsPage() {
10841084
title={canRefresh ? t('accounts.refresh_usage', '点击刷新用量') : undefined}
10851085
onClick={canRefresh ? handleRefreshClick : undefined}
10861086
>
1087-
<div className="grid w-full grid-cols-[minmax(0,1fr)_1rem_18rem] items-start justify-center gap-0">
1087+
<div className="flex w-full flex-col gap-2">
10881088
<div className="flex min-w-0 flex-col gap-1">
10891089
{windowRows.map((item) => {
10901090
const w = item.window;
10911091
if (!w) {
10921092
return <div key={item.id} className="h-5" aria-hidden="true" />;
10931093
}
10941094
return (
1095-
<div key={item.id} className="grid h-5 grid-cols-[2.5rem_minmax(7rem,1fr)_2.25rem_3rem] items-center gap-1.5">
1096-
<span className="inline-flex min-w-0 items-center justify-center truncate rounded px-1 py-0 text-[11px] font-semibold text-text-secondary leading-none" style={badgeStyle} title={w.label}>
1097-
{shortLabel(w.label)}
1098-
</span>
1095+
<div key={item.id} className="flex min-w-0 flex-col gap-1">
1096+
<div className="flex items-baseline justify-between">
1097+
<span className="inline-flex min-w-0 items-center truncate rounded px-1 py-0 text-[11px] font-semibold text-text-secondary leading-none" style={badgeStyle} title={w.label}>
1098+
{shortLabel(w.label)}
1099+
</span>
1100+
<span className="flex items-center gap-1.5 text-[11px] font-semibold leading-none">
1101+
<span style={{ color: usageColor(w.used_percent) }}>{Math.round(w.used_percent)}%</span>
1102+
<span style={{ color: 'var(--ag-text-tertiary)' }}>{formatReset(w.reset_seconds)}</span>
1103+
</span>
1104+
</div>
10991105
<div className="h-1.5 min-w-0 overflow-hidden rounded-full" style={{ background: 'var(--ag-glass-border)' }}>
11001106
<div
11011107
className="h-full rounded-full transition-all"
11021108
style={{ width: `${Math.min(100, Math.round(w.used_percent))}%`, background: usageColor(w.used_percent) }}
11031109
/>
11041110
</div>
1105-
<span className="text-right leading-none" style={{ color: usageColor(w.used_percent), fontSize: 11, fontWeight: 600 }}>
1106-
{Math.round(w.used_percent)}%
1107-
</span>
1108-
<span className="text-right leading-none" style={{ color: 'var(--ag-text-secondary)', fontSize: 11, fontWeight: 600 }}>
1109-
{formatReset(w.reset_seconds)}
1110-
</span>
11111111
</div>
11121112
);
11131113
})}
@@ -1122,8 +1122,7 @@ export default function AccountsPage() {
11221122
</div>
11231123
)}
11241124
</div>
1125-
<span aria-hidden="true" />
1126-
{todayMetricChips ?? <div className={todayMetricColumnClass} />}
1125+
{todayMetricChips}
11271126
</div>
11281127
</div>
11291128
);

0 commit comments

Comments
 (0)