diff --git a/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php b/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php new file mode 100644 index 0000000..79d32cf --- /dev/null +++ b/web/Modules/Customer/App/Filament/Pages/CloneGitRepository.php @@ -0,0 +1,71 @@ +schema([ + + Wizard::make([ + Wizard\Step::make('Repository') + ->schema([ + TextInput::make('url') + ->label('URL') + ->required() + ->columnSpanFull() + ->live() + ->afterStateUpdated(function ($state, Set $set) { + $repoDetails = GitClient::getRepoDetailsByUrl($state); + if (isset($repoDetails['name'])) { + $set('name', $repoDetails['owner'] .'/'. $repoDetails['name']); + } + }) + ->placeholder('Enter the URL of the repository'), + + Select::make('git_ssh_key_id') + ->label('SSH Key') + ->options(\App\Models\GitSshKey::all()->pluck('name', 'id')) + ->columnSpanFull() + ->live() + ->required(), + + + ]), + Wizard\Step::make('Delivery') + ->schema([ + // ... + ]), + Wizard\Step::make('Billing') + ->schema([ + // ... + ]), + ])->columnSpanFull() + + ]); + } +} diff --git a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php b/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php index 75680cc..8be6827 100644 --- a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php +++ b/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource.php @@ -23,23 +23,44 @@ class GitRepositoryResource extends Resource protected static ?string $navigationGroup = 'Git'; + public static function form(Form $form): Form { return $form ->schema([ - Forms\Components\TextInput::make('url') - ->label('URL') - ->required() + Forms\Components\Wizard::make([ + Forms\Components\Wizard\Step::make('Order') + ->schema([ + // ... + ]), + Forms\Components\Wizard\Step::make('Delivery') + ->schema([ + // ... + ]), + Forms\Components\Wizard\Step::make('Billing') + ->schema([ + // ... + ]), + ])->columnSpanFull() + + ]); + } + + public static function ___form(Form $form): Form + { + $gitSSHKeys = \App\Models\GitSshKey::all()->pluck('name', 'id'); + return $form + ->schema([ + + Forms\Components\Select::make('git_ssh_key_id') + ->label('SSH Key') + ->options($gitSSHKeys) ->columnSpanFull() ->live() - ->afterStateUpdated(function ($state, Forms\Set $set) use (&$branches, &$tags) { - $repoDetails = GitClient::getRepoDetailsByUrl($state); - if (isset($repoDetails['name'])) { - $set('name', $repoDetails['owner'] .'/'. $repoDetails['name']); - } - }) - ->placeholder('Enter the URL of the repository'), + ->required(), + + Forms\Components\TextInput::make('name') @@ -113,7 +134,6 @@ class GitRepositoryResource extends Resource { return [ 'index' => Pages\ListGitRepositories::route('/'), - 'create' => Pages\CreateGitRepository::route('/create'), 'edit' => Pages\EditGitRepository::route('/{record}/edit'), ]; } diff --git a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource/Pages/CreateGitRepository.php b/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource/Pages/CreateGitRepository.php deleted file mode 100644 index 7051436..0000000 --- a/web/Modules/Customer/App/Filament/Resources/GitRepositoryResource/Pages/CreateGitRepository.php +++ /dev/null @@ -1,19 +0,0 @@ -label('Clone New Repository') + ->url('/customer/git-repositories/clone') + ->icon('heroicon-o-plus'), ]; } } diff --git a/web/Modules/Customer/resources/views/filament/pages/clone-git-repository.blade.php b/web/Modules/Customer/resources/views/filament/pages/clone-git-repository.blade.php new file mode 100644 index 0000000..e7799d4 --- /dev/null +++ b/web/Modules/Customer/resources/views/filament/pages/clone-git-repository.blade.php @@ -0,0 +1,9 @@ + + + + +
+ {{$this->form}} +
+ +
diff --git a/web/app/Models/GitRepository.php b/web/app/Models/GitRepository.php index f2e5f3e..6786268 100644 --- a/web/app/Models/GitRepository.php +++ b/web/app/Models/GitRepository.php @@ -20,5 +20,7 @@ class GitRepository extends Model 'status_message', 'dir', 'domain_id', + 'git_ssh_key_id', ]; + } diff --git a/web/database/migrations/2024_09_10_142433_create_git_repositories_table.php b/web/database/migrations/2024_09_10_142433_create_git_repositories_table.php index 0f4b043..c32dd2f 100644 --- a/web/database/migrations/2024_09_10_142433_create_git_repositories_table.php +++ b/web/database/migrations/2024_09_10_142433_create_git_repositories_table.php @@ -27,6 +27,7 @@ return new class extends Migration $table->string('dir')->nullable(); $table->unsignedBigInteger('domain_id'); + $table->unsignedBigInteger('git_ssh_key_id'); $table->timestamps(); });