Fix tooltip update

This commit is contained in:
amcmanu3 2023-02-07 17:51:13 -05:00
parent 5b4639b839
commit d0e8148282

View File

@ -110,12 +110,16 @@
{% for item in data.get('hosts_data').get('disk_json') %} {% for item in data.get('hosts_data').get('disk_json') %}
{% if item["mount"] in data["monitored"] %} {% if item["mount"] in data["monitored"] %}
<div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12"> <div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12">
<h4 class="mb-0 font-weight-semibold d-inline-block text-truncate" id="title_{{item['device']}}" data-toggle="tooltip" data-placement="bottom" title="{{item['mount']}}" style="max-width: 100%;"><i class="fas fa-hdd"></i> {{item["mount"]}}</h4> <h4 class="mb-0 font-weight-semibold d-inline-block text-truncate storage-heading"
<div class="progress d-inline-block" style="height: 20px; width: 100%; background-color: rgb(139, 139, 139) !important;"> id="title_{{item['device']}}" data-toggle="tooltip" data-placement="bottom"
title="{{item['mount']}}" style="max-width: 100%;"><i class="fas fa-hdd"></i>
{{item["mount"]}}</h4>
<div class="progress d-inline-block"
style="height: 20px; width: 100%; background-color: rgb(139, 139, 139) !important;">
<div class="progress-bar <div class="progress-bar
{% if item['percent_used'] <= 33 %} {% if item['percent_used'] <= 58 %}
bg-success bg-success
{% elif 34 <= item['percent_used'] <= 75 %} {% elif 59 <= item['percent_used'] <= 75 %}
bg-warning bg-warning
{% else %} {% else %}
bg-danger bg-danger
@ -928,12 +932,12 @@
for (i = 0; i < hostStats.disk_usage.length; i++) { for (i = 0; i < hostStats.disk_usage.length; i++) {
if (hostStats.mounts.includes(hostStats.disk_usage[i].mount)) { if (hostStats.mounts.includes(hostStats.disk_usage[i].mount)) {
storage_html += `<div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12"> storage_html += `<div id="{{item['device']}}" class="col-xl-3 col-lg-3 col-md-4 col-12">
<h4 class="mb-0 font-weight-semibold d-inline-block text-truncate" id="title_{{item['device']}}" data-toggle="tooltip" data-placement="bottom" title="${hostStats.disk_usage[i].mount}" style="max-width: 100%;"><i class="fas fa-hdd"></i> ${hostStats.disk_usage[i].mount}</h4> <h4 class="mb-0 font-weight-semibold d-inline-block text-truncate storage-heading" id="title_{{item['device']}}" data-toggle="tooltip" data-placement="bottom" title="${hostStats.disk_usage[i].mount}" style="max-width: 100%;"><i class="fas fa-hdd"></i> ${hostStats.disk_usage[i].mount}</h4>
<div class="progress" style="display: inline-block; height: 20px; width: 100%; background-color: rgb(139, 139, 139) !important;"> <div class="progress" style="display: inline-block; height: 20px; width: 100%; background-color: rgb(139, 139, 139) !important;">
<div class="progress-bar`; <div class="progress-bar`;
if (hostStats.disk_usage[i].percent_used <= 33) { if (hostStats.disk_usage[i].percent_used <= 58) {
storage_html += ` bg-success`; storage_html += ` bg-success`;
} else if (hostStats.disk_usage[i].percent_used <= 75 && hostStats.disk_usage[i].percent_used >= 34) { } else if (hostStats.disk_usage[i].percent_used <= 75 && hostStats.disk_usage[i].percent_used >= 59) {
storage_html += ` bg-warning`; storage_html += ` bg-warning`;
} else { } else {
storage_html += ` bg-danger`; storage_html += ` bg-danger`;
@ -946,7 +950,9 @@
} }
} }
storage_html += `</div>`; storage_html += `</div>`;
$(".storage-heading").tooltip('hide');
$("#storage_data").html(storage_html); $("#storage_data").html(storage_html);
$("#storage_data").tooltip({ selector: '.storage-heading' });
}); });
} }