Improve admin urls (#7370)

* Improve Master and Volume URLs in admin dashboard

- Add clickable URL for master node.
- Refactor Volume server URL to use PublicURL if set. 'address' is used
  as fallback.

* Make volume servers show in consistent order

- Sort servers by name to ensure predictable order after each refresh.

* address comment

---------

Co-authored-by: chrislu <chris.lu@gmail.com>
This commit is contained in:
Yavor Konstantinov
2025-10-24 01:38:01 -07:00
committed by GitHub
parent 7d147f238c
commit 1d0471aebb
4 changed files with 170 additions and 137 deletions

View File

@@ -3,6 +3,7 @@ package dash
import (
"context"
"net/http"
"sort"
"time"
"github.com/gin-gonic/gin"
@@ -108,6 +109,13 @@ func (s *AdminServer) GetAdminData(username string) (AdminData, error) {
glog.Errorf("Failed to get cluster volume servers: %v", err)
return AdminData{}, err
}
// Sort the servers so they show up in consistent order after each reload
sort.Slice(volumeServersData.VolumeServers, func(i, j int) bool {
s1Name := volumeServersData.VolumeServers[i].GetDisplayAddress()
s2Name := volumeServersData.VolumeServers[j].GetDisplayAddress()
return s1Name < s2Name
})
// Get master nodes status
masterNodes := s.getMasterNodesStatus()