mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
update
This commit is contained in:
parent
08f84c2829
commit
14b939fa8e
2 changed files with 77 additions and 47 deletions
|
@ -3,10 +3,12 @@
|
|||
namespace Modules\Customer\App\Filament\Pages;
|
||||
|
||||
use App\GitClient;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Wizard;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Forms\Get;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Pages\Page;
|
||||
|
||||
|
@ -21,6 +23,13 @@ class CloneGitRepository extends Page
|
|||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
public $state = [
|
||||
'url' => '',
|
||||
'name' => '',
|
||||
'git_ssh_key_id' => '',
|
||||
];
|
||||
|
||||
public $repositoryDetails = [];
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Clone Git Repository';
|
||||
|
@ -29,11 +38,20 @@ class CloneGitRepository extends Page
|
|||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('state')
|
||||
->schema([
|
||||
|
||||
Wizard::make([
|
||||
Wizard\Step::make('Repository')
|
||||
->schema([
|
||||
|
||||
Select::make('git_ssh_key_id')
|
||||
->label('SSH Key')
|
||||
->options(\App\Models\GitSshKey::all()->pluck('name', 'id'))
|
||||
->columnSpanFull()
|
||||
->live()
|
||||
->required(),
|
||||
|
||||
TextInput::make('url')
|
||||
->label('URL')
|
||||
->required()
|
||||
|
@ -43,26 +61,74 @@ class CloneGitRepository extends Page
|
|||
$repoDetails = GitClient::getRepoDetailsByUrl($state);
|
||||
if (isset($repoDetails['name'])) {
|
||||
$set('name', $repoDetails['owner'] .'/'. $repoDetails['name']);
|
||||
$this->repositoryDetails = $repoDetails;
|
||||
}
|
||||
})
|
||||
->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')
|
||||
Wizard\Step::make('Details')
|
||||
->schema([
|
||||
// ...
|
||||
|
||||
TextInput::make('name')
|
||||
->label('Name')
|
||||
->required()
|
||||
->columnSpanFull()
|
||||
->placeholder('Enter the name of the repository'),
|
||||
|
||||
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'),
|
||||
|
||||
]),
|
||||
Wizard\Step::make('Billing')
|
||||
Wizard\Step::make('Clone to')
|
||||
->schema([
|
||||
// ...
|
||||
|
||||
TextInput::make('dir')
|
||||
->label('Directory')
|
||||
->columnSpanFull()
|
||||
->required()
|
||||
->placeholder('Enter the directory of the repository'),
|
||||
|
||||
]),
|
||||
])->columnSpanFull()
|
||||
|
||||
|
|
|
@ -63,44 +63,8 @@ class GitRepositoryResource extends Resource
|
|||
|
||||
|
||||
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label('Name')
|
||||
->required()
|
||||
->columnSpanFull()
|
||||
->placeholder('Enter the name of the repository'),
|
||||
|
||||
Forms\Components\Select::make('branch')
|
||||
->label('Branch')
|
||||
->required()
|
||||
->options(function (Forms\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'),
|
||||
|
||||
Forms\Components\Select::make('tag')
|
||||
->label('Tag')
|
||||
->live()
|
||||
->options(function (Forms\Get $get) {
|
||||
$url = $get('url');
|
||||
$repoDetails = GitClient::getRepoDetailsByUrl($url);
|
||||
if (isset($repoDetails['name'])) {
|
||||
return $repoDetails['tags'];
|
||||
}
|
||||
})
|
||||
->columnSpanFull()
|
||||
->placeholder('Enter the tag of the repository'),
|
||||
|
||||
Forms\Components\TextInput::make('dir')
|
||||
->label('Directory')
|
||||
->columnSpanFull()
|
||||
->required()
|
||||
->placeholder('Enter the directory of the repository'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue