3 Commits
Author SHA1 Message Date
SerinaNya beb826e7d6 💚 fix ci: add ACTIONS_RESULTS_URL for actions/upload-artifact@v4
Build Dashboard / build (push) Successful in 5m24s
2026-09-03 15:54:46 +08:00
SerinaNya f2dae09b6b 👷 ci: add build workflow
Build Dashboard / build (push) Failing after 6m49s
2026-09-01 15:02:38 +08:00
SerinaNya 885a0c2d89 fix(routing-table): preserve SRv6 protocol types and colors
- Type route protocol and flag fields as strings
- Distinguish Direct, SRv6 ENDXSID, and SRv6 ENDSID routes
- Add dynamic protocol filtering and protocol-specific counters
- Use distinct violet and emerald badges for ENDXSID and ENDSID
2026-08-31 14:40:33 +08:00
3 changed files with 71 additions and 35 deletions
+39
View File
@@ -0,0 +1,39 @@
name: Build Dashboard
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 11
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build dashboard
run: pnpm build
- name: Upload dashboard artifact
uses: actions/upload-artifact@v4
env:
ACTIONS_RESULTS_URL: https://git.code.cq.cn/
with:
name: dashboard-dist
path: dist/
if-no-files-found: error
retention-days: 14
+30 -33
View File
@@ -20,42 +20,37 @@ import {
import { useRoutingTable } from "@/hooks/use-routing-table"
import type { RoutingTableItem } from "@/types/api"
type ProtocolFilter = "all" | "direct" | "klalb"
function protocolName(protocol: RoutingTableItem["protocol"]): string {
const value = String(protocol)
const normalized = value.toLowerCase()
if (normalized === "direct" || value === "0") return "Direct"
if (
normalized.includes("klalb") ||
normalized.includes("srv6") ||
value === "1"
)
return "KLALB SRv6"
return value
}
type ProtocolFilter = "all" | string
function protocolBadge(protocol: RoutingTableItem["protocol"]) {
const name = protocolName(protocol)
if (name === "Direct")
if (protocol === "Direct")
return (
<Badge
variant="secondary"
className="bg-blue-500/10 text-blue-600 dark:text-blue-400"
>
{name}
{protocol}
</Badge>
)
if (name === "KLALB SRv6")
if (protocol === "SRv6 ENDXSID")
return (
<Badge
variant="secondary"
className="bg-purple-500/10 text-purple-600 dark:text-purple-400"
>
{name}
{protocol}
</Badge>
)
return <Badge variant="outline">{name}</Badge>
if (protocol === "SRv6 ENDSID")
return (
<Badge
variant="secondary"
className="bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
>
{protocol}
</Badge>
)
return <Badge variant="outline">{protocol}</Badge>
}
export function RoutingTablePage() {
@@ -67,12 +62,9 @@ export function RoutingTablePage() {
const counts = useMemo(
() => ({
total: routingTable.length,
direct: routingTable.filter(
(route) => protocolName(route.protocol) === "Direct"
).length,
klalb: routingTable.filter(
(route) => protocolName(route.protocol) === "KLALB SRv6"
).length,
direct: routingTable.filter((route) => route.protocol === "Direct").length,
endxsid: routingTable.filter((route) => route.protocol === "SRv6 ENDXSID").length,
endsid: routingTable.filter((route) => route.protocol === "SRv6 ENDSID").length,
}),
[routingTable]
)
@@ -86,13 +78,11 @@ export function RoutingTablePage() {
route.destination,
route.nexthop,
route.interface,
protocolName(route.protocol),
route.protocol,
].some((value) => String(value).toLowerCase().includes(query))
const name = protocolName(route.protocol)
const matchesProtocol =
protocolFilter === "all" ||
(protocolFilter === "direct" && name === "Direct") ||
(protocolFilter === "klalb" && name === "KLALB SRv6")
route.protocol === protocolFilter
return matchesSearch && matchesProtocol
})
}, [routingTable, searchQuery, protocolFilter])
@@ -112,8 +102,9 @@ export function RoutingTablePage() {
const filterOptions: { value: ProtocolFilter; label: string }[] = [
{ value: "all", label: "全部" },
{ value: "direct", label: "直连" },
{ value: "klalb", label: "KLALB SRv6" },
...Array.from(new Set(routingTable.map((route) => route.protocol))).map(
(protocol) => ({ value: protocol, label: protocol })
),
]
return (
@@ -142,7 +133,13 @@ export function RoutingTablePage() {
variant="secondary"
className="bg-purple-500/10 text-purple-600 dark:text-purple-400"
>
KLALB SRv6 {counts.klalb}
SRv6 ENDXSID {counts.endxsid}
</Badge>
<Badge
variant="secondary"
className="bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
>
SRv6 ENDSID {counts.endsid}
</Badge>
</div>
</div>
+2 -2
View File
@@ -66,10 +66,10 @@ export interface SSEEventData {
export interface RoutingTableItem {
destination: string
protocol: number
protocol: string
preference: number
cost: number
flag: number
flag: string
nexthop: string
interface: string
}