diff --git a/front/index.html b/front/index.html index 730f316..0e80cb1 100644 --- a/front/index.html +++ b/front/index.html @@ -67,15 +67,15 @@

Snapshots list -

"+icon+" " + snapshot + " created at " + hdate + restore_button +""; + str += "
  • "+icon+" " + snapshot + " " + restore_button +"
  • "; } $("#loading").addClass('invisible'); diff --git a/modules/router/router.go b/modules/router/router.go index 474bd6e..e191ea8 100644 --- a/modules/router/router.go +++ b/modules/router/router.go @@ -137,10 +137,9 @@ type Cluster struct { } type snapList []struct { - Id string `json:"id,omitempty"` - Status string `json:"status,omitempty"` - End_epoch string `json:"end_epoch,omitempty"` - Start_epoch string `json:"start_epoch,omitempty"` + Name string `json:"name,omitempty"` + Uuid string `json:"uuid,omitempty"` + State string `json:"state,omitempty"` } type scrollResponse struct { @@ -349,7 +348,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { return } - response, err := rt.doGet(rt.conf.Snapshot.Host+"_cat/snapshots/"+request.Values.Repo+"?format=json", "Snapshot") + response, err := rt.doGet(rt.conf.Snapshot.Host+"_snapshot/"+request.Values.Repo+"/*?verbose=false&format=json", "Snapshot") if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) log.Println(remoteIP, "\t", r.Method, "\t", r.URL.Path, "\t", request.Action, "\t", http.StatusInternalServerError, "\t", err.Error()) @@ -367,9 +366,9 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { if !rt.conf.Snapshot.Include { j := 0 for _, n := range snap_list { - matched, err := regexp.MatchString(`^[\.]\S+`, n.Id) + matched, err := regexp.MatchString(`^[\.]\S+`, n.Name) if err != nil { - log.Println("Regex error for ", n.Id) + log.Println("Regex error for ", n.Name) } if !matched { snap_list[j] = n @@ -380,7 +379,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { snap_list = snap_list[:j] } - if request.Values.OrderType == "time" { + /*if request.Values.OrderType == "time" { if request.Values.OrderDir == "asc" { sort.Slice(snap_list[:], func(i, j int) bool { @@ -392,16 +391,17 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { }) } - } else if request.Values.OrderType == "name" { + } else */ + if request.Values.OrderType == "name" { if request.Values.OrderDir == "asc" { sort.Slice(snap_list[:], func(i, j int) bool { - return snap_list[i].Id < snap_list[j].Id + return snap_list[i].Name < snap_list[j].Name }) } else { sort.Slice(snap_list[:], func(i, j int) bool { - return snap_list[i].Id > snap_list[j].Id + return snap_list[i].Name > snap_list[j].Name }) } @@ -414,7 +414,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { case "get_snapshots_sorted": { - if request.Values.OrderType == "time" { + /*if request.Values.OrderType == "time" { if request.Values.OrderDir == "asc" { sort.Slice(rt.sl[:], func(i, j int) bool { @@ -426,16 +426,17 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { }) } - } else if request.Values.OrderType == "name" { + } else */ + if request.Values.OrderType == "name" { if request.Values.OrderDir == "asc" { sort.Slice(rt.sl[:], func(i, j int) bool { - return rt.sl[i].Id < rt.sl[j].Id + return rt.sl[i].Name < rt.sl[j].Name }) } else { sort.Slice(rt.sl[:], func(i, j int) bool { - return rt.sl[i].Id > rt.sl[j].Id + return rt.sl[i].Name > rt.sl[j].Name }) } diff --git a/modules/version/version.go b/modules/version/version.go index 8fd92c7..790f282 100644 --- a/modules/version/version.go +++ b/modules/version/version.go @@ -13,4 +13,4 @@ package version -var Version = "extractor/v0.2.22" +var Version = "extractor/v0.2.23"