Add dashboard default settings to system_status.php (#6141)
This commit is contained in:
@@ -57,27 +57,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var cpu_chart_background_color;
|
var cpu_usage_chart_context = document.getElementById('cpu_usage_chart').getContext('2d');
|
||||||
|
|
||||||
|
var cpu_usage_chart_background_color;
|
||||||
if ('<?php echo $percent_cpu; ?>' <= 50) {
|
if ('<?php echo $percent_cpu; ?>' <= 50) {
|
||||||
cpu_chart_background_color = '#03c04a';
|
cpu_usage_chart_background_color = '<?php echo $_SESSION['dashboard']['cpu_usage_chart_main_background_color']['text']; ?>';
|
||||||
} else if ('<?php echo $percent_cpu; ?>' <= 70 && '<?php echo $percent_cpu; ?>' > 50) {
|
} else if ('<?php echo $percent_cpu; ?>' <= 70 && '<?php echo $percent_cpu; ?>' > 50) {
|
||||||
cpu_chart_background_color = '#ff9933';
|
cpu_usage_chart_background_color = '#ff9933';
|
||||||
} else if ('<?php echo $percent_cpu; ?>' > 70) {
|
} else if ('<?php echo $percent_cpu; ?>' > 70) {
|
||||||
cpu_chart_background_color = '#ea4c46';
|
cpu_usage_chart_background_color = '#ea4c46';
|
||||||
}
|
}
|
||||||
|
|
||||||
const cpu_usage_data = {
|
const cpu_usage_chart_data = {
|
||||||
datasets: [{
|
datasets: [{
|
||||||
data: ['<?php echo $percent_cpu; ?>', 100 - '<?php echo $percent_cpu; ?>'],
|
data: ['<?php echo $percent_cpu; ?>', 100 - '<?php echo $percent_cpu; ?>'],
|
||||||
backgroundColor: [cpu_chart_background_color, '#d4d4d4'],
|
backgroundColor: [
|
||||||
borderColor: 'rgba(0,0,0,0)',
|
cpu_usage_chart_background_color,
|
||||||
|
'<?php echo $_SESSION['dashboard']['cpu_usage_chart_sub_background_color']['text']; ?>'
|
||||||
|
],
|
||||||
|
borderColor: '<?php echo $_SESSION['dashboard']['cpu_usage_chart_border_color']['text']; ?>',
|
||||||
|
borderWidth: '<?php echo $_SESSION['dashboard']['cpu_usage_chart_border_width']['text']; ?>',
|
||||||
cutout: chart_cutout
|
cutout: chart_cutout
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
const cpu_usage_config = {
|
const cpu_usage_chart_config = {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: cpu_usage_data,
|
data: cpu_chart_usage_data,
|
||||||
options: {
|
options: {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
@@ -104,29 +110,35 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const cpu_usage_chart = new Chart(
|
const cpu_usage_chart = new Chart(
|
||||||
document.getElementById('cpu_usage_chart'),
|
cpu_usage_chart_context,
|
||||||
cpu_usage_config
|
cpu_usage_chart_config
|
||||||
);
|
);
|
||||||
|
|
||||||
var disk_chart_background_color;
|
var disk_usage_chart_context = document.getElementById('disk_usage_chart').getContext('2d');
|
||||||
|
|
||||||
|
var disk_usage_chart_background_color;
|
||||||
if ('<?php echo $percent_disk_usage; ?>' < 60) {
|
if ('<?php echo $percent_disk_usage; ?>' < 60) {
|
||||||
disk_chart_background_color = '#03c04a';
|
disk_usage_chart_background_color = '<?php echo $_SESSION['dashboard']['disk_usage_chart_main_background_color']['text']; ?>';
|
||||||
} else if ('<?php echo $percent_disk_usage; ?>' < 80 && '<?php echo $percent_disk_usage; ?>' > 60) {
|
} else if ('<?php echo $percent_disk_usage; ?>' < 80 && '<?php echo $percent_disk_usage; ?>' > 60) {
|
||||||
disk_chart_background_color = '#ff9933';
|
disk_usage_chart_background_color = '#ff9933';
|
||||||
} else if ('<?php echo $percent_disk_usage; ?>' >= 80) {
|
} else if ('<?php echo $percent_disk_usage; ?>' >= 80) {
|
||||||
disk_chart_background_color = '#ea4c46';
|
disk_usage_chart_background_color = '#ea4c46';
|
||||||
}
|
}
|
||||||
|
|
||||||
const disk_chart_config = {
|
const disk_usage_chart_data = {
|
||||||
|
datasets: [{
|
||||||
|
data: ['<?php echo $percent_disk_usage; ?>', 100 - '<?php echo $percent_disk_usage; ?>'],
|
||||||
|
backgroundColor: [disk_usage_chart_background_color,
|
||||||
|
'<?php echo $_SESSION['dashboard']['disk_usage_chart_sub_background_color']['text']; ?>'],
|
||||||
|
borderColor: '<?php echo $_SESSION['dashboard']['disk_usage_chart_border_color']['text']; ?>',
|
||||||
|
borderWidth: '<?php echo $_SESSION['dashboard']['disk_usage_chart_border_width']['text']; ?>',
|
||||||
|
cutout: chart_cutout
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
|
||||||
|
const disk_usage_chart_config = {
|
||||||
type: 'doughnut',
|
type: 'doughnut',
|
||||||
data: {
|
data: disk_usage_chart_data,
|
||||||
datasets: [{
|
|
||||||
data: ['<?php echo $percent_disk_usage; ?>', 100 - '<?php echo $percent_disk_usage; ?>'],
|
|
||||||
backgroundColor: [disk_chart_background_color, '#d4d4d4'],
|
|
||||||
borderColor: 'rgba(0,0,0,0)',
|
|
||||||
cutout: chart_cutout
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
options: {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
@@ -149,8 +161,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const disk_usage_chart = new Chart(
|
const disk_usage_chart = new Chart(
|
||||||
document.getElementById('disk_usage_chart'),
|
disk_usage_chart_context,
|
||||||
disk_chart_config
|
disk_usage_chart_config
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user