fix: boarding

fix: error handling
fix: restarting state
This commit is contained in:
Andras Bacsai
2023-09-15 15:34:25 +02:00
parent fcf7c5ddd5
commit da4c2ee60f
71 changed files with 326 additions and 290 deletions

View File

@@ -51,12 +51,12 @@ class Form extends Component
public function validateServer()
{
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server);
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server, true);
if ($uptime) {
$this->uptime = $uptime;
$this->emit('success', 'Server is reachable!');
$this->emit('success', 'Server is reachable.');
} else {
$this->emit('error', 'Server is not reachable');
$this->emit('error', 'Server is not reachable.');
return;
}
if ($dockerVersion) {
@@ -64,10 +64,10 @@ class Form extends Component
$this->emit('proxyStatusUpdated');
$this->emit('success', 'Docker Engine 23+ is installed!');
} else {
$this->emit('error', 'Old (lower than 23) or no Docker version detected. Install Docker Engine on the General tab.');
$this->emit('error', 'No Docker Engine or older than 23 version installed.');
}
} catch (\Throwable $e) {
return general_error_handler($e, that: $this);
return handleError($e, $this, customErrorMessage: "Server is not reachable: ");
}
}
@@ -82,7 +82,7 @@ class Form extends Component
$this->server->delete();
return redirect()->route('server.all');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
public function submit()

View File

@@ -79,7 +79,7 @@ class ByIp extends Component
$server->settings->save();
return redirect()->route('server.show', $server->uuid);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
}

View File

@@ -56,7 +56,7 @@ class Proxy extends Component
setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server);
$this->emit('success', 'Proxy configuration saved.');
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
@@ -65,7 +65,7 @@ class Proxy extends Component
try {
$this->proxy_settings = resolve(CheckConfigurationSync::class)($this->server, true);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
@@ -75,7 +75,7 @@ class Proxy extends Component
ray('loadProxyConfiguration');
$this->proxy_settings = resolve(CheckConfigurationSync::class)($this->server);
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
}

View File

@@ -24,7 +24,7 @@ class Status extends Component
$this->emit('proxyStatusUpdated');
}
} catch (\Throwable $e) {
return general_error_handler(err: $e);
return handleError($e);
}
}
public function getProxyStatusWithNoti()

View File

@@ -18,7 +18,7 @@ class Show extends Component
return redirect()->route('server.all');
}
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
public function render()

View File

@@ -28,14 +28,14 @@ class ShowPrivateKey extends Component
]);
$this->server->refresh();
refresh_server_connection($this->server->privateKey);
return general_error_handler($e, that: $this);
return handleError($e, $this);
}
}
public function checkConnection()
{
try {
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server);
['uptime' => $uptime, 'dockerVersion' => $dockerVersion] = validateServer($this->server, true);
if ($uptime) {
$this->emit('success', 'Server is reachable with this private key.');
} else {
@@ -48,7 +48,7 @@ class ShowPrivateKey extends Component
$this->emit('error', 'Old (lower than 23) or no Docker version detected. Install Docker Engine on the General tab.');
}
} catch (\Throwable $e) {
throw new \Exception($e->getMessage());
return handleError($e, $this);
}
}