mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 00:50:32 +00:00
update
This commit is contained in:
parent
a0b96b6d95
commit
08f84c2829
7 changed files with 118 additions and 31 deletions
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Pages;
|
||||
|
||||
use App\GitClient;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Wizard;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Pages\Page;
|
||||
|
||||
class CloneGitRepository extends Page
|
||||
{
|
||||
|
||||
protected static ?string $navigationLabel = 'Clone Git Repository';
|
||||
|
||||
protected static string $view = 'customer::filament.pages.clone-git-repository';
|
||||
|
||||
protected static ?string $slug = 'git-repositories/clone';
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Clone Git Repository';
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->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()
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -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'),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Customer\App\Filament\Resources\GitRepositoryResource\Pages;
|
||||
|
||||
use Modules\Customer\App\Filament\Resources\GitRepositoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGitRepository extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GitRepositoryResource::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'Clone Git Repository';
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Clone Git Repository';
|
||||
}
|
||||
}
|
|
@ -13,7 +13,10 @@ class ListGitRepositories extends ListRecords
|
|||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('clone_new_repository')
|
||||
->label('Clone New Repository')
|
||||
->url('/customer/git-repositories/clone')
|
||||
->icon('heroicon-o-plus'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
|
||||
<x-filament-panels::page>
|
||||
|
||||
<div class="mt-4">
|
||||
{{$this->form}}
|
||||
</div>
|
||||
|
||||
</x-filament-panels::page>
|
|
@ -20,5 +20,7 @@ class GitRepository extends Model
|
|||
'status_message',
|
||||
'dir',
|
||||
'domain_id',
|
||||
'git_ssh_key_id',
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue