This commit is contained in:
Bozhidar 2024-04-29 13:44:02 +03:00
parent 1eb5ed038d
commit d9168ba7f1
6 changed files with 183 additions and 0 deletions

View file

@ -0,0 +1,69 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\RemoteBackupServerResource\Pages;
use App\Filament\Resources\RemoteBackupServerResource\RelationManagers;
use App\Models\RemoteBackupServer;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class RemoteBackupServerResource extends Resource
{
protected static ?string $model = RemoteBackupServer::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Server Clustering';
public static function form(Form $form): Form
{
return $form
->schema([
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('type'),
Tables\Columns\TextColumn::make('hostname'),
Tables\Columns\TextColumn::make('status'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListRemoteBackupServers::route('/'),
'create' => Pages\CreateRemoteBackupServer::route('/create'),
'edit' => Pages\EditRemoteBackupServer::route('/{record}/edit'),
];
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\RemoteBackupServerResource\Pages;
use App\Filament\Resources\RemoteBackupServerResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateRemoteBackupServer extends CreateRecord
{
protected static string $resource = RemoteBackupServerResource::class;
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\RemoteBackupServerResource\Pages;
use App\Filament\Resources\RemoteBackupServerResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditRemoteBackupServer extends EditRecord
{
protected static string $resource = RemoteBackupServerResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\RemoteBackupServerResource\Pages;
use App\Filament\Resources\RemoteBackupServerResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListRemoteBackupServers extends ListRecords
{
protected static string $resource = RemoteBackupServerResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RemoteBackupServer extends Model
{
use HasFactory;
protected $fillable = [
'name',
'type',
'hostname',
'port',
'username',
'password',
'path',
'ssh_private_key',
'ssh_private_key_password',
];
}

View file

@ -0,0 +1,41 @@
<?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::create('remote_backup_servers', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('type')->nullable();
$table->string('hostname')->nullable();
$table->string('port')->nullable();
$table->string('username')->nullable();
$table->string('password')->nullable();
$table->string('path')->nullable();
$table->longText('ssh_private_key')->nullable();
$table->string('ssh_private_key_password')->nullable();
$table->string('status')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('remote_backup_servers');
}
};