Commit b57dff77 by Kálmán Viktor

dashboard: add loading icon for more/less activities link

parent 0fc357cf
...@@ -19,6 +19,7 @@ $(function() { ...@@ -19,6 +19,7 @@ $(function() {
}); });
$("#activity-refresh").on("click", "#show-all-activities", function() { $("#activity-refresh").on("click", "#show-all-activities", function() {
$(this).find("i").addClass("fa-spinner fa-spin");
show_all = !show_all; show_all = !show_all;
$('a[href="#activity"]').trigger("click"); $('a[href="#activity"]').trigger("click");
return false; return false;
...@@ -359,10 +360,14 @@ function checkNewActivity(runs) { ...@@ -359,10 +360,14 @@ function checkNewActivity(runs) {
url: '/dashboard/vm/' + instance + '/activity/', url: '/dashboard/vm/' + instance + '/activity/',
data: {'show_all': show_all}, data: {'show_all': show_all},
success: function(data) { success: function(data) {
if(show_all) { /* replace on longer string freezes the spinning stuff */
$("#activity-refresh").html(data['activities']);
} else {
a = unescapeHTML(data['activities']); a = unescapeHTML(data['activities']);
b = changeHTML($("#activity-refresh").html()); b = changeHTML($("#activity-refresh").html());
if(a != b) if(a != b)
$("#activity-refresh").html(data['activities']); $("#activity-refresh").html(data['activities']);
}
$("#ops").html(data['ops']); $("#ops").html(data['ops']);
$("#disk-ops").html(data['disk_ops']); $("#disk-ops").html(data['disk_ops']);
$("[title]").tooltip(); $("[title]").tooltip();
......
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
<div id="show-all-activities-container"> <div id="show-all-activities-container">
<a id="show-all-activities" href="#"> <a id="show-all-activities" href="#">
{% if activities|length > 10 %} {% if activities|length > 10 %}
<span>{% trans "Show less activities" %}</span> {% trans "Show less activities" %} <i class="fa fa-angle-double-up"></i>
{% else %} {% else %}
<span>{% trans "Show all activities" %}</span> {% trans "Show all activities" %} <i class="fa fa-angle-double-down"></i>
{% endif %} {% endif %}
</a> </a>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment