Add class_attributes_separation

This commit is contained in:
Lance Pioch 2024-10-19 18:29:44 -04:00
parent 75e89b2d4c
commit c0a41acf1f
40 changed files with 98 additions and 4 deletions

View File

@ -14,8 +14,11 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class DisplayException extends PanelException implements HttpExceptionInterface class DisplayException extends PanelException implements HttpExceptionInterface
{ {
public const LEVEL_DEBUG = 'debug'; public const LEVEL_DEBUG = 'debug';
public const LEVEL_INFO = 'info'; public const LEVEL_INFO = 'info';
public const LEVEL_WARNING = 'warning'; public const LEVEL_WARNING = 'warning';
public const LEVEL_ERROR = 'error'; public const LEVEL_ERROR = 'error';
/** /**

View File

@ -7,6 +7,7 @@ use App\Exceptions\DisplayException;
class TwoFactorAuthenticationTokenInvalid extends DisplayException class TwoFactorAuthenticationTokenInvalid extends DisplayException
{ {
public string $title = 'Invalid 2FA Code'; public string $title = 'Invalid 2FA Code';
public string $icon = 'tabler-2fa'; public string $icon = 'tabler-2fa';
public function __construct() public function __construct()

View File

@ -7,7 +7,9 @@ use App\Models\DatabaseHost;
class DynamicDatabaseConnection class DynamicDatabaseConnection
{ {
public const DB_CHARSET = 'utf8'; public const DB_CHARSET = 'utf8';
public const DB_COLLATION = 'utf8_unicode_ci'; public const DB_COLLATION = 'utf8_unicode_ci';
public const DB_DRIVER = 'mysql'; public const DB_DRIVER = 'mysql';
/** /**

View File

@ -38,6 +38,7 @@ class Settings extends Page implements HasForms
use InteractsWithHeaderActions; use InteractsWithHeaderActions;
protected static ?string $navigationIcon = 'tabler-settings'; protected static ?string $navigationIcon = 'tabler-settings';
protected static ?string $navigationGroup = 'Advanced'; protected static ?string $navigationGroup = 'Advanced';
protected static string $view = 'filament.pages.settings'; protected static string $view = 'filament.pages.settings';

View File

@ -9,8 +9,11 @@ use Filament\Resources\Resource;
class ApiKeyResource extends Resource class ApiKeyResource extends Resource
{ {
protected static ?string $model = ApiKey::class; protected static ?string $model = ApiKey::class;
protected static ?string $label = 'API Key'; protected static ?string $label = 'API Key';
protected static ?string $navigationIcon = 'tabler-key'; protected static ?string $navigationIcon = 'tabler-key';
protected static ?string $navigationGroup = 'Advanced'; protected static ?string $navigationGroup = 'Advanced';
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string

View File

@ -13,6 +13,7 @@ class DatabaseHostResource extends Resource
protected static ?string $label = 'Database Host'; protected static ?string $label = 'Database Host';
protected static ?string $navigationIcon = 'tabler-database'; protected static ?string $navigationIcon = 'tabler-database';
protected static ?string $navigationGroup = 'Advanced'; protected static ?string $navigationGroup = 'Advanced';
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string

View File

@ -40,6 +40,7 @@ class DatabasesRelationManager extends RelationManager
->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($database->password) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database')), ->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($database->password) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database')),
]); ]);
} }
public function table(Table $table): Table public function table(Table $table): Table
{ {
return $table return $table

View File

@ -13,6 +13,7 @@ class DatabaseResource extends Resource
protected static ?string $navigationIcon = 'tabler-database'; protected static ?string $navigationIcon = 'tabler-database';
protected static bool $shouldRegisterNavigation = false; protected static bool $shouldRegisterNavigation = false;
protected static ?string $navigationGroup = 'Advanced'; protected static ?string $navigationGroup = 'Advanced';
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string

View File

@ -27,6 +27,7 @@ class CreateEgg extends CreateRecord
protected static string $resource = EggResource::class; protected static string $resource = EggResource::class;
protected static bool $canCreateAnother = false; protected static bool $canCreateAnother = false;
public function form(Form $form): Form public function form(Form $form): Form
{ {
return $form return $form

View File

@ -97,6 +97,7 @@ class ListEggs extends ListRecords
]), ]),
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -11,6 +11,7 @@ class MountResource extends Resource
protected static ?string $model = Mount::class; protected static ?string $model = Mount::class;
protected static ?string $navigationIcon = 'tabler-layers-linked'; protected static ?string $navigationIcon = 'tabler-layers-linked';
protected static ?string $navigationGroup = 'Advanced'; protected static ?string $navigationGroup = 'Advanced';
public static function getNavigationBadge(): ?string public static function getNavigationBadge(): ?string

View File

@ -96,6 +96,7 @@ class EditMount extends EditRecord
'lg' => 2, 'lg' => 2,
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -17,6 +17,7 @@ use Filament\Tables\Table;
class ListMounts extends ListRecords class ListMounts extends ListRecords
{ {
protected static string $resource = MountResource::class; protected static string $resource = MountResource::class;
public function table(Table $table): Table public function table(Table $table): Table
{ {
return $table return $table
@ -56,6 +57,7 @@ class ListMounts extends ListRecords
->button(), ->button(),
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -12,6 +12,7 @@ use Illuminate\Support\Number;
class NodeCpuChart extends ChartWidget class NodeCpuChart extends ChartWidget
{ {
protected static ?string $pollingInterval = '5s'; protected static ?string $pollingInterval = '5s';
protected static ?string $maxHeight = '300px'; protected static ?string $maxHeight = '300px';
public ?Model $record = null; public ?Model $record = null;

View File

@ -12,6 +12,7 @@ use Illuminate\Support\Number;
class NodeMemoryChart extends ChartWidget class NodeMemoryChart extends ChartWidget
{ {
protected static ?string $pollingInterval = '5s'; protected static ?string $pollingInterval = '5s';
protected static ?string $maxHeight = '300px'; protected static ?string $maxHeight = '300px';
public ?Model $record = null; public ?Model $record = null;

View File

@ -9,7 +9,9 @@ use Illuminate\Database\Eloquent\Model;
class NodeStorageChart extends ChartWidget class NodeStorageChart extends ChartWidget
{ {
protected static ?string $heading = 'Storage'; protected static ?string $heading = 'Storage';
protected static ?string $pollingInterval = '60s'; protected static ?string $pollingInterval = '60s';
protected static ?string $maxHeight = '300px'; protected static ?string $maxHeight = '300px';
public ?Model $record = null; public ?Model $record = null;

View File

@ -45,6 +45,7 @@ use LogicException;
class CreateServer extends CreateRecord class CreateServer extends CreateRecord
{ {
protected static string $resource = ServerResource::class; protected static string $resource = ServerResource::class;
protected static bool $canCreateAnother = false; protected static bool $canCreateAnother = false;
public ?Node $node = null; public ?Node $node = null;

View File

@ -741,6 +741,7 @@ class EditServer extends EditRecord
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [
@ -763,6 +764,7 @@ class EditServer extends EditRecord
]; ];
} }
protected function getFormActions(): array protected function getFormActions(): array
{ {
return []; return [];

View File

@ -96,6 +96,7 @@ class ListServers extends ListRecords
->button(), ->button(),
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Hash;
class EditUser extends EditRecord class EditUser extends EditRecord
{ {
protected static string $resource = UserResource::class; protected static string $resource = UserResource::class;
public function form(Form $form): Form public function form(Form $form): Form
{ {
return $form return $form
@ -46,6 +47,7 @@ class EditUser extends EditRecord
])->columns(), ])->columns(),
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -78,6 +78,7 @@ class ListUsers extends ListRecords
]), ]),
]); ]);
} }
protected function getHeaderActions(): array protected function getHeaderActions(): array
{ {
return [ return [

View File

@ -15,6 +15,7 @@ class NodeViewController extends Controller
use JavascriptInjection; use JavascriptInjection;
public const THRESHOLD_PERCENTAGE_LOW = 75; public const THRESHOLD_PERCENTAGE_LOW = 75;
public const THRESHOLD_PERCENTAGE_MEDIUM = 90; public const THRESHOLD_PERCENTAGE_MEDIUM = 90;
/** /**

View File

@ -10,7 +10,9 @@ use App\Exceptions\Http\TwoFactorAuthRequiredException;
class RequireTwoFactorAuthentication class RequireTwoFactorAuthentication
{ {
public const LEVEL_NONE = 0; public const LEVEL_NONE = 0;
public const LEVEL_ADMIN = 1; public const LEVEL_ADMIN = 1;
public const LEVEL_ALL = 2; public const LEVEL_ALL = 2;
/** /**

View File

@ -42,5 +42,4 @@ class NodeStatistics implements ShouldQueue
} }
} }
} }
} }

View File

@ -8,6 +8,7 @@ use Livewire\Component;
class NodeSystemInformation extends Component class NodeSystemInformation extends Component
{ {
public Node $node; public Node $node;
public string $sizeClasses; public string $sizeClasses;
public function render() public function render()

View File

@ -25,6 +25,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class ActivityLogSubject extends Pivot class ActivityLogSubject extends Pivot
{ {
public $incrementing = true; public $incrementing = true;
public $timestamps = false; public $timestamps = false;
protected $table = 'activity_log_subjects'; protected $table = 'activity_log_subjects';

View File

@ -63,21 +63,28 @@ class ApiKey extends Model
* API representation using fractal. * API representation using fractal.
*/ */
public const RESOURCE_NAME = 'api_key'; public const RESOURCE_NAME = 'api_key';
/** /**
* Different API keys that can exist on the system. * Different API keys that can exist on the system.
*/ */
public const TYPE_NONE = 0; public const TYPE_NONE = 0;
public const TYPE_ACCOUNT = 1; public const TYPE_ACCOUNT = 1;
/* @deprecated */ /* @deprecated */
public const TYPE_APPLICATION = 2; public const TYPE_APPLICATION = 2;
/* @deprecated */ /* @deprecated */
public const TYPE_DAEMON_USER = 3; public const TYPE_DAEMON_USER = 3;
/* @deprecated */ /* @deprecated */
public const TYPE_DAEMON_APPLICATION = 4; public const TYPE_DAEMON_APPLICATION = 4;
/** /**
* The length of API key identifiers. * The length of API key identifiers.
*/ */
public const IDENTIFIER_LENGTH = 16; public const IDENTIFIER_LENGTH = 16;
/** /**
* The length of the actual API key that is encrypted and stored * The length of the actual API key that is encrypted and stored
* in the database. * in the database.

View File

@ -32,6 +32,7 @@ class Backup extends Model
public const RESOURCE_NAME = 'backup'; public const RESOURCE_NAME = 'backup';
public const ADAPTER_DAEMON = 'wings'; public const ADAPTER_DAEMON = 'wings';
public const ADAPTER_AWS_S3 = 's3'; public const ADAPTER_AWS_S3 = 's3';
protected $table = 'backups'; protected $table = 'backups';

View File

@ -70,6 +70,7 @@ class Egg extends Model
* than leaving it null. * than leaving it null.
*/ */
public const FEATURE_EULA_POPUP = 'eula'; public const FEATURE_EULA_POPUP = 'eula';
public const FEATURE_FASTDL = 'fastdl'; public const FEATURE_FASTDL = 'fastdl';
/** /**

View File

@ -53,6 +53,7 @@ class Node extends Model
public const RESOURCE_NAME = 'node'; public const RESOURCE_NAME = 'node';
public const DAEMON_TOKEN_ID_LENGTH = 16; public const DAEMON_TOKEN_ID_LENGTH = 16;
public const DAEMON_TOKEN_LENGTH = 64; public const DAEMON_TOKEN_LENGTH = 64;
/** /**
@ -135,7 +136,9 @@ class Node extends Model
} }
public int $servers_sum_memory = 0; public int $servers_sum_memory = 0;
public int $servers_sum_disk = 0; public int $servers_sum_disk = 0;
public int $servers_sum_cpu = 0; public int $servers_sum_cpu = 0;
public function getRouteKeyName(): string public function getRouteKeyName(): string

View File

@ -45,5 +45,4 @@ class DeploymentObject
return $this; return $this;
} }
} }

View File

@ -16,51 +16,81 @@ class Permission extends Model
* Constants defining different permissions available. * Constants defining different permissions available.
*/ */
public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect'; public const ACTION_WEBSOCKET_CONNECT = 'websocket.connect';
public const ACTION_CONTROL_CONSOLE = 'control.console'; public const ACTION_CONTROL_CONSOLE = 'control.console';
public const ACTION_CONTROL_START = 'control.start'; public const ACTION_CONTROL_START = 'control.start';
public const ACTION_CONTROL_STOP = 'control.stop'; public const ACTION_CONTROL_STOP = 'control.stop';
public const ACTION_CONTROL_RESTART = 'control.restart'; public const ACTION_CONTROL_RESTART = 'control.restart';
public const ACTION_DATABASE_READ = 'database.read'; public const ACTION_DATABASE_READ = 'database.read';
public const ACTION_DATABASE_CREATE = 'database.create'; public const ACTION_DATABASE_CREATE = 'database.create';
public const ACTION_DATABASE_UPDATE = 'database.update'; public const ACTION_DATABASE_UPDATE = 'database.update';
public const ACTION_DATABASE_DELETE = 'database.delete'; public const ACTION_DATABASE_DELETE = 'database.delete';
public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password'; public const ACTION_DATABASE_VIEW_PASSWORD = 'database.view_password';
public const ACTION_SCHEDULE_READ = 'schedule.read'; public const ACTION_SCHEDULE_READ = 'schedule.read';
public const ACTION_SCHEDULE_CREATE = 'schedule.create'; public const ACTION_SCHEDULE_CREATE = 'schedule.create';
public const ACTION_SCHEDULE_UPDATE = 'schedule.update'; public const ACTION_SCHEDULE_UPDATE = 'schedule.update';
public const ACTION_SCHEDULE_DELETE = 'schedule.delete'; public const ACTION_SCHEDULE_DELETE = 'schedule.delete';
public const ACTION_USER_READ = 'user.read'; public const ACTION_USER_READ = 'user.read';
public const ACTION_USER_CREATE = 'user.create'; public const ACTION_USER_CREATE = 'user.create';
public const ACTION_USER_UPDATE = 'user.update'; public const ACTION_USER_UPDATE = 'user.update';
public const ACTION_USER_DELETE = 'user.delete'; public const ACTION_USER_DELETE = 'user.delete';
public const ACTION_BACKUP_READ = 'backup.read'; public const ACTION_BACKUP_READ = 'backup.read';
public const ACTION_BACKUP_CREATE = 'backup.create'; public const ACTION_BACKUP_CREATE = 'backup.create';
public const ACTION_BACKUP_DELETE = 'backup.delete'; public const ACTION_BACKUP_DELETE = 'backup.delete';
public const ACTION_BACKUP_DOWNLOAD = 'backup.download'; public const ACTION_BACKUP_DOWNLOAD = 'backup.download';
public const ACTION_BACKUP_RESTORE = 'backup.restore'; public const ACTION_BACKUP_RESTORE = 'backup.restore';
public const ACTION_ALLOCATION_READ = 'allocation.read'; public const ACTION_ALLOCATION_READ = 'allocation.read';
public const ACTION_ALLOCATION_CREATE = 'allocation.create'; public const ACTION_ALLOCATION_CREATE = 'allocation.create';
public const ACTION_ALLOCATION_UPDATE = 'allocation.update'; public const ACTION_ALLOCATION_UPDATE = 'allocation.update';
public const ACTION_ALLOCATION_DELETE = 'allocation.delete'; public const ACTION_ALLOCATION_DELETE = 'allocation.delete';
public const ACTION_FILE_READ = 'file.read'; public const ACTION_FILE_READ = 'file.read';
public const ACTION_FILE_READ_CONTENT = 'file.read-content'; public const ACTION_FILE_READ_CONTENT = 'file.read-content';
public const ACTION_FILE_CREATE = 'file.create'; public const ACTION_FILE_CREATE = 'file.create';
public const ACTION_FILE_UPDATE = 'file.update'; public const ACTION_FILE_UPDATE = 'file.update';
public const ACTION_FILE_DELETE = 'file.delete'; public const ACTION_FILE_DELETE = 'file.delete';
public const ACTION_FILE_ARCHIVE = 'file.archive'; public const ACTION_FILE_ARCHIVE = 'file.archive';
public const ACTION_FILE_SFTP = 'file.sftp'; public const ACTION_FILE_SFTP = 'file.sftp';
public const ACTION_STARTUP_READ = 'startup.read'; public const ACTION_STARTUP_READ = 'startup.read';
public const ACTION_STARTUP_UPDATE = 'startup.update'; public const ACTION_STARTUP_UPDATE = 'startup.update';
public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image'; public const ACTION_STARTUP_DOCKER_IMAGE = 'startup.docker-image';
public const ACTION_SETTINGS_RENAME = 'settings.rename'; public const ACTION_SETTINGS_RENAME = 'settings.rename';
public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall'; public const ACTION_SETTINGS_REINSTALL = 'settings.reinstall';
public const ACTION_ACTIVITY_READ = 'activity.read'; public const ACTION_ACTIVITY_READ = 'activity.read';

View File

@ -31,8 +31,11 @@ class Task extends Model
* The default actions that can exist for a task * The default actions that can exist for a task
*/ */
public const ACTION_POWER = 'power'; public const ACTION_POWER = 'power';
public const ACTION_COMMAND = 'command'; public const ACTION_COMMAND = 'command';
public const ACTION_BACKUP = 'backup'; public const ACTION_BACKUP = 'backup';
public const ACTION_DELETE_FILES = 'delete_files'; public const ACTION_DELETE_FILES = 'delete_files';
/** /**

View File

@ -99,6 +99,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
use Notifiable; use Notifiable;
public const USER_LEVEL_USER = 0; public const USER_LEVEL_USER = 0;
public const USER_LEVEL_ADMIN = 1; public const USER_LEVEL_ADMIN = 1;
/** /**

View File

@ -17,7 +17,9 @@ class AdminAcl
* implements a read/write/none permissions scheme for all endpoints. * implements a read/write/none permissions scheme for all endpoints.
*/ */
public const NONE = 0; public const NONE = 0;
public const READ = 1; public const READ = 1;
public const WRITE = 2; public const WRITE = 2;
/** /**
@ -25,13 +27,21 @@ class AdminAcl
* set for each key. These are stored in the database as r_{resource}. * set for each key. These are stored in the database as r_{resource}.
*/ */
public const RESOURCE_SERVERS = 'servers'; public const RESOURCE_SERVERS = 'servers';
public const RESOURCE_NODES = 'nodes'; public const RESOURCE_NODES = 'nodes';
public const RESOURCE_ALLOCATIONS = 'allocations'; public const RESOURCE_ALLOCATIONS = 'allocations';
public const RESOURCE_USERS = 'users'; public const RESOURCE_USERS = 'users';
public const RESOURCE_EGGS = 'eggs'; public const RESOURCE_EGGS = 'eggs';
public const RESOURCE_DATABASE_HOSTS = 'database_hosts'; public const RESOURCE_DATABASE_HOSTS = 'database_hosts';
public const RESOURCE_SERVER_DATABASES = 'server_databases'; public const RESOURCE_SERVER_DATABASES = 'server_databases';
public const RESOURCE_MOUNTS = 'mounts'; public const RESOURCE_MOUNTS = 'mounts';
public const RESOURCE_ROLES = 'roles'; public const RESOURCE_ROLES = 'roles';
/** /**

View File

@ -7,6 +7,7 @@ use Ramsey\Uuid\Uuid;
class ActivityLogBatchService class ActivityLogBatchService
{ {
protected int $transaction = 0; protected int $transaction = 0;
protected ?string $uuid = null; protected ?string $uuid = null;
/** /**

View File

@ -16,10 +16,15 @@ use App\Exceptions\Service\Allocation\TooManyPortsInRangeException;
class AssignmentService class AssignmentService
{ {
public const CIDR_MAX_BITS = 25; public const CIDR_MAX_BITS = 25;
public const CIDR_MIN_BITS = 32; public const CIDR_MIN_BITS = 32;
public const PORT_FLOOR = 1024; public const PORT_FLOOR = 1024;
public const PORT_CEIL = 65535; public const PORT_CEIL = 65535;
public const PORT_RANGE_LIMIT = 1000; public const PORT_RANGE_LIMIT = 1000;
public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/'; public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/';
/** /**

View File

@ -93,5 +93,4 @@ class ServerConfigurationStructureService
return $response; return $response;
} }
} }

View File

@ -12,6 +12,7 @@ use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
class SuspensionService class SuspensionService
{ {
public const ACTION_SUSPEND = 'suspend'; public const ACTION_SUSPEND = 'suspend';
public const ACTION_UNSUSPEND = 'unsuspend'; public const ACTION_UNSUSPEND = 'unsuspend';
/** /**

View File

@ -1,7 +1,6 @@
{ {
"preset": "laravel", "preset": "laravel",
"rules": { "rules": {
"class_attributes_separation": false,
"concat_space": false, "concat_space": false,
"not_operator_with_successor_space": false, "not_operator_with_successor_space": false,
"nullable_type_declaration_for_default_null_value": false, "nullable_type_declaration_for_default_null_value": false,