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
Sort by Name
-
+
+
-
+
@@ -87,7 +87,7 @@
+
@@ -282,14 +282,14 @@ X-tract indices from snapshot
"+reponame+"");
- $("#get_repo_sort_time").attr("data-id", reponame);
+ #$("#get_repo_sort_time").attr("data-id", reponame);
$("#get_repo_sort_name").attr("data-id", reponame);
var post = {
"action": "get_snapshots",
"values" : {
"repo": reponame,
- "otype": "time",
+ "otype": "name",
"odir": "desc"
}
};
@@ -306,11 +306,11 @@ X-tract indices from snapshot
';
for(var k in data) {
- snapshot = data[k].id;
- uniqid = data[k].start_epoch;
- status = data[k].status;
- date = new Date(data[k].start_epoch * 1000);
- hdate = date.toLocaleString("ru-RU", {timeZoneName: "short"});
+ snapshot = data[k].name;
+ #uniqid = data[k].start_epoch;
+ status = data[k].state;
+ #date = new Date(data[k].start_epoch * 1000);
+ #hdate = date.toLocaleString("ru-RU", {timeZoneName: "short"});
restore_button = "";
if (status == "SUCCESS") {
@@ -321,7 +321,7 @@ X-tract indices from snapshot
"+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"