This commit is contained in:
Andras Bacsai
2023-06-22 09:38:44 +02:00
parent cfe9aed42a
commit d5d671bac1
5 changed files with 19 additions and 18 deletions

View File

@@ -13,12 +13,14 @@ class Show extends Component
public function scan()
{
$alreadyAddedNetworks = $this->server->standaloneDockers;
ray($alreadyAddedNetworks);
$networks = instant_remote_process(['docker network ls --format "{{json .}}"'], $this->server, false);
$this->networks = format_docker_command_output_to_json($networks)->filter(function ($network) {
return $network['Name'] !== 'bridge' && $network['Name'] !== 'host' && $network['Name'] !== 'none';
})->filter(function ($network) use ($alreadyAddedNetworks) {
return !$alreadyAddedNetworks->contains('network', $network['Name']);
});
if ($this->networks->count() === 0) {
$this->emit('success', 'No new networks found.');
}
}
}