@@ -137,10 +137,9 @@ type Cluster struct {
137137}
138138
139139type snapList []struct {
140- Id string `json:"id,omitempty"`
141- Status string `json:"status,omitempty"`
142- End_epoch string `json:"end_epoch,omitempty"`
143- Start_epoch string `json:"start_epoch,omitempty"`
140+ Name string `json:"name,omitempty"`
141+ Uuid string `json:"uuid,omitempty"`
142+ State string `json:"state,omitempty"`
144143}
145144
146145type scrollResponse struct {
@@ -349,7 +348,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
349348 return
350349 }
351350
352- response , err := rt .doGet (rt .conf .Snapshot .Host + "_cat/snapshots/ " + request .Values .Repo + "? format=json" , "Snapshot" )
351+ response , err := rt .doGet (rt .conf .Snapshot .Host + "_snapshot/ " + request .Values .Repo + "/*?verbose=false& format=json" , "Snapshot" )
353352 if err != nil {
354353 http .Error (w , err .Error (), http .StatusInternalServerError )
355354 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) {
367366 if ! rt .conf .Snapshot .Include {
368367 j := 0
369368 for _ , n := range snap_list {
370- matched , err := regexp .MatchString (`^[\.]\S+` , n .Id )
369+ matched , err := regexp .MatchString (`^[\.]\S+` , n .Name )
371370 if err != nil {
372- log .Println ("Regex error for " , n .Id )
371+ log .Println ("Regex error for " , n .Name )
373372 }
374373 if ! matched {
375374 snap_list [j ] = n
@@ -380,7 +379,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
380379 snap_list = snap_list [:j ]
381380
382381 }
383- if request .Values .OrderType == "time" {
382+ /* if request.Values.OrderType == "time" {
384383
385384 if request.Values.OrderDir == "asc" {
386385 sort.Slice(snap_list[:], func(i, j int) bool {
@@ -392,16 +391,17 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
392391 })
393392 }
394393
395- } else if request .Values .OrderType == "name" {
394+ } else */
395+ if request .Values .OrderType == "name" {
396396
397397 if request .Values .OrderDir == "asc" {
398398 sort .Slice (snap_list [:], func (i , j int ) bool {
399- return snap_list [i ].Id < snap_list [j ].Id
399+ return snap_list [i ].Name < snap_list [j ].Name
400400 })
401401
402402 } else {
403403 sort .Slice (snap_list [:], func (i , j int ) bool {
404- return snap_list [i ].Id > snap_list [j ].Id
404+ return snap_list [i ].Name > snap_list [j ].Name
405405 })
406406 }
407407
@@ -414,7 +414,7 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
414414
415415 case "get_snapshots_sorted" :
416416 {
417- if request .Values .OrderType == "time" {
417+ /* if request.Values.OrderType == "time" {
418418
419419 if request.Values.OrderDir == "asc" {
420420 sort.Slice(rt.sl[:], func(i, j int) bool {
@@ -426,16 +426,17 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) {
426426 })
427427 }
428428
429- } else if request .Values .OrderType == "name" {
429+ } else */
430+ if request .Values .OrderType == "name" {
430431
431432 if request .Values .OrderDir == "asc" {
432433 sort .Slice (rt .sl [:], func (i , j int ) bool {
433- return rt .sl [i ].Id < rt .sl [j ].Id
434+ return rt .sl [i ].Name < rt .sl [j ].Name
434435 })
435436
436437 } else {
437438 sort .Slice (rt .sl [:], func (i , j int ) bool {
438- return rt .sl [i ].Id > rt .sl [j ].Id
439+ return rt .sl [i ].Name > rt .sl [j ].Name
439440 })
440441 }
441442
0 commit comments