mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-08 10:39:27 +01:00
revert "allow to create plugins via the frontend"
This commit is contained in:
parent
3e8fbc1a99
commit
93ee1cdf68
@ -2,26 +2,20 @@
|
||||
|
||||
namespace App\Filament\Admin\Resources;
|
||||
|
||||
use App\Enums\PluginCategory;
|
||||
use App\Facades\Plugins;
|
||||
use App\Filament\Admin\Resources\Plugins\Pages\ListPlugins;
|
||||
use App\Models\Plugin;
|
||||
use Exception;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TagsInput;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class PluginResource extends Resource
|
||||
{
|
||||
@ -167,35 +161,6 @@ class PluginResource extends Resource
|
||||
}),
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make()
|
||||
->createAnother(false)
|
||||
->visible(fn () => Plugins::isDevModeActive())
|
||||
->action(function ($data) {
|
||||
$exitCode = Artisan::call('p:plugin:make', [
|
||||
'--name' => $data['name'],
|
||||
'--author' => $data['author'],
|
||||
'--description' => $data['description'],
|
||||
'--category' => $data['category'],
|
||||
'--url' => $data['url'] ?? '',
|
||||
'--updateUrl' => $data['update_url'] ?? '',
|
||||
'--panels' => $data['panels'] ?? [],
|
||||
'--composerPackages' => $data['composer_packages'] ?? [],
|
||||
]);
|
||||
|
||||
if ($exitCode === 0) {
|
||||
redirect(ListPlugins::getUrl());
|
||||
|
||||
Notification::make()
|
||||
->success()
|
||||
->title(trans('admin/plugin.notifications.created'))
|
||||
->send();
|
||||
} else {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title(trans('admin/plugin.notifications.create_failed'))
|
||||
->send();
|
||||
}
|
||||
}),
|
||||
Action::make('import')
|
||||
->label(trans('admin/plugin.import'))
|
||||
->authorize(fn () => auth()->user()->can('create', Plugin::class))
|
||||
@ -256,38 +221,6 @@ class PluginResource extends Resource
|
||||
->emptyStateHeading(trans('admin/plugin.no_plugins'));
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
TextInput::make('author')
|
||||
->required()
|
||||
->default(fn () => auth()->user()->username),
|
||||
TextInput::make('description')
|
||||
->columnSpanFull(),
|
||||
Select::make('category')
|
||||
->selectablePlaceholder(false)
|
||||
->default(PluginCategory::Plugin->value)
|
||||
->options(PluginCategory::class),
|
||||
Select::make('panels')
|
||||
->multiple()
|
||||
->options([
|
||||
'admin' => 'Admin Area',
|
||||
'server' => 'Client Area',
|
||||
'app' => 'Server List',
|
||||
]),
|
||||
TextInput::make('url')
|
||||
->url(),
|
||||
TextInput::make('update_url')
|
||||
->url(),
|
||||
TagsInput::make('composer_packages')
|
||||
->columnSpanFull()
|
||||
->placeholder('New Package'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@ -48,7 +48,5 @@ return [
|
||||
'disabled' => 'Plugin disabled',
|
||||
'downloaded' => 'Plugin downloaded',
|
||||
'download_failed' => 'Could not download plugin',
|
||||
'created' => 'Plugin created',
|
||||
'create_failed' => 'Could not create plugin',
|
||||
],
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user