gui: Modal dialog for listeners and discovery status (#7539)
This commit is contained in:
+22
-8
@@ -1023,16 +1023,16 @@ func (s *service) getSystemStatus(w http.ResponseWriter, r *http.Request) {
|
||||
res["tilde"] = tilde
|
||||
if s.cfg.Options().LocalAnnEnabled || s.cfg.Options().GlobalAnnEnabled {
|
||||
res["discoveryEnabled"] = true
|
||||
discoErrors := make(map[string]string)
|
||||
discoMethods := 0
|
||||
for disco, err := range s.discoverer.ChildErrors() {
|
||||
discoMethods++
|
||||
if err != nil {
|
||||
discoErrors[disco] = err.Error()
|
||||
discoStatus := s.discoverer.ChildErrors()
|
||||
res["discoveryStatus"] = discoveryStatusMap(discoStatus)
|
||||
res["discoveryMethods"] = len(discoStatus) // DEPRECATED: Redundant, only for backwards compatibility, should be removed.
|
||||
discoErrors := make(map[string]*string, len(discoStatus))
|
||||
for s, e := range discoStatus {
|
||||
if e != nil {
|
||||
discoErrors[s] = errorString(e)
|
||||
}
|
||||
}
|
||||
res["discoveryMethods"] = discoMethods
|
||||
res["discoveryErrors"] = discoErrors
|
||||
res["discoveryErrors"] = discoErrors // DEPRECATED: Redundant, only for backwards compatibility, should be removed.
|
||||
}
|
||||
|
||||
res["connectionServiceStatus"] = s.connectionsService.ListenerStatus()
|
||||
@@ -1905,6 +1905,20 @@ func errorString(err error) *string {
|
||||
return nil
|
||||
}
|
||||
|
||||
type discoveryStatusEntry struct {
|
||||
Error *string `json:"error"`
|
||||
}
|
||||
|
||||
func discoveryStatusMap(errs map[string]error) map[string]discoveryStatusEntry {
|
||||
out := make(map[string]discoveryStatusEntry, len(errs))
|
||||
for s, e := range errs {
|
||||
out[s] = discoveryStatusEntry{
|
||||
Error: errorString(e),
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// sanitizedHostname returns the given name in a suitable form for use as
|
||||
// the common name in a certificate, or an error.
|
||||
func sanitizedHostname(name string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user