feat: add optional name field to BGP peer creation and update UI
CI / changes (push) Successful in 15s
CI / openapi (push) Has been skipped
CI / go (push) Has been skipped
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m27s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m22s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Has been skipped
CI / docker-go-prime (push) Has been skipped
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Has been skipped
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Has been skipped
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Has been skipped
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Has been skipped
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Has been skipped
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Has been skipped
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Has been skipped
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Has been skipped

Introduced an optional 'name' field in the BgpPeerCreate type to enhance peer identification. Updated the peer creation and editing forms to include this new field, improving user experience. Adjusted the UI to display the peer name in the peer listing table, ensuring better visibility of peer information.
This commit is contained in:
Denozordec
2026-04-22 15:02:14 +07:00
parent 458a885868
commit 1a61ae2d71
2 changed files with 11 additions and 2 deletions
+1
View File
@@ -154,6 +154,7 @@ export type PeerRow = {
};
export type PeersResponse = Page<PeerRow>;
export type BgpPeerCreate = {
name?: string;
neighbor: string;
remote_asn: number;
bgp_speaker_id?: string | null;
+10 -2
View File
@@ -62,6 +62,7 @@
let peerDialog = $state(false);
let peerEdit = $state<PeerRow | null>(null);
let peerForm = $state<BgpPeerCreate & { bgp_speaker_id?: string | null }>({
name: '',
neighbor: '',
remote_asn: 0,
bgp_speaker_id: null,
@@ -109,12 +110,13 @@
// --- Peer actions ---
function openPeerCreate() {
peerEdit = null;
peerForm = { neighbor: '', remote_asn: 0, bgp_speaker_id: null, enabled: true };
peerForm = { name: '', neighbor: '', remote_asn: 0, bgp_speaker_id: null, enabled: true };
peerDialog = true;
}
function openPeerEdit(p: PeerRow) {
peerEdit = p;
peerForm = {
name: p.name ?? '',
neighbor: p.neighbor,
remote_asn: p.remote_asn ?? 0,
bgp_speaker_id: p.bgp_speaker_id,
@@ -263,6 +265,7 @@
<Table>
<TableHeader>
<TableRow>
<TableHead>Имя</TableHead>
<TableHead>Адрес</TableHead>
<TableHead>Remote ASN</TableHead>
<TableHead class="w-[4.5rem] text-center">Вкл.</TableHead>
@@ -274,6 +277,7 @@
<TableBody>
{#each peers as p (p.id)}
<TableRow>
<TableCell>{p.name?.trim() || '—'}</TableCell>
<TableCell class="font-mono">{p.neighbor}</TableCell>
<TableCell class="font-mono">{p.remote_asn ?? '—'}</TableCell>
<TableCell class="text-center">
@@ -297,7 +301,7 @@
</TableRow>
{:else}
<TableRow>
<TableCell colspan={6} class="text-muted-foreground text-center py-8">
<TableCell colspan={7} class="text-muted-foreground text-center py-8">
{peersLoading ? 'Загрузка…' : 'Нет пиров.'}
</TableCell>
</TableRow>
@@ -378,6 +382,10 @@
<DialogDescription>BGP-сосед для установки сессии</DialogDescription>
</DialogHeader>
<div class="space-y-4 py-2">
<div class="space-y-1.5">
<Label for="p-name">Имя пира (опционально)</Label>
<Input id="p-name" placeholder="Core-RTR-1" bind:value={peerForm.name} />
</div>
<div class="space-y-1.5">
<Label for="p-neighbor">Адрес соседа</Label>
<Input id="p-neighbor" placeholder="192.0.2.1" bind:value={peerForm.neighbor} />