Finishing v3.0

This commit is contained in:
Donald Cheng Hong Zou
2021-12-27 21:01:02 -05:00
parent e42ecf3c99
commit d254b4cc39
8 changed files with 250 additions and 80 deletions

View File

@@ -303,7 +303,7 @@ $("body").on("change", "#sort_by_dropdown", function (){
headers:{"Content-Type": "application/json"},
url: "/update_dashboard_sort",
success: function (res){
location.reload()
load_data($('#search_peer_textbox').val())
}
})
})
@@ -336,26 +336,41 @@ function copyToClipboard(element) {
// Update Interval
$("body").on("click", ".update_interval", function(){
$.ajax({
method:"POST",
data: "interval="+$(this).attr("refresh-interval"),
url: "/update_dashboard_refresh_interval",
success: function (res){
location.reload()
}
})
});
$(".interval-btn-group button").removeClass("active");
$(this).addClass("active");
$.ajax({
method:"POST",
data: "interval="+$(this).data("refresh-interval"),
url: "/update_dashboard_refresh_interval",
success: function (res){
load_data($('#search_peer_textbox').val())
}
})
});
$("body").on("click", ".refresh", function (){
load_data($('#search_peer_textbox').val());
});
// Switch display mode
$("body").on("click", ".display_mode", function(){
$(".display-btn-group button").removeClass("active");
$(this).addClass("active");
let display_mode = $(this).data("display-mode");
$.ajax({
method:"GET",
url: "/switch_display_mode/"+$(this).attr("display-mode"),
url: "/switch_display_mode/"+$(this).data("display-mode"),
success: function (res){
location.reload()
// load_data($('#search_peer_textbox').val())
if (display_mode === "list"){
Array($(".peer_list").children()).forEach(function(child){
$(child).removeClass().addClass("col-12");
})
}else{
Array($(".peer_list").children()).forEach(function(child){
$(child).removeClass().addClass("col-sm-6 col-lg-4");
})
}
}
})
})