fix(config): добавить новые зависимости и обновить конфигурацию компонентов
Docker images / prepare-release (push) Successful in 5s
Docker images / backend-image (push) Successful in 2m37s
Docker images / frontend-image (push) Successful in 2m22s
Docker images / updater-image (push) Successful in 38s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s

This commit is contained in:
Denozordec
2026-06-30 21:30:40 +07:00
parent 009011a917
commit a1a9124f3d
80 changed files with 13310 additions and 1587 deletions
+40
View File
@@ -0,0 +1,40 @@
import type { Filter } from "@/components/reui/filters"
type FieldAccessor<T> = Record<string, (row: T) => unknown>
function matchFilter<T>(row: T, filter: Filter, accessors: FieldAccessor<T>): boolean {
const getValue = accessors[filter.field]
if (!getValue) return true
const value = getValue(row)
const vals = filter.values
const str = (v: unknown) => String(v ?? "").toLowerCase()
switch (filter.operator) {
case "is":
return vals.length > 0 && String(value) === String(vals[0])
case "isNot":
return vals.length === 0 || String(value) !== String(vals[0])
case "isAnyOf":
return vals.some((v) => String(value) === String(v))
case "isNotAnyOf":
return !vals.some((v) => String(value) === String(v))
case "contains":
return vals.some((v) => str(value).includes(str(v)))
case "doesNotContain":
return !vals.some((v) => str(value).includes(str(v)))
default:
return true
}
}
export function applyReuiFilters<T>(
rows: T[],
filters: Filter[],
accessors: FieldAccessor<T>,
): T[] {
if (filters.length === 0) return rows
return rows.filter((row) =>
filters.every((f) => matchFilter(row, f, accessors)),
)
}
+36
View File
@@ -0,0 +1,36 @@
import type { FilterFieldConfig } from "@/components/reui/filters"
export const BGP_FILTER_FIELDS: FilterFieldConfig[] = [
{
key: "state",
label: "Состояние",
type: "multiselect",
options: [
{ value: "Established", label: "Established" },
{ value: "Active", label: "Active" },
{ value: "Idle", label: "Idle" },
{ value: "Connect", label: "Connect" },
{ value: "OpenSent", label: "OpenSent" },
{ value: "OpenConfirm", label: "OpenConfirm" },
],
},
{
key: "type",
label: "Тип",
type: "multiselect",
options: [
{ value: "eBGP", label: "eBGP" },
{ value: "iBGP", label: "iBGP" },
],
},
{
key: "afi",
label: "AFI",
type: "multiselect",
options: [
{ value: "IPv4 Unicast", label: "IPv4 Unicast" },
{ value: "IPv6 Unicast", label: "IPv6 Unicast" },
{ value: "VPNv4 Unicast", label: "VPNv4 Unicast" },
],
},
]
+45
View File
@@ -0,0 +1,45 @@
import type { FilterFieldConfig } from "@/components/reui/filters"
import type { Server, ServerType } from "@/lib/data"
export const SERVER_FILTER_FIELDS: FilterFieldConfig[] = [
{
key: "country",
label: "Страна",
type: "multiselect",
searchable: true,
options: [
{ value: "RU", label: "RU" },
{ value: "DE", label: "DE" },
{ value: "NL", label: "NL" },
{ value: "SG", label: "SG" },
{ value: "FI", label: "FI" },
{ value: "US", label: "US" },
],
},
{
key: "status",
label: "Статус",
type: "multiselect",
options: [
{ value: "online", label: "Online" },
{ value: "degraded", label: "Degraded" },
{ value: "offline", label: "Offline" },
],
},
{
key: "type",
label: "Тип",
type: "multiselect",
options: [
{ value: "jump-host", label: "JumpHost" },
{ value: "exit-node", label: "Exit Node" },
{ value: "home-router", label: "Home Router" },
],
},
]
export const SERVER_FILTER_ACCESSORS = {
country: (s: Server) => s.country ?? "",
status: (s: Server) => s.status,
type: (s: Server) => s.type as ServerType,
}