From 6218b9f6024b47f865b1065503034b5049d12743 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Tue, 1 Oct 2024 13:31:40 +0300 Subject: [PATCH] update --- .../App/Filament/Pages/CloneGitRepository.php | 80 +++++++++---------- .../Resources/GitRepositoryResource.php | 16 ++++ ...eploy_script_to_git_repositories_table.php | 31 +++++++ 3 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 web/database/migrations/2024_09_10_142433_add_deploy_script_to_git_repositories_table.php diff --git a/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php b/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php index 5fa6fe8..ddeb32b 100644 --- a/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php +++ b/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php @@ -79,47 +79,47 @@ class CloneGitRepository extends Page ->columnSpanFull() ->placeholder('Enter the name of the repository'), - Radio::make('clone_from') - ->label('Clone from') - ->options([ - 'branch' => 'Branch', - 'tag' => 'Tag', - ]) - ->live() - ->columnSpanFull(), +// Radio::make('clone_from') +// ->label('Clone from') +// ->options([ +// 'branch' => 'Branch', +// 'tag' => 'Tag', +// ]) +// ->live() +// ->columnSpanFull(), - Select::make('branch') - ->label('Branch') - ->required() - ->hidden(function (Get $get) { - return $get('clone_from') !== 'branch'; - }) - ->options(function (Get $get) { - $url = $get('url'); - $repoDetails = GitClient::getRepoDetailsByUrl($url); - if (isset($repoDetails['name'])) { - return $repoDetails['branches']; - } - }) - ->live() - ->columnSpanFull() - ->placeholder('Enter the branch of the repository'), - - Select::make('tag') - ->label('Tag') - ->live() - ->hidden(function (Get $get) { - return $get('clone_from') !== 'tag'; - }) - ->options(function (Get $get) { - $url = $get('url'); - $repoDetails = GitClient::getRepoDetailsByUrl($url); - if (isset($repoDetails['name'])) { - return $repoDetails['tags']; - } - }) - ->columnSpanFull() - ->placeholder('Enter the tag of the repository'), +// Select::make('branch') +// ->label('Branch') +// ->required() +// ->hidden(function (Get $get) { +// return $get('clone_from') !== 'branch'; +// }) +// ->options(function (Get $get) { +// $url = $get('url'); +// $repoDetails = GitClient::getRepoDetailsByUrl($url); +// if (isset($repoDetails['name'])) { +// return $repoDetails['branches']; +// } +// }) +// ->live() +// ->columnSpanFull() +// ->placeholder('Enter the branch of the repository'), +// +// Select::make('tag') +// ->label('Tag') +// ->live() +// ->hidden(function (Get $get) { +// return $get('clone_from') !== 'tag'; +// }) +// ->options(function (Get $get) { +// $url = $get('url'); +// $repoDetails = GitClient::getRepoDetailsByUrl($url); +// if (isset($repoDetails['name'])) { +// return $repoDetails['tags']; +// } +// }) +// ->columnSpanFull() +// ->placeholder('Enter the tag of the repository'), ]), Wizard\Step::make('Clone to') diff --git a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php b/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php index 57dc1dc..85d9bf7 100644 --- a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php +++ b/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php @@ -104,6 +104,22 @@ class GitRepositoryResource extends Resource $gitRepository->pull(); }), + + Tables\Actions\EditAction::make('deploy') + ->label('Deploy') + ->icon('heroicon-o-command-line') + ->form([ + Forms\Components\Textarea::make('deployment_script') + ->label('Deployment script') + ->required() + ->rows(15) + ->columnSpanFull(), + Forms\Components\Toggle::make('quick_deploy') + ->label('Quick deploy') + ->columnSpanFull(), + ]), + + Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ diff --git a/web/database/migrations/2024_09_10_142433_add_deploy_script_to_git_repositories_table.php b/web/database/migrations/2024_09_10_142433_add_deploy_script_to_git_repositories_table.php new file mode 100644 index 0000000..e922c3a --- /dev/null +++ b/web/database/migrations/2024_09_10_142433_add_deploy_script_to_git_repositories_table.php @@ -0,0 +1,31 @@ +longText('deployment_script')->nullable(); + $table->tinyInteger('quick_deploy')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('git_repositories', function (Blueprint $table) { + $table->dropColumn('deployment_script'); + }); + } +};