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

@@ -29,7 +29,7 @@ class AddEmpty extends Component
]);
return redirect()->route('project.show', $project->uuid);
} catch (\Throwable $e) {
general_error_handler($e, $this);
return handleError($e, $this);
} finally {
$this->name = '';
}

View File

@@ -32,7 +32,7 @@ class AddEnvironment extends Component
'environment_name' => $environment->name,
]);
} catch (\Throwable $e) {
general_error_handler($e, $this);
handleError($e, $this);
} finally {
$this->name = '';
}

View File

@@ -65,7 +65,7 @@ class DeploymentNavbar extends Component
]);
}
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -160,7 +160,7 @@ class General extends Component
$this->application->save();
$this->emit('success', 'Application settings updated!');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -30,7 +30,7 @@ class Previews extends Component
$this->pull_requests = $data->sortBy('number')->values();
} catch (\Throwable $e) {
$this->rate_limit_remaining = 0;
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -59,7 +59,7 @@ class Previews extends Component
'environment_name' => $this->parameters['environment_name'],
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -79,7 +79,7 @@ class Previews extends Component
ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->delete();
$this->application->refresh();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -65,7 +65,7 @@ class Rollback extends Component
];
})->toArray();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -43,7 +43,7 @@ class CreateScheduledBackup extends Component
]);
$this->emit('refreshScheduledBackups');
} catch (\Throwable $e) {
general_error_handler($e, $this);
handleError($e, $this);
} finally {
$this->frequency = '';
$this->save_s3 = true;

View File

@@ -35,7 +35,7 @@ class Heading extends Component
public function stop()
{
remote_process(
instant_remote_process(
["docker rm -f {$this->database->uuid}"],
$this->database->destination->server
);
@@ -45,7 +45,7 @@ class Heading extends Component
}
$this->database->status = 'stopped';
$this->database->save();
$this->emit('refresh');
$this->check_status();
// $this->database->environment->project->team->notify(new StatusChanged($this->database));
}

View File

@@ -36,7 +36,7 @@ class InitScript extends Component
$this->script['filename'] = $this->filename;
$this->emitUp('save_init_script', $this->script);
} catch (Exception $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -5,6 +5,7 @@ namespace App\Http\Livewire\Project\Database\Postgresql;
use App\Models\StandalonePostgresql;
use Exception;
use Livewire\Component;
use function Aws\filter;
class General extends Component
@@ -73,9 +74,9 @@ class General extends Component
}
$this->getDbUrl();
$this->database->save();
} catch(Exception $e) {
} catch(\Throwable $e) {
$this->database->is_public = !$this->database->is_public;
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
@@ -140,7 +141,7 @@ class General extends Component
$this->database->save();
$this->emit('success', 'Database updated successfully.');
} catch (Exception $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -20,7 +20,7 @@ class Edit extends Component
$this->project->save();
$this->emit('saved');
} catch (\Throwable $e) {
return general_error_handler($e, $this);
return handleError($e, $this);
}
}
}

View File

@@ -165,7 +165,7 @@ class GithubPrivateRepository extends Component
'project_uuid' => $project->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -118,7 +118,7 @@ class GithubPrivateRepositoryDeployKey extends Component
'application_uuid' => $application->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}

View File

@@ -76,14 +76,14 @@ class PublicGitRepository extends Component
$this->get_branch();
$this->selected_branch = $this->git_branch;
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
if (!$this->branch_found && $this->git_branch == 'main') {
try {
$this->git_branch = 'master';
$this->get_branch();
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}
@@ -162,7 +162,7 @@ class PublicGitRepository extends Component
'application_uuid' => $application->uuid,
]);
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -41,7 +41,7 @@ class Select extends Component
// instantCommand("psql {$this->existingPostgresqlUrl} -c 'SELECT 1'");
// $this->emit('success', 'Successfully connected to the database.');
// } catch (\Throwable $e) {
// return general_error_handler($e, $this);
// return handleError($e, $this);
// }
// }
public function setType(string $type)

View File

@@ -114,7 +114,7 @@ class All extends Component
$this->refreshEnvs();
$this->emit('success', 'Environment variable added successfully.');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -54,7 +54,7 @@ class ResourceLimits extends Component
$this->resource->save();
$this->emit('success', 'Resource limits updated successfully.');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}

View File

@@ -29,7 +29,7 @@ class All extends Component
$this->emit('success', 'Storage added successfully');
$this->emit('clearAddStorage');
} catch (\Throwable $e) {
return general_error_handler(err: $e, that: $this);
return handleError($e, $this);
}
}
}