-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Labels
Description
Hi! I have more than one gateway, so the dashboard shows all of them. I suggest to show the active one separately.
My suggestion to update Linux.php
file in case of using Linux:
public function getNetworkInfo(): array {
$result = [
'gateway' => '',
'current_gateway' => '',
'hostname' => \gethostname(),
];
if (function_exists('shell_exec')) {
$result['gateway'] = shell_exec('ip route | awk \'/default/ { print $3 }\'');
$result['current_gateway'] = shell_exec('ip route | awk \'/default/\' | awk \'/metric 1/\' | awk \'{ print $3 }\'');
}
return $result;
}
And in settings-admin.php
template file:
<div class="col col-12">
<?php p($l->t('Hostname:')); ?>
<span class="info"><?php p($_['networkinfo']['hostname']); ?></span>
</div>
<div class="col col-12">
<?php p($l->t('Gateways:')); ?>
<span class="info"><?php p($_['networkinfo']['gateway']); ?></span>
</div>
<div class="col col-12">
<?php p($l->t('Active gateway:')); ?>
<span class="info"><?php p($_['networkinfo']['current_gateway']); ?></span>
</div>
Of course, to update functions everywhere.