Skip to content

Commit 027b6ea

Browse files
committed
patch
1 parent 40d8ddc commit 027b6ea

2 files changed

Lines changed: 35 additions & 26 deletions

File tree

www/controllers/Layout/Container/vars/host/summary.vars.inc.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
$myhost = new \Controllers\Host\Host();
1212
$hostPackageController = new \Controllers\Host\Package\Package($id);
1313

14-
/**
15-
* Getting all informations about this host
16-
*/
14+
// Getting all informations about this host
1715
$hostProperties = $myhost->get($id);
18-
1916
$hostname = $hostProperties['Hostname'];
2017
$ip = $hostProperties['Ip'];
2118
$os = $hostProperties['Os'];
@@ -46,16 +43,15 @@
4643
$uptime = $interval->format('%a days, %h hours, %i minutes');
4744
}
4845

49-
/**
50-
* Last known agent state message
51-
*/
46+
// Last known agent state message
5247
$agentLastSendStatusMsg = 'state on ' . DateTime::createFromFormat('Y-m-d', $hostProperties['Online_status_date'])->format('d-m-Y') . ' at ' . $hostProperties['Online_status_time'];
5348

54-
/**
55-
* Checking that the last time the agent has sent his status was before 1h10m
56-
*/
49+
// Checking that the last time the agent has sent his status was before 1h10m
5750
if ($hostProperties['Online_status_date'] != DATE_YMD or $hostProperties['Online_status_time'] <= date('H:i:s', strtotime(date('H:i:s') . ' - 70 minutes'))) {
5851
$agentStatus = 'seems-stopped';
5952
}
6053

54+
// Check if the host is compliant
55+
$compliance = $myhost->getCompliance($id);
56+
6157
unset($myhost, $hostPackageController, $hostProperties);

www/views/includes/containers/host/summary.inc.php

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,39 @@
22
use \Controllers\User\Permission\Host as HostPermission; ?>
33

44
<section class="section-main reloadable-container" container="host/summary">
5-
<div id="title-button-div">
6-
<h3><?= strtoupper($hostname) ?></h3>
5+
<div class="margin-top-50 margin-bottom-40">
6+
<div class="flex flex-wrap justify-space-between column-gap-20 row-gap-15">
7+
<div class="flex align-item-center column-gap-10">
8+
<h3 class="margin-0"><?= strtoupper($hostname) ?></h3>
79

8-
<div class="flex justify-space-between">
9-
<?php
10-
if (HostPermission::allowedAction('reset')) : ?>
11-
<div id="host-reset-btn" class="slide-btn-yellow" host-id="<?= $id ?>" title="Reset host informations">
12-
<img src="/assets/icons/update.svg">
13-
<span>Reset</span>
10+
<div class="flex column-gap-8">
11+
<?php
12+
if ($compliance['compliant']) {
13+
echo '<img src="/assets/icons/check.svg" class="icon-np" title="Host is compliant" />';
14+
} else {
15+
echo '<img src="/assets/icons/warning-red.svg" class="icon-np" title="Host is not compliant: ' . strtolower($compliance['reason']) . '" />';
16+
} ?>
1417
</div>
15-
<?php
16-
endif;
18+
</div>
1719

18-
if (HostPermission::allowedAction('delete')) : ?>
19-
<div id="host-delete-btn" class="slide-btn-red" host-id="<?= $id ?>" title="Delete host">
20-
<img src="/assets/icons/delete.svg">
21-
<span>Delete</span>
22-
</div>
20+
<div class="flex justify-space-between">
2321
<?php
24-
endif ?>
22+
if (HostPermission::allowedAction('reset')) : ?>
23+
<div id="host-reset-btn" class="slide-btn-yellow" host-id="<?= $id ?>" title="Reset host informations">
24+
<img src="/assets/icons/update.svg">
25+
<span>Reset</span>
26+
</div>
27+
<?php
28+
endif;
29+
30+
if (HostPermission::allowedAction('delete')) : ?>
31+
<div id="host-delete-btn" class="slide-btn-red" host-id="<?= $id ?>" title="Delete host">
32+
<img src="/assets/icons/delete.svg">
33+
<span>Delete</span>
34+
</div>
35+
<?php
36+
endif ?>
37+
</div>
2538
</div>
2639
</div>
2740

0 commit comments

Comments
 (0)