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()
->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')

View file

@ -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([

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');
});
}
};