#11494 Create widget class for service level

This commit is contained in:
miguel angel rasteu 2023-09-12 14:19:15 +02:00
parent bab81b08e2
commit 5328153dc3
4 changed files with 35 additions and 5 deletions

View File

@ -306,32 +306,48 @@ function format_for_graph(
}
function human_milliseconds_to_string($seconds)
function human_milliseconds_to_string($seconds, $size_text='large')
{
$ret = '';
// get the days
$days = intval(intval($seconds) / (360000 * 24));
if ($days > 0) {
$ret .= "$days days ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$days d").' ';
} else {
$ret .= "$days days ";
}
}
// get the hours
$hours = ((intval($seconds) / 360000) % 24);
if ($hours > 0) {
$ret .= "$hours hours ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$hours h").' ';
} else {
$ret .= "$hours hours ";
}
}
// get the minutes
$minutes = ((intval($seconds) / 6000) % 60);
if ($minutes > 0) {
$ret .= "$minutes minutes ";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$minutes m").' ';
} else {
$ret .= "$minutes minutes ";
}
}
// get the seconds
$seconds = ((intval($seconds) / 100) % 60);
if ($seconds > 0) {
$ret .= "$seconds seconds";
if ($size_text === 'short') {
$ret .= str_replace(' ', '', "$seconds s").' ';
} else {
$ret .= "$seconds seconds ";
}
}
return $ret;

View File

@ -444,6 +444,10 @@ class Widget
$className .= '\HeatmapWidget';
break;
case 'service_level':
$className .= '\ServiceLevelWidget';
break;
default:
$className = false;
break;

View File

@ -279,6 +279,11 @@ li#div-textarea label {
display: initial;
}
.content-widget .container-top {
height: 100%;
width: 99%;
}
.widget-groups-status {
display: flex;
flex-direction: row;

View File

@ -784,6 +784,11 @@ form ul.form_flex {
width: 100%;
}
.content-widget .container-top {
height: 100%;
width: 99%;
}
.container-layout {
border-radius: 5px;
border: 3px dashed #fff;