Update AS path display to show handles with clickable links
- Change AS path from descriptions to handles (short names) - Make each AS in the path a clickable link to /as/<asn> - Add font-weight to AS links in path for better visibility - Prevent word wrapping on all table columns except AS path - Remove unused maxASDescriptionLength constant
This commit is contained in:
parent
81267431f7
commit
1dcde74a90
@ -20,11 +20,6 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// maxASDescriptionLength is the maximum length for AS descriptions in the UI
|
|
||||||
maxASDescriptionLength = 20
|
|
||||||
)
|
|
||||||
|
|
||||||
// handleRoot returns a handler that redirects to /status
|
// handleRoot returns a handler that redirects to /status
|
||||||
func (s *Server) handleRoot() http.HandlerFunc {
|
func (s *Server) handleRoot() http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
@ -651,33 +646,29 @@ func (s *Server) handlePrefixDetail() http.HandlerFunc {
|
|||||||
origins = append(origins, origin)
|
origins = append(origins, origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create enhanced routes with AS path descriptions
|
// Create enhanced routes with AS path handles
|
||||||
type ASPathEntry struct {
|
type ASPathEntry struct {
|
||||||
Number int
|
Number int
|
||||||
Description string
|
Handle string
|
||||||
}
|
}
|
||||||
type EnhancedRoute struct {
|
type EnhancedRoute struct {
|
||||||
database.LiveRoute
|
database.LiveRoute
|
||||||
ASPathWithDesc []ASPathEntry
|
ASPathWithHandle []ASPathEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
enhancedRoutes := make([]EnhancedRoute, len(routes))
|
enhancedRoutes := make([]EnhancedRoute, len(routes))
|
||||||
for i, route := range routes {
|
for i, route := range routes {
|
||||||
enhancedRoute := EnhancedRoute{
|
enhancedRoute := EnhancedRoute{
|
||||||
LiveRoute: route,
|
LiveRoute: route,
|
||||||
ASPathWithDesc: make([]ASPathEntry, len(route.ASPath)),
|
ASPathWithHandle: make([]ASPathEntry, len(route.ASPath)),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up description for each AS in the path
|
// Look up handle for each AS in the path
|
||||||
for j, asn := range route.ASPath {
|
for j, asn := range route.ASPath {
|
||||||
desc := asinfo.GetDescription(asn)
|
handle := asinfo.GetHandle(asn)
|
||||||
// Truncate description if longer than maxASDescriptionLength characters
|
enhancedRoute.ASPathWithHandle[j] = ASPathEntry{
|
||||||
if len(desc) > maxASDescriptionLength {
|
Number: asn,
|
||||||
desc = desc[:maxASDescriptionLength] + "..."
|
Handle: handle,
|
||||||
}
|
|
||||||
enhancedRoute.ASPathWithDesc[j] = ASPathEntry{
|
|
||||||
Number: asn,
|
|
||||||
Description: desc,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@
|
|||||||
.route-table td {
|
.route-table td {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
border-bottom: 1px solid #e0e0e0;
|
border-bottom: 1px solid #e0e0e0;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.route-table tr:hover {
|
.route-table tr:hover {
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
@ -117,9 +118,12 @@
|
|||||||
color: #666;
|
color: #666;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
white-space: normal;
|
white-space: normal !important;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
.as-path .as-link {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
.age {
|
.age {
|
||||||
color: #7f8c8d;
|
color: #7f8c8d;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -236,7 +240,7 @@
|
|||||||
<a href="/as/{{.OriginASN}}" class="as-link">AS{{.OriginASN}}</a>
|
<a href="/as/{{.OriginASN}}" class="as-link">AS{{.OriginASN}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="peer-ip">{{.PeerIP}}</td>
|
<td class="peer-ip">{{.PeerIP}}</td>
|
||||||
<td class="as-path">{{range $i, $as := .ASPathWithDesc}}{{if $i}} → {{end}}{{if $as.Description}}{{$as.Description}} ({{$as.Number}}){{else}}AS{{$as.Number}}{{end}}{{end}}</td>
|
<td class="as-path">{{range $i, $as := .ASPathWithHandle}}{{if $i}} → {{end}}<a href="/as/{{$as.Number}}" class="as-link">{{if $as.Handle}}{{$as.Handle}}{{else}}AS{{$as.Number}}{{end}}</a>{{end}}</td>
|
||||||
<td class="peer-ip">{{.NextHop}}</td>
|
<td class="peer-ip">{{.NextHop}}</td>
|
||||||
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
||||||
<td class="age">{{.LastUpdated | timeSince}}</td>
|
<td class="age">{{.LastUpdated | timeSince}}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user