Skip to content

Commit

Permalink
If we are a collector, set the home link on the logo to the collector…
Browse files Browse the repository at this point in the history
… dashboard. If we are a collector, add a button on the top right side that staes which type of collector and provides a link to the collector dashboard.
  • Loading branch information
mark-unwin committed Feb 8, 2024
1 parent 50974db commit 45c985a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
20 changes: 11 additions & 9 deletions app/Views/dashboardsCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
include 'shared/collection_functions.php';
$every = '';
if (stripos($data[0]->{'hour'}, '*/') !== false) {
$every = str_replace('*/', '', $data[0]->{'hour'}) . ' hours';
}
if (stripos($data[0]->{'minute'}, '*/') !== false) {
$minute = str_replace('*/', '', $data[0]->{'minute'});
if ($every != "") {
$every .= ', ' . $minute . ' minutes';
} else {
$every = $minute . ' minutes';
if (!empty($data[0]) and $included[0]->attributes->type === 'collector') {
if (stripos($data[0]->{'hour'}, '*/') !== false) {
$every = str_replace('*/', '', $data[0]->{'hour'}) . ' hours';
}
if (stripos($data[0]->{'minute'}, '*/') !== false) {
$minute = str_replace('*/', '', $data[0]->{'minute'});
if ($every != "") {
$every .= ', ' . $minute . ' minutes';
} else {
$every = $minute . ' minutes';
}
}
}
?>
Expand Down
12 changes: 10 additions & 2 deletions app/Views/shared/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ function my_comparison($asort, $bsort)
$dashboard = (!empty($user->dashboard_id)) ? $user->dashboard_id : 1;
$homepage = url_to('dashboardsExecute', $dashboard);
}
if (!empty($config->servers)) {
$homepage = url_to('dashboardCollector');
}
?>
<!DOCTYPE html>
<html lang="en" class="h-100">
Expand Down Expand Up @@ -503,13 +506,18 @@ function my_comparison($asort, $bsort)

<!-- User -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarUser" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="color: white;">User: <?= htmlentities($user->name) ?></a>
<a class="nav-link dropdown-toggle" href="#" id="navbarUser" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="color: white;"><?= __('User') ?>: <?= htmlentities($user->name) ?></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="<?= url_to('usersRead', $user->id) ?>"><?= __('Preferences'); ?></a></li>
<li><a class="dropdown-item" href="<?= url_to('logoff') ?>" role="button"><?= __('Logout'); ?></a></li>
<!--<li><a class="dropdown-item debug" href="#"><?= __('Debug'); ?></a></li>-->
</ul>
</li>

<?php if (!empty($config->servers)) { ?>
<li class="nav-item">
<a href="<?= url_to('dashboardCollector') ?>" role="button" class="btn btn-primary"><?= $config->servers->type ?></a>
</li>
<?php } ?>
</ul>
</div>
</div>
Expand Down

0 comments on commit 45c985a

Please sign in to comment.