This commit is contained in:
Bozhidar 2024-10-01 13:31:40 +03:00
parent 5d2f2c0c9b
commit 6218b9f602
3 changed files with 87 additions and 40 deletions

View file

@ -79,47 +79,47 @@ class CloneGitRepository extends Page
->columnSpanFull() ->columnSpanFull()
->placeholder('Enter the name of the repository'), ->placeholder('Enter the name of the repository'),
Radio::make('clone_from') // Radio::make('clone_from')
->label('Clone from') // ->label('Clone from')
->options([ // ->options([
'branch' => 'Branch', // 'branch' => 'Branch',
'tag' => 'Tag', // 'tag' => 'Tag',
]) // ])
->live() // ->live()
->columnSpanFull(), // ->columnSpanFull(),
Select::make('branch') // Select::make('branch')
->label('Branch') // ->label('Branch')
->required() // ->required()
->hidden(function (Get $get) { // ->hidden(function (Get $get) {
return $get('clone_from') !== 'branch'; // return $get('clone_from') !== 'branch';
}) // })
->options(function (Get $get) { // ->options(function (Get $get) {
$url = $get('url'); // $url = $get('url');
$repoDetails = GitClient::getRepoDetailsByUrl($url); // $repoDetails = GitClient::getRepoDetailsByUrl($url);
if (isset($repoDetails['name'])) { // if (isset($repoDetails['name'])) {
return $repoDetails['branches']; // return $repoDetails['branches'];
} // }
}) // })
->live() // ->live()
->columnSpanFull() // ->columnSpanFull()
->placeholder('Enter the branch of the repository'), // ->placeholder('Enter the branch of the repository'),
//
Select::make('tag') // Select::make('tag')
->label('Tag') // ->label('Tag')
->live() // ->live()
->hidden(function (Get $get) { // ->hidden(function (Get $get) {
return $get('clone_from') !== 'tag'; // return $get('clone_from') !== 'tag';
}) // })
->options(function (Get $get) { // ->options(function (Get $get) {
$url = $get('url'); // $url = $get('url');
$repoDetails = GitClient::getRepoDetailsByUrl($url); // $repoDetails = GitClient::getRepoDetailsByUrl($url);
if (isset($repoDetails['name'])) { // if (isset($repoDetails['name'])) {
return $repoDetails['tags']; // return $repoDetails['tags'];
} // }
}) // })
->columnSpanFull() // ->columnSpanFull()
->placeholder('Enter the tag of the repository'), // ->placeholder('Enter the tag of the repository'),
]), ]),
Wizard\Step::make('Clone to') Wizard\Step::make('Clone to')

View file

@ -104,6 +104,22 @@ class GitRepositoryResource extends Resource
$gitRepository->pull(); $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(), Tables\Actions\DeleteAction::make(),
]) ])
->bulkActions([ ->bulkActions([

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('git_repositories', function (Blueprint $table) {
$table->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');
});
}
};