mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 00:50:32 +00:00
update
This commit is contained in:
parent
14b939fa8e
commit
17d5b118e1
3 changed files with 52 additions and 3 deletions
|
@ -3,6 +3,9 @@
|
||||||
namespace Modules\Customer\App\Filament\Pages;
|
namespace Modules\Customer\App\Filament\Pages;
|
||||||
|
|
||||||
use App\GitClient;
|
use App\GitClient;
|
||||||
|
use App\Models\Domain;
|
||||||
|
use App\Models\GitRepository;
|
||||||
|
use Filament\Actions\Action;
|
||||||
use Filament\Forms\Components\Radio;
|
use Filament\Forms\Components\Radio;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
|
@ -11,6 +14,8 @@ use Filament\Forms\Form;
|
||||||
use Filament\Forms\Get;
|
use Filament\Forms\Get;
|
||||||
use Filament\Forms\Set;
|
use Filament\Forms\Set;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\HtmlString;
|
||||||
|
|
||||||
class CloneGitRepository extends Page
|
class CloneGitRepository extends Page
|
||||||
{
|
{
|
||||||
|
@ -122,16 +127,48 @@ class CloneGitRepository extends Page
|
||||||
]),
|
]),
|
||||||
Wizard\Step::make('Clone to')
|
Wizard\Step::make('Clone to')
|
||||||
->schema([
|
->schema([
|
||||||
|
Select::make('domain_id')
|
||||||
|
->label('Domain')
|
||||||
|
->live()
|
||||||
|
->options(
|
||||||
|
Domain::get()->pluck('domain', 'id')->toArray()
|
||||||
|
)->columnSpanFull(),
|
||||||
|
|
||||||
TextInput::make('dir')
|
TextInput::make('dir')
|
||||||
->label('Directory')
|
->label('Directory')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->required()
|
->required()
|
||||||
->placeholder('Enter the directory of the repository'),
|
->default('public_html/')
|
||||||
|
->placeholder('Enter the directory to clone the repository'),
|
||||||
|
|
||||||
]),
|
]),
|
||||||
])->columnSpanFull()
|
])
|
||||||
|
->submitAction(new HtmlString(Blade::render(<<<BLADE
|
||||||
|
<x-filament::button
|
||||||
|
wire:click="cloneRepository"
|
||||||
|
>
|
||||||
|
Clone Repository
|
||||||
|
</x-filament::button>
|
||||||
|
BLADE)))
|
||||||
|
->columnSpanFull()
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function cloneRepository()
|
||||||
|
{
|
||||||
|
$newGitRepository = new GitRepository();
|
||||||
|
$newGitRepository->name = $this->state['name'];
|
||||||
|
$newGitRepository->url = $this->state['url'];
|
||||||
|
$newGitRepository->branch = $this->state['branch'];
|
||||||
|
$newGitRepository->tag = $this->state['tag'];
|
||||||
|
$newGitRepository->dir = $this->state['dir'];
|
||||||
|
$newGitRepository->clone_from = $this->state['clone_from'];
|
||||||
|
$newGitRepository->domain_id = $this->state['domain_id'];
|
||||||
|
$newGitRepository->git_ssh_key_id = $this->state['git_ssh_key_id'];
|
||||||
|
$newGitRepository->status = GitRepository::STATUS_PENDING;
|
||||||
|
$newGitRepository->save();
|
||||||
|
|
||||||
|
$this->redirect('/customer/git-repositories');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,20 @@ class GitRepository extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
const STATUS_PENDING = 'pending';
|
||||||
|
|
||||||
|
const STATUS_CLONING = 'cloning';
|
||||||
|
const STATUS_CLONED = 'cloned';
|
||||||
|
const STATUS_FAILED = 'failed';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'url',
|
'url',
|
||||||
'branch',
|
'branch',
|
||||||
|
'tag',
|
||||||
|
'clone_from',
|
||||||
'last_commit_hash',
|
'last_commit_hash',
|
||||||
'last_commit_message',
|
'last_commit_message',
|
||||||
'last_commit_date',
|
'last_commit_date',
|
||||||
|
|
|
@ -16,7 +16,9 @@ return new class extends Migration
|
||||||
|
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('url');
|
$table->string('url');
|
||||||
$table->string('branch');
|
$table->string('branch')->nullable();
|
||||||
|
$table->string('tag')->nullable();
|
||||||
|
$table->string('clone_from')->nullable();
|
||||||
$table->string('last_commit_hash')->nullable();
|
$table->string('last_commit_hash')->nullable();
|
||||||
$table->string('last_commit_message')->nullable();
|
$table->string('last_commit_message')->nullable();
|
||||||
$table->timestamp('last_commit_date')->nullable();
|
$table->timestamp('last_commit_date')->nullable();
|
||||||
|
|
Loading…
Reference in a new issue