mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-28 05:46:36 +08:00
认证页 axe a11y 审计+修复:7 处布局级真实违规全修,复扫验证 dashboard/admin/system 归零;基准 total_issues 保持 8 不变(纯质量收益)
Result: {"status":"keep","total_issues":8,"eslint_errors":0,"eslint_problems":0,"eslint_warnings":0,"golint_canonicalheader":0,"golint_errname":0,"golint_errorlint":1,"golint_exhaustive":0,"golint_forcetypeassert":0,"golint_gosec":0,"golint_intrange":0,"golint_modernize":3,"golint_nilnil":3,"golint_perfsprint":0,"golint_prealloc":0,"golint_recvcheck":1,"golint_test_testifylint":0,"golint_test_thelper":0,"golint_test_total":0,"golint_test_usetesting":0,"golint_total":8,"golint_usestdlibvars":0,"golint_vetx_total":0,"golint_wastedassign":0,"measure_s":93,"tsc_errors":0,"vitest_failed":0,"vitest_total":126}
This commit is contained in:
@@ -8,10 +8,9 @@ import {
|
||||
ManageDetailPanel,
|
||||
ManagePage,
|
||||
} from '@/components/common/general/manage-pannel';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { ShieldCheck } from 'lucide-react';
|
||||
|
||||
import { formatDateTime } from '@/lib/utils';
|
||||
import { cn, formatDateTime } from '@/lib/utils';
|
||||
import type { SystemConfig } from '@/lib/services/admin';
|
||||
import { AdminProvider, useAdmin } from '@/contexts/admin-context';
|
||||
|
||||
@@ -255,20 +254,28 @@ export function SystemConfigs() {
|
||||
emptyDescription={t('emptyDescription')}
|
||||
loadingDescription={t('loadingDescription')}
|
||||
headerExtra={
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(val) => setActiveTab(val as 'system' | 'business')}
|
||||
className='w-[180px]'
|
||||
<div
|
||||
role='group'
|
||||
aria-label={t('configType')}
|
||||
className='grid w-[180px] grid-cols-2 h-8 rounded-md border border-input bg-muted/40 p-0.5'
|
||||
>
|
||||
<TabsList className='grid w-full grid-cols-2 h-8'>
|
||||
<TabsTrigger value='business' className='text-[11px] h-7'>
|
||||
{t('businessConfig')}
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value='system' className='text-[11px] h-7'>
|
||||
{t('systemConfig')}
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
{(['business', 'system'] as const).map((tab) => (
|
||||
<button
|
||||
key={tab}
|
||||
type='button'
|
||||
onClick={() => setActiveTab(tab)}
|
||||
aria-pressed={activeTab === tab}
|
||||
className={cn(
|
||||
'h-full rounded-sm text-[11px] font-medium transition-colors',
|
||||
activeTab === tab
|
||||
? 'bg-background shadow-sm text-foreground'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
)}
|
||||
>
|
||||
{tab === 'business' ? t('businessConfig') : t('systemConfig')}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
}
|
||||
columns={[
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ import { cn } from '@/lib/utils';
|
||||
|
||||
export function UserFilterBar() {
|
||||
const t = useTranslations('admin.users');
|
||||
const tCommon = useTranslations('common');
|
||||
const {
|
||||
total,
|
||||
loading,
|
||||
@@ -223,6 +224,7 @@ export function UserFilterBar() {
|
||||
<Button
|
||||
variant='ghost'
|
||||
size='icon'
|
||||
aria-label={tCommon('previousPage')}
|
||||
className='h-5.5 w-6 rounded-none rounded-l-md disabled:opacity-30'
|
||||
onClick={() => setPage(Math.max(1, page - 1))}
|
||||
disabled={page <= 1 || loading}
|
||||
@@ -235,6 +237,7 @@ export function UserFilterBar() {
|
||||
<Button
|
||||
variant='ghost'
|
||||
size='icon'
|
||||
aria-label={tCommon('nextPage')}
|
||||
className='h-5.5 w-6 rounded-none rounded-r-md disabled:opacity-30'
|
||||
onClick={() => setPage(Math.min(totalPages, page + 1))}
|
||||
disabled={page >= totalPages || loading}
|
||||
|
||||
@@ -67,6 +67,7 @@ export function DashboardStatCards({
|
||||
</div>
|
||||
<Progress
|
||||
value={capacity.average_cpu_usage_percent}
|
||||
aria-label={t('clusterCapacity')}
|
||||
className='h-1.5'
|
||||
/>
|
||||
<p className='text-[10px] text-muted-foreground'>
|
||||
@@ -95,7 +96,7 @@ export function DashboardStatCards({
|
||||
{t('onlineOf', { total: summary.total_nodes })}
|
||||
</span>
|
||||
</div>
|
||||
<Progress value={onlineRate} className='h-1.5' />
|
||||
<Progress value={onlineRate} aria-label={t('nodeOverview')} className='h-1.5' />
|
||||
<p className='text-[10px] text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1'>
|
||||
<span className='inline-flex items-center gap-1'>
|
||||
<Users className='size-3' />
|
||||
|
||||
@@ -77,7 +77,7 @@ function SummaryMetric({
|
||||
{value}
|
||||
</span>
|
||||
{typeof progress === 'number' ? (
|
||||
<Progress value={progress} className='h-1' />
|
||||
<Progress value={progress} aria-label={label} className='h-1' />
|
||||
) : null}
|
||||
<span className='truncate text-[10px] text-muted-foreground'>{hint}</span>
|
||||
</div>
|
||||
@@ -109,7 +109,7 @@ function DetailMetric({
|
||||
<Icon className='size-3.5 shrink-0 text-muted-foreground' />
|
||||
</div>
|
||||
{typeof progress === 'number' ? (
|
||||
<Progress value={progress} className='h-1' />
|
||||
<Progress value={progress} aria-label={label} className='h-1' />
|
||||
) : null}
|
||||
<p className='truncate text-[10px] text-muted-foreground'>{hint}</p>
|
||||
</div>
|
||||
|
||||
@@ -76,7 +76,7 @@ export function EmptyState({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{title && <h3 className='text-base font-medium mb-1'>{title}</h3>}
|
||||
{title && <p className='text-base font-medium mb-1'>{title}</p>}
|
||||
|
||||
{description && (
|
||||
<p className='text-sm text-muted-foreground max-w-md'>{description}</p>
|
||||
|
||||
@@ -70,7 +70,7 @@ export function ErrorDisplay({
|
||||
<Icon className='size-6 text-red-600 dark:text-red-400' />
|
||||
</div>
|
||||
|
||||
<h3 className='text-lg font-semibold mb-2'>{title}</h3>
|
||||
<p className='text-lg font-semibold mb-2'>{title}</p>
|
||||
|
||||
<p className='text-sm text-muted-foreground max-w-md mb-4'>
|
||||
{errorMessage}
|
||||
|
||||
@@ -160,7 +160,7 @@ export function SiteHeader({
|
||||
<Search className='absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground' />
|
||||
<div className='flex h-8 items-center rounded-md border border-border/60 bg-muted/70 pl-10 pr-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted'>
|
||||
<span>{t('search')}</span>
|
||||
<Kbd className='ml-auto gap-0.5 font-mono'>
|
||||
<Kbd className='ml-auto gap-0.5 font-mono text-foreground/70'>
|
||||
<span>{metaKey}</span>
|
||||
<span>K</span>
|
||||
</Kbd>
|
||||
|
||||
@@ -115,7 +115,7 @@ export function LoadingState({
|
||||
</div>
|
||||
|
||||
{title && (
|
||||
<h3 className='text-sm font-medium mb-1 animate-pulse'>{title}</h3>
|
||||
<p className='text-sm font-medium mb-1 animate-pulse'>{title}</p>
|
||||
)}
|
||||
|
||||
{description && (
|
||||
|
||||
@@ -197,12 +197,15 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
||||
<Sidebar
|
||||
collapsible='icon'
|
||||
{...props}
|
||||
role='navigation'
|
||||
aria-label={t('mainNavigation')}
|
||||
className='px-2 relative border-r border-border/40 group-data-[collapsible=icon]'
|
||||
>
|
||||
<Button
|
||||
onClick={toggleSidebar}
|
||||
variant='ghost'
|
||||
size='icon'
|
||||
aria-label={t('toggleSidebar')}
|
||||
className='absolute top-1/2 -right-6 w-2 h-4 text-muted-foreground hover:bg-background hidden md:flex'
|
||||
>
|
||||
{state === 'expanded' ? (
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
"settings": "Settings",
|
||||
"search": "Search",
|
||||
"unknownError": "Something went wrong. Please try again.",
|
||||
"loadFailed": "Load failed"
|
||||
"loadFailed": "Load failed",
|
||||
"previousPage": "Previous page",
|
||||
"nextPage": "Next page"
|
||||
},
|
||||
"contexts": {
|
||||
"adminUsers": {
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
"settings": "设置",
|
||||
"search": "搜索",
|
||||
"unknownError": "发生错误,请重试",
|
||||
"loadFailed": "加载失败"
|
||||
"loadFailed": "加载失败",
|
||||
"previousPage": "上一页",
|
||||
"nextPage": "下一页"
|
||||
},
|
||||
"contexts": {
|
||||
"adminUsers": {
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
"empty": {
|
||||
"noData": "No data",
|
||||
"noContent": "No records found"
|
||||
}
|
||||
},
|
||||
"toggleSidebar": "Toggle sidebar",
|
||||
"mainNavigation": "Main navigation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
"empty": {
|
||||
"noData": "暂无数据",
|
||||
"noContent": "当前没有任何记录"
|
||||
}
|
||||
},
|
||||
"toggleSidebar": "切换侧边栏",
|
||||
"mainNavigation": "主导航"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user