wip livewire migration
This commit is contained in:
@@ -27,7 +27,7 @@ class AddEmpty extends Component
|
||||
'description' => $this->description,
|
||||
'team_id' => currentTeam()->id,
|
||||
]);
|
||||
return redirect()->route('project.show', $project->uuid);
|
||||
return $this->redirectRoute('project.show', $project->uuid, navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
|
||||
@@ -27,10 +27,10 @@ class AddEnvironment extends Component
|
||||
'project_id' => $this->project->id,
|
||||
]);
|
||||
|
||||
return redirect()->route('project.resources', [
|
||||
return $this->redirectRoute('project.resources', [
|
||||
'project_uuid' => $this->project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
]);
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
handleError($e, $this);
|
||||
} finally {
|
||||
|
||||
@@ -15,15 +15,15 @@ class Configuration extends Component
|
||||
{
|
||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
return redirect()->route('dashboard');
|
||||
return $this->redirectRoute('dashboard', navigate: true);
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
if (!$environment) {
|
||||
return redirect()->route('dashboard');
|
||||
return $this->redirectRoute('dashboard', navigate: true);
|
||||
}
|
||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
||||
if (!$application) {
|
||||
return redirect()->route('dashboard');
|
||||
return $this->redirectRoute('dashboard', navigate: true);
|
||||
}
|
||||
$this->application = $application;
|
||||
$mainServer = $this->application->destination->server;
|
||||
|
||||
@@ -52,12 +52,12 @@ class Heading extends Component
|
||||
force_rebuild: false,
|
||||
is_new_deployment: true,
|
||||
);
|
||||
return redirect()->route('project.application.deployment', [
|
||||
return $this->redirectRoute('project.application.deployment', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $this->deploymentUuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
public function deploy(bool $force_rebuild = false)
|
||||
{
|
||||
@@ -101,12 +101,12 @@ class Heading extends Component
|
||||
restart_only: true,
|
||||
is_new_deployment: true,
|
||||
);
|
||||
return redirect()->route('project.application.deployment', [
|
||||
return $this->redirectRoute('project.application.deployment', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $this->deploymentUuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
public function restart()
|
||||
{
|
||||
@@ -116,11 +116,11 @@ class Heading extends Component
|
||||
deployment_uuid: $this->deploymentUuid,
|
||||
restart_only: true,
|
||||
);
|
||||
return redirect()->route('project.application.deployment', [
|
||||
return $this->redirectRoute('project.application.deployment', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $this->deploymentUuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ class Previews extends Component
|
||||
force_rebuild: true,
|
||||
pull_request_id: $pull_request_id,
|
||||
);
|
||||
return redirect()->route('project.application.deployment', [
|
||||
return $this->redirectRoute('project.application.deployment', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $this->deployment_uuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
]);
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -29,13 +29,12 @@ class Rollback extends Component
|
||||
commit: $commit,
|
||||
force_rebuild: false,
|
||||
);
|
||||
|
||||
return redirect()->route('project.application.deployment', [
|
||||
return $this->redirectRoute('project.application.deployment', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $deployment_uuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function loadImages($showToast = false)
|
||||
|
||||
@@ -148,10 +148,10 @@ class CloneProject extends Component
|
||||
}
|
||||
$newService->parse();
|
||||
}
|
||||
return redirect()->route('project.resources', [
|
||||
return $this->redirectRoute('project.resources', [
|
||||
'project_uuid' => $newProject->uuid,
|
||||
'environment_name' => $newEnvironment->name,
|
||||
]);
|
||||
], navigate: true);
|
||||
} catch (\Exception $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ class BackupEdit extends Component
|
||||
$url = $url->withoutQueryParameter('selectedBackupId');
|
||||
$url = $url->withFragment('backups');
|
||||
$url = $url->getPath() . "#{$url->getFragment()}";
|
||||
return redirect()->to($url);
|
||||
return $this->redirect($url,navigate: true);
|
||||
} else {
|
||||
redirect()->route('project.database.backups.all', $this->parameters);
|
||||
return $this->redirectRoute('project.database.backups.all', $this->parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class DeleteEnvironment extends Component
|
||||
$environment = Environment::findOrFail($this->environment_id);
|
||||
if ($environment->isEmpty()) {
|
||||
$environment->delete();
|
||||
return redirect()->route('project.show', ['project_uuid' => $this->parameters['project_uuid']]);
|
||||
return $this->redirectRoute('project.show', ['project_uuid' => $this->parameters['project_uuid']], navigate: true);
|
||||
}
|
||||
return $this->dispatch('error', 'Environment has defined resources, please delete them first.');
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ class DeleteProject extends Component
|
||||
return $this->dispatch('error', 'Project has resources defined, please delete them first.');
|
||||
}
|
||||
$project->delete();
|
||||
return redirect()->route('projects');
|
||||
return $this->redirectRoute('projects', navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,12 @@ class DockerCompose extends Component
|
||||
|
||||
$service->parse(isNew: true);
|
||||
|
||||
return redirect()->route('project.service.configuration', [
|
||||
return $this->redirectRoute('project.service.configuration', [
|
||||
'service_uuid' => $service->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -64,12 +64,11 @@ class DockerImage extends Component
|
||||
'name' => 'docker-image-' . $application->uuid,
|
||||
'fqdn' => $fqdn
|
||||
]);
|
||||
|
||||
redirect()->route('project.application.configuration', [
|
||||
return $this->redirectRoute('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,6 @@ class EmptyProject extends Component
|
||||
'name' => generate_random_name(),
|
||||
'team_id' => currentTeam()->id,
|
||||
]);
|
||||
return redirect()->route('project.show', ['project_uuid' => $project->uuid, 'environment_name' => 'production']);
|
||||
return $this->redirectRoute('project.show', ['project_uuid' => $project->uuid, 'environment_name' => 'production'], navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,11 @@ class GithubPrivateRepository extends Component
|
||||
$application->name = generate_application_name($this->selected_repository_owner . '/' . $this->selected_repository_repo, $this->selected_branch_name, $application->uuid);
|
||||
$application->save();
|
||||
|
||||
redirect()->route('project.application.configuration', [
|
||||
return $this->redirectRoute('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
$application->name = generate_random_name($application->uuid);
|
||||
$application->save();
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
return $this->redirectRoute('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
]);
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -184,11 +184,11 @@ class PublicGitRepository extends Component
|
||||
$application->fqdn = $fqdn;
|
||||
$application->save();
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
return $this->redirectRoute('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
]);
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ class Select extends Component
|
||||
|
||||
public function updatedSelectedEnvironment()
|
||||
{
|
||||
return redirect()->route('project.resources.new', [
|
||||
return $this->redirectRoute('project.resources.new', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->selectedEnvironment,
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
// public function addExistingPostgresql()
|
||||
@@ -133,13 +133,13 @@ class Select extends Component
|
||||
public function setDestination(string $destination_uuid)
|
||||
{
|
||||
$this->destination_uuid = $destination_uuid;
|
||||
redirect()->route('project.resources.new', [
|
||||
return $this->redirectRoute('project.resources.new', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
'type' => $this->type,
|
||||
'destination' => $this->destination_uuid,
|
||||
'server_id' => $this->server_id,
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
|
||||
public function loadServers()
|
||||
|
||||
@@ -70,10 +70,10 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
'fqdn' => $fqdn
|
||||
]);
|
||||
|
||||
redirect()->route('project.application.configuration', [
|
||||
return $this->redirectRoute('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
], navigate: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Application extends Component
|
||||
try {
|
||||
$this->application->delete();
|
||||
$this->dispatch('success', 'Application deleted successfully.');
|
||||
return redirect()->route('project.service.configuration', $this->parameters);
|
||||
return $this->redirectRoute('project.service.configuration', $this->parameters, navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ class Danger extends Component
|
||||
{
|
||||
try {
|
||||
DeleteResourceJob::dispatchSync($this->resource);
|
||||
return redirect()->route('project.resources', [
|
||||
return $this->redirectRoute('project.resources', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name']
|
||||
]);
|
||||
], navigate: true);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class GetLogs extends Component
|
||||
{
|
||||
public string $outputs = '';
|
||||
public string $errors = '';
|
||||
public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb $resource;
|
||||
public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|null $resource = null;
|
||||
public ServiceApplication|ServiceDatabase|null $servicesubtype = null;
|
||||
public Server $server;
|
||||
public ?string $container = null;
|
||||
@@ -29,13 +29,15 @@ class GetLogs extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
$this->showTimeStamps = $this->resource->settings->is_include_timestamps;
|
||||
} else {
|
||||
if ($this->servicesubtype) {
|
||||
$this->showTimeStamps = $this->servicesubtype->is_include_timestamps;
|
||||
if (!is_null($this->resource)) {
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
$this->showTimeStamps = $this->resource->settings->is_include_timestamps;
|
||||
} else {
|
||||
$this->showTimeStamps = $this->resource->is_include_timestamps;
|
||||
if ($this->servicesubtype) {
|
||||
$this->showTimeStamps = $this->servicesubtype->is_include_timestamps;
|
||||
} else {
|
||||
$this->showTimeStamps = $this->resource->is_include_timestamps;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,16 +47,18 @@ class GetLogs extends Component
|
||||
}
|
||||
public function instantSave()
|
||||
{
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
$this->resource->settings->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->resource->settings->save();
|
||||
} else {
|
||||
if ($this->servicesubtype) {
|
||||
$this->servicesubtype->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->servicesubtype->save();
|
||||
if (!is_null($this->resource)) {
|
||||
if ($this->resource->getMorphClass() === 'App\Models\Application') {
|
||||
$this->resource->settings->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->resource->settings->save();
|
||||
} else {
|
||||
$this->resource->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->resource->save();
|
||||
if ($this->servicesubtype) {
|
||||
$this->servicesubtype->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->servicesubtype->save();
|
||||
} else {
|
||||
$this->resource->is_include_timestamps = $this->showTimeStamps;
|
||||
$this->resource->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user