new uuid routes
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Livewire\Project;
|
||||
use App\Models\Project;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
class AddEmpty extends Component
|
||||
{
|
||||
@@ -22,6 +23,7 @@ class AddEmpty extends Component
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'team_id' => currentTeam()->id,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
|
||||
return redirect()->route('project.show', $project->uuid);
|
||||
|
||||
@@ -20,7 +20,7 @@ class Configuration extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Index extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class Previews extends Component
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $this->deployment_uuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
'environment_uuid' => $this->parameters['environment_uuid'],
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
|
||||
@@ -37,7 +37,7 @@ class Rollback extends Component
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
'deployment_uuid' => $deployment_uuid,
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
'environment_uuid' => $this->parameters['environment_uuid'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class CloneMe extends Component
|
||||
{
|
||||
public string $project_uuid;
|
||||
|
||||
public string $environment_name;
|
||||
public string $environment_uuid;
|
||||
|
||||
public int $project_id;
|
||||
|
||||
@@ -44,7 +44,7 @@ class CloneMe extends Component
|
||||
{
|
||||
$this->project_uuid = $project_uuid;
|
||||
$this->project = Project::where('uuid', $project_uuid)->firstOrFail();
|
||||
$this->environment = $this->project->environments->where('name', $this->environment_name)->first();
|
||||
$this->environment = $this->project->environments->where('uuid', $this->environment_uuid)->first();
|
||||
$this->project_id = $this->project->id;
|
||||
$this->servers = currentTeam()->servers;
|
||||
$this->newName = str($this->project->name.'-clone-'.(string) new Cuid2)->slug();
|
||||
@@ -89,6 +89,7 @@ class CloneMe extends Component
|
||||
if ($this->environment->name !== 'production') {
|
||||
$project->environments()->create([
|
||||
'name' => $this->environment->name,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
}
|
||||
$environment = $project->environments->where('name', $this->environment->name)->first();
|
||||
@@ -100,6 +101,7 @@ class CloneMe extends Component
|
||||
$project = $this->project;
|
||||
$environment = $this->project->environments()->create([
|
||||
'name' => $this->newName,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
}
|
||||
$applications = $this->environment->applications;
|
||||
@@ -183,7 +185,7 @@ class CloneMe extends Component
|
||||
|
||||
return redirect()->route('project.resource.index', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return handleError($e, $this);
|
||||
|
||||
@@ -22,7 +22,7 @@ class Execution extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Index extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class Index extends Component
|
||||
) {
|
||||
return redirect()->route('project.database.configuration', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'database_uuid' => $database->uuid,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class Configuration extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first()->load(['applications']);
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
@@ -23,11 +23,11 @@ class EnvironmentEdit extends Component
|
||||
#[Validate(['nullable', 'string', 'max:255'])]
|
||||
public ?string $description = null;
|
||||
|
||||
public function mount(string $project_uuid, string $environment_name)
|
||||
public function mount(string $project_uuid, string $environment_uuid)
|
||||
{
|
||||
try {
|
||||
$this->project = Project::ownedByCurrentTeam()->where('uuid', $project_uuid)->firstOrFail();
|
||||
$this->environment = $this->project->environments()->where('name', $environment_name)->firstOrFail();
|
||||
$this->environment = $this->project->environments()->where('uuid', $environment_uuid)->firstOrFail();
|
||||
$this->syncData();
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
@@ -52,7 +52,10 @@ class EnvironmentEdit extends Component
|
||||
{
|
||||
try {
|
||||
$this->syncData(true);
|
||||
$this->redirectRoute('project.environment.edit', ['environment_name' => $this->environment->name, 'project_uuid' => $this->project->uuid]);
|
||||
$this->redirectRoute('project.environment.edit', [
|
||||
'environment_uuid' => $this->environment->uuid,
|
||||
'project_uuid' => $this->project->uuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class DockerCompose extends Component
|
||||
}
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
|
||||
$destination_uuid = $this->query['destination'];
|
||||
$destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
|
||||
@@ -96,7 +96,7 @@ class DockerCompose extends Component
|
||||
|
||||
return redirect()->route('project.service.configuration', [
|
||||
'service_uuid' => $service->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -45,7 +45,7 @@ class DockerImage extends Component
|
||||
$destination_class = $destination->getMorphClass();
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
$application = Application::create([
|
||||
'name' => 'docker-image-'.new Cuid2,
|
||||
'repository_project_id' => 0,
|
||||
@@ -69,7 +69,7 @@ class DockerImage extends Component
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Livewire\Project\New;
|
||||
|
||||
use App\Models\Project;
|
||||
use Livewire\Component;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
class EmptyProject extends Component
|
||||
{
|
||||
@@ -12,8 +13,9 @@ class EmptyProject extends Component
|
||||
$project = Project::create([
|
||||
'name' => generate_random_name(),
|
||||
'team_id' => currentTeam()->id,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
|
||||
return redirect()->route('project.show', ['project_uuid' => $project->uuid, 'environment_name' => 'production']);
|
||||
return redirect()->route('project.show', ['project_uuid' => $project->uuid, 'environment_uuid' => $project->environments->first()->uuid]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class GithubPrivateRepository extends Component
|
||||
$destination_class = $destination->getMorphClass();
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
|
||||
$application = Application::create([
|
||||
'name' => generate_application_name($this->selected_repository_owner.'/'.$this->selected_repository_repo, $this->selected_branch_name),
|
||||
@@ -211,7 +211,7 @@ class GithubPrivateRepository extends Component
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -136,7 +136,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
$this->get_git_source();
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
if ($this->git_source === 'other') {
|
||||
$application_init = [
|
||||
'name' => generate_random_name(),
|
||||
@@ -184,7 +184,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -225,7 +225,7 @@ class PublicGitRepository extends Component
|
||||
$this->validate();
|
||||
$destination_uuid = $this->query['destination'];
|
||||
$project_uuid = $this->parameters['project_uuid'];
|
||||
$environment_name = $this->parameters['environment_name'];
|
||||
$environment_uuid = $this->parameters['environment_uuid'];
|
||||
|
||||
$destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
|
||||
if (! $destination) {
|
||||
@@ -237,7 +237,7 @@ class PublicGitRepository extends Component
|
||||
$destination_class = $destination->getMorphClass();
|
||||
|
||||
$project = Project::where('uuid', $project_uuid)->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $environment_name)->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $environment_uuid)->first();
|
||||
|
||||
if ($this->build_pack === 'dockercompose' && isDev() && $this->new_compose_services) {
|
||||
$server = $destination->server;
|
||||
@@ -260,7 +260,7 @@ class PublicGitRepository extends Component
|
||||
|
||||
return redirect()->route('project.service.configuration', [
|
||||
'service_uuid' => $service->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
|
||||
@@ -319,7 +319,7 @@ class PublicGitRepository extends Component
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
@@ -61,7 +61,7 @@ class Select extends Component
|
||||
}
|
||||
$projectUuid = data_get($this->parameters, 'project_uuid');
|
||||
$this->environments = Project::whereUuid($projectUuid)->first()->environments;
|
||||
$this->selectedEnvironment = data_get($this->parameters, 'environment_name');
|
||||
$this->selectedEnvironment = data_get($this->parameters, 'environment_uuid');
|
||||
}
|
||||
|
||||
public function render()
|
||||
@@ -73,20 +73,10 @@ class Select extends Component
|
||||
{
|
||||
return redirect()->route('project.resource.create', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->selectedEnvironment,
|
||||
'environment_uuid' => $this->selectedEnvironment,
|
||||
]);
|
||||
}
|
||||
|
||||
// public function addExistingPostgresql()
|
||||
// {
|
||||
// try {
|
||||
// instantCommand("psql {$this->existingPostgresqlUrl} -c 'SELECT 1'");
|
||||
// $this->dispatch('success', 'Successfully connected to the database.');
|
||||
// } catch (\Throwable $e) {
|
||||
// return handleError($e, $this);
|
||||
// }
|
||||
// }
|
||||
|
||||
public function loadServices()
|
||||
{
|
||||
$services = get_service_templates(true);
|
||||
@@ -304,7 +294,7 @@ class Select extends Component
|
||||
|
||||
return redirect()->route('project.resource.create', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
'environment_uuid' => $this->parameters['environment_uuid'],
|
||||
'type' => $this->type,
|
||||
'destination' => $this->destination_uuid,
|
||||
'server_id' => $this->server_id,
|
||||
@@ -319,7 +309,7 @@ class Select extends Component
|
||||
} else {
|
||||
return redirect()->route('project.resource.create', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name'],
|
||||
'environment_uuid' => $this->parameters['environment_uuid'],
|
||||
'type' => $this->type,
|
||||
'destination' => $this->destination_uuid,
|
||||
'server_id' => $this->server_id,
|
||||
|
||||
@@ -46,7 +46,7 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
$destination_class = $destination->getMorphClass();
|
||||
|
||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', $this->parameters['environment_uuid'])->first();
|
||||
|
||||
$port = get_port_from_dockerfile($this->dockerfile);
|
||||
if (! $port) {
|
||||
@@ -78,7 +78,7 @@ CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
return redirect()->route('project.application.configuration', [
|
||||
'application_uuid' => $application->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class Create extends Component
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->project = $project;
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first();
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class Create extends Component
|
||||
|
||||
return redirect()->route('project.database.configuration', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'database_uuid' => $database->uuid,
|
||||
]);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class Create extends Component
|
||||
|
||||
return redirect()->route('project.service.configuration', [
|
||||
'service_uuid' => $service->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
'environment_uuid' => $environment->uuid,
|
||||
'project_uuid' => $project->uuid,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Index extends Component
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
|
||||
$environment = $project->load(['environments'])->environments->where('uuid', request()->route('environment_uuid'))->first();
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class Index extends Component
|
||||
if (data_get($application, 'environment.project.uuid')) {
|
||||
$application->hrefLink = route('project.application.configuration', [
|
||||
'project_uuid' => data_get($application, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($application, 'environment.name'),
|
||||
'environment_uuid' => data_get($application, 'environment.uuid'),
|
||||
'application_uuid' => data_get($application, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class Index extends Component
|
||||
if (data_get($postgresql, 'environment.project.uuid')) {
|
||||
$postgresql->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($postgresql, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($postgresql, 'environment.name'),
|
||||
'environment_uuid' => data_get($postgresql, 'environment.uuid'),
|
||||
'database_uuid' => data_get($postgresql, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class Index extends Component
|
||||
if (data_get($redis, 'environment.project.uuid')) {
|
||||
$redis->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($redis, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($redis, 'environment.name'),
|
||||
'environment_uuid' => data_get($redis, 'environment.uuid'),
|
||||
'database_uuid' => data_get($redis, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ class Index extends Component
|
||||
if (data_get($mongodb, 'environment.project.uuid')) {
|
||||
$mongodb->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($mongodb, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($mongodb, 'environment.name'),
|
||||
'environment_uuid' => data_get($mongodb, 'environment.uuid'),
|
||||
'database_uuid' => data_get($mongodb, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class Index extends Component
|
||||
if (data_get($mysql, 'environment.project.uuid')) {
|
||||
$mysql->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($mysql, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($mysql, 'environment.name'),
|
||||
'environment_uuid' => data_get($mysql, 'environment.uuid'),
|
||||
'database_uuid' => data_get($mysql, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ class Index extends Component
|
||||
if (data_get($mariadb, 'environment.project.uuid')) {
|
||||
$mariadb->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($mariadb, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($mariadb, 'environment.name'),
|
||||
'environment_uuid' => data_get($mariadb, 'environment.uuid'),
|
||||
'database_uuid' => data_get($mariadb, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class Index extends Component
|
||||
if (data_get($keydb, 'environment.project.uuid')) {
|
||||
$keydb->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($keydb, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($keydb, 'environment.name'),
|
||||
'environment_uuid' => data_get($keydb, 'environment.uuid'),
|
||||
'database_uuid' => data_get($keydb, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class Index extends Component
|
||||
if (data_get($dragonfly, 'environment.project.uuid')) {
|
||||
$dragonfly->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($dragonfly, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($dragonfly, 'environment.name'),
|
||||
'environment_uuid' => data_get($dragonfly, 'environment.uuid'),
|
||||
'database_uuid' => data_get($dragonfly, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ class Index extends Component
|
||||
if (data_get($clickhouse, 'environment.project.uuid')) {
|
||||
$clickhouse->hrefLink = route('project.database.configuration', [
|
||||
'project_uuid' => data_get($clickhouse, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($clickhouse, 'environment.name'),
|
||||
'environment_uuid' => data_get($clickhouse, 'environment.uuid'),
|
||||
'database_uuid' => data_get($clickhouse, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class Index extends Component
|
||||
if (data_get($service, 'environment.project.uuid')) {
|
||||
$service->hrefLink = route('project.service.configuration', [
|
||||
'project_uuid' => data_get($service, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($service, 'environment.name'),
|
||||
'environment_uuid' => data_get($service, 'environment.uuid'),
|
||||
'service_uuid' => data_get($service, 'uuid'),
|
||||
]);
|
||||
$service->status = $service->status();
|
||||
|
||||
@@ -20,7 +20,7 @@ class Danger extends Component
|
||||
|
||||
public $projectUuid;
|
||||
|
||||
public $environmentName;
|
||||
public $environmentUuid;
|
||||
|
||||
public bool $delete_configurations = true;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Danger extends Component
|
||||
$parameters = get_route_parameters();
|
||||
$this->modalId = new Cuid2;
|
||||
$this->projectUuid = data_get($parameters, 'project_uuid');
|
||||
$this->environmentName = data_get($parameters, 'environment_name');
|
||||
$this->environmentUuid = data_get($parameters, 'environment_uuid');
|
||||
|
||||
if ($this->resource === null) {
|
||||
if (isset($parameters['service_uuid'])) {
|
||||
@@ -107,7 +107,7 @@ class Danger extends Component
|
||||
|
||||
return redirect()->route('project.resource.index', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_name' => $this->environmentName,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
|
||||
@@ -85,7 +85,7 @@ class Destination extends Component
|
||||
'project_uuid' => data_get($this->resource, 'environment.project.uuid'),
|
||||
'application_uuid' => data_get($this->resource, 'uuid'),
|
||||
'deployment_uuid' => $deployment_uuid,
|
||||
'environment_name' => data_get($this->resource, 'environment.name'),
|
||||
'environment_uuid' => data_get($this->resource, 'environment.uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class ResourceOperations extends Component
|
||||
|
||||
public $projectUuid;
|
||||
|
||||
public $environmentName;
|
||||
public $environmentUuid;
|
||||
|
||||
public $projects;
|
||||
|
||||
@@ -25,7 +25,7 @@ class ResourceOperations extends Component
|
||||
{
|
||||
$parameters = get_route_parameters();
|
||||
$this->projectUuid = data_get($parameters, 'project_uuid');
|
||||
$this->environmentName = data_get($parameters, 'environment_name');
|
||||
$this->environmentUuid = data_get($parameters, 'environment_uuid');
|
||||
$this->projects = Project::ownedByCurrentTeam()->get();
|
||||
$this->servers = currentTeam()->servers;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class ResourceOperations extends Component
|
||||
}
|
||||
$route = route('project.application.configuration', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_name' => $this->environmentName,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
'application_uuid' => $new_resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
@@ -115,7 +115,7 @@ class ResourceOperations extends Component
|
||||
}
|
||||
$route = route('project.database.configuration', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_name' => $this->environmentName,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
'database_uuid' => $new_resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
@@ -141,7 +141,7 @@ class ResourceOperations extends Component
|
||||
$new_resource->parse();
|
||||
$route = route('project.service.configuration', [
|
||||
'project_uuid' => $this->projectUuid,
|
||||
'environment_name' => $this->environmentName,
|
||||
'environment_uuid' => $this->environmentUuid,
|
||||
'service_uuid' => $new_resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
@@ -159,7 +159,7 @@ class ResourceOperations extends Component
|
||||
if ($this->resource->type() === 'application') {
|
||||
$route = route('project.application.configuration', [
|
||||
'project_uuid' => $new_environment->project->uuid,
|
||||
'environment_name' => $new_environment->name,
|
||||
'environment_uuid' => $new_environment->uuid,
|
||||
'application_uuid' => $this->resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
@@ -167,7 +167,7 @@ class ResourceOperations extends Component
|
||||
} elseif (str($this->resource->type())->startsWith('standalone-')) {
|
||||
$route = route('project.database.configuration', [
|
||||
'project_uuid' => $new_environment->project->uuid,
|
||||
'environment_name' => $new_environment->name,
|
||||
'environment_uuid' => $new_environment->uuid,
|
||||
'database_uuid' => $this->resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
@@ -175,7 +175,7 @@ class ResourceOperations extends Component
|
||||
} elseif ($this->resource->type() === 'service') {
|
||||
$route = route('project.service.configuration', [
|
||||
'project_uuid' => $new_environment->project->uuid,
|
||||
'environment_name' => $new_environment->name,
|
||||
'environment_uuid' => $new_environment->uuid,
|
||||
'service_uuid' => $this->resource->uuid,
|
||||
]).'#resource-operations';
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ class Show extends Component
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->project = Project::ownedByCurrentTeam()->where('uuid', request()->route('project_uuid'))->first();
|
||||
$this->environment = $this->project->environments()->where('name', request()->route('environment_name'))->first();
|
||||
$this->project = Project::ownedByCurrentTeam()->where('uuid', request()->route('project_uuid'))->firstOrFail();
|
||||
$this->environment = $this->project->environments()->where('uuid', request()->route('environment_uuid'))->firstOrFail();
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
@@ -116,14 +116,14 @@ class Change extends Component
|
||||
} else {
|
||||
$parameters = data_get(session('from'), 'parameters');
|
||||
$back = data_get(session('from'), 'back');
|
||||
$environment_name = data_get($parameters, 'environment_name');
|
||||
$environment_uuid = data_get($parameters, 'environment_uuid');
|
||||
$project_uuid = data_get($parameters, 'project_uuid');
|
||||
$type = data_get($parameters, 'type');
|
||||
$destination = data_get($parameters, 'destination');
|
||||
session()->forget('from');
|
||||
|
||||
return redirect()->route($back, [
|
||||
'environment_name' => $environment_name,
|
||||
'environment_uuid' => $environment_uuid,
|
||||
'project_uuid' => $project_uuid,
|
||||
'type' => $type,
|
||||
'destination' => $destination,
|
||||
|
||||
@@ -318,7 +318,7 @@ class Application extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.application.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'application_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class Application extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
$route = route('project.application.scheduled-tasks', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'application_uuid' => data_get($this, 'uuid'),
|
||||
'task_uuid' => $task_uuid,
|
||||
]);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use OpenApi\Attributes as OA;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
#[OA\Schema(
|
||||
description: 'Project model',
|
||||
@@ -24,8 +25,6 @@ class Project extends BaseModel
|
||||
{
|
||||
protected $guarded = [];
|
||||
|
||||
protected $appends = ['default_environment'];
|
||||
|
||||
public static function ownedByCurrentTeam()
|
||||
{
|
||||
return Project::whereTeamId(currentTeam()->id)->orderByRaw('LOWER(name)');
|
||||
@@ -40,6 +39,7 @@ class Project extends BaseModel
|
||||
Environment::create([
|
||||
'name' => 'production',
|
||||
'project_id' => $project->id,
|
||||
'uuid' => (string) new Cuid2,
|
||||
]);
|
||||
});
|
||||
static::deleting(function ($project) {
|
||||
@@ -140,18 +140,4 @@ class Project extends BaseModel
|
||||
{
|
||||
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
|
||||
}
|
||||
|
||||
public function getDefaultEnvironmentAttribute()
|
||||
{
|
||||
$default = $this->environments()->where('name', 'production')->first();
|
||||
if ($default) {
|
||||
return $default->name;
|
||||
}
|
||||
$default = $this->environments()->get();
|
||||
if ($default->count() > 0) {
|
||||
return $default->sortBy('created_at')->first()->name;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ class Service extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.service.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'service_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
@@ -1145,7 +1145,7 @@ class Service extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
$route = route('project.service.scheduled-tasks', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'service_uuid' => data_get($this, 'uuid'),
|
||||
'task_uuid' => $task_uuid,
|
||||
]);
|
||||
|
||||
@@ -169,7 +169,7 @@ class StandaloneClickhouse extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneDragonfly extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneKeydb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class StandaloneMariadb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ class StandaloneMongodb extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ class StandaloneMysql extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class StandalonePostgresql extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class StandaloneRedis extends BaseModel
|
||||
if (data_get($this, 'environment.project.uuid')) {
|
||||
return route('project.database.configuration', [
|
||||
'project_uuid' => data_get($this, 'environment.project.uuid'),
|
||||
'environment_name' => data_get($this, 'environment.name'),
|
||||
'environment_uuid' => data_get($this, 'environment.uuid'),
|
||||
'database_uuid' => data_get($this, 'uuid'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<a class="text-xs truncate lg:text-sm"
|
||||
href="{{ route('project.resource.index', ['environment_name' => $this->parameters['environment_name'], 'project_uuid' => $this->parameters['project_uuid']]) }}">{{ $this->parameters['environment_name'] }}</a>
|
||||
href="{{ route('project.resource.index', ['environment_uuid' => $this->parameters['environment_uuid'], 'project_uuid' => $this->parameters['project_uuid']]) }}">
|
||||
{{ data_get($resource, 'environment.name', $this->parameters['environment_uuid']) }}
|
||||
</a>
|
||||
<svg aria-hidden="true" class="w-4 h-4 mx-1 font-bold dark:text-warning" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<a class="text-xs truncate lg:text-sm"
|
||||
href="{{ route('project.resource.index', ['environment_name' => $environment->name, 'project_uuid' => $project->uuid]) }}">
|
||||
href="{{ route('project.resource.index', ['environment_uuid' => $environment->uuid, 'project_uuid' => $project->uuid]) }}">
|
||||
{{ $environment->name }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
<h1>Resources</h1>
|
||||
@if ($environment->isEmpty())
|
||||
<a class="button"
|
||||
href="{{ route('project.clone-me', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($parameters, 'environment_name')]) }}">
|
||||
href="{{ route('project.clone-me', ['project_uuid' => data_get($project, 'uuid'), 'environment_uuid' => data_get($environment, 'uuid')]) }}">
|
||||
Clone
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route('project.resource.create', ['project_uuid' => data_get($parameters, 'project_uuid'), 'environment_name' => data_get($parameters, 'environment_name')]) }} "
|
||||
<a href="{{ route('project.resource.create', ['project_uuid' => data_get($parameters, 'project_uuid'), 'environment_uuid' => data_get($environment, 'uuid')]) }}"
|
||||
class="button">+
|
||||
New</a>
|
||||
<a class="button"
|
||||
href="{{ route('project.clone-me', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($parameters, 'environment_name')]) }}">
|
||||
href="{{ route('project.clone-me', ['project_uuid' => data_get($project, 'uuid'), 'environment_uuid' => data_get($environment, 'uuid')]) }}">
|
||||
Clone
|
||||
</a>
|
||||
@endif
|
||||
@@ -44,7 +44,7 @@
|
||||
</nav>
|
||||
</div>
|
||||
@if ($environment->isEmpty())
|
||||
<a href="{{ route('project.resource.create', ['project_uuid' => data_get($parameters, 'project_uuid'), 'environment_name' => data_get($parameters, 'environment_name')]) }} "
|
||||
<a href="{{ route('project.resource.create', ['project_uuid' => data_get($parameters, 'project_uuid'), 'environment_uuid' => data_get($environment, 'uuid')]) }}"
|
||||
class="items-center justify-center box">+ Add New Resource</a>
|
||||
@else
|
||||
<div x-data="searchComponent()">
|
||||
|
||||
Reference in New Issue
Block a user