update actions

This commit is contained in:
notCharles 2025-11-08 18:44:14 -05:00
parent 993f3004f2
commit 0b6683d292
3 changed files with 26 additions and 42 deletions

View File

@ -35,10 +35,7 @@ use Filament\Panel;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Pages\PageRegistration; use Filament\Resources\Pages\PageRegistration;
use Filament\Schemas\Components\Grid; use Filament\Schemas\Components\Grid;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Components\Utilities\Get; use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\View;
use Filament\Support\Enums\IconSize; use Filament\Support\Enums\IconSize;
use Filament\Support\Facades\FilamentView; use Filament\Support\Facades\FilamentView;
use Filament\Tables\Columns\TextColumn; use Filament\Tables\Columns\TextColumn;
@ -532,41 +529,30 @@ class ListFiles extends ListRecords
->label(trans('server/file.actions.new_folder.folder_name')) ->label(trans('server/file.actions.new_folder.folder_name'))
->required(), ->required(),
]), ]),
Action::make('upload') Action::make('uploadFile')
->authorize(fn () => user()?->can(Permission::ACTION_FILE_CREATE, $server)) ->authorize(fn () => user()?->can(Permission::ACTION_FILE_CREATE, $server))
->hiddenLabel()->icon('tabler-upload')->iconButton()->iconSize(IconSize::ExtraLarge) ->view('filament.server.pages.file-upload'),
->tooltip(trans('server/file.actions.upload.title')) Action::make('uploadURL')
->authorize(fn () => user()?->can(Permission::ACTION_FILE_CREATE, $server))
->hiddenLabel()->icon('tabler-download')->iconButton()->iconSize(IconSize::ExtraLarge)
->tooltip(trans('server/file.actions.upload.from_url'))
->modalHeading(trans('server/file.actions.upload.from_url'))
->color('success') ->color('success')
->action(function ($data) { ->action(function ($data) {
if ($data['url'] !== null) { $this->getDaemonFileRepository()->pull($data['url'], $this->path);
$this->getDaemonFileRepository()->pull($data['url'], $this->path);
Activity::event('server:file.pull') Activity::event('server:file.pull')
->property('url', $data['url']) ->property('url', $data['url'])
->property('directory', $this->path) ->property('directory', $this->path)
->log(); ->log();
}
$this->refreshPage(); $this->refreshPage();
}) })
->schema([ ->schema([
Tabs::make() TextInput::make('url')
->contained(false) ->label(trans('server/file.actions.upload.url'))
->schema([ ->required()
Tab::make('files') ->url(),
->label(trans('server/file.actions.upload.from_files'))
->schema([
View::make('filament.server.pages.file-upload'),
]),
Tab::make('url')
->label(trans('server/file.actions.upload.url'))
->live()
->schema([
TextInput::make('url')
->label(trans('server/file.actions.upload.url'))
->url(),
]),
]),
]), ]),
Action::make('search') Action::make('search')
->authorize(fn () => user()?->can(Permission::ACTION_FILE_READ, $server)) ->authorize(fn () => user()?->can(Permission::ACTION_FILE_READ, $server))

View File

@ -302,17 +302,15 @@
this.$refs.fileInput.click(); this.$refs.fileInput.click();
}, },
}" }"
class="relative"> >
<div class="p-4"> <x-filament::icon-button
<input type="file" x-ref="fileInput" class="hidden" multiple @change="handleFileSelect"> iconSize="xl"
icon="tabler-upload"
<div class="flex items-center justify-center min-h-[200px]"> color="success"
<x-filament::button outlined size="lg" color="primary" @click="triggerBrowse"> tooltip="{{ trans('server/file.actions.upload.title') }}"
{{ trans('server/file.actions.upload.from_files') }} @click="triggerBrowse">
</x-filament::button> </x-filament::icon-button>
</div> <input type="file" x-ref="fileInput" class="hidden" multiple @change="handleFileSelect">
</div>
<div <div
x-show="isUploading" x-show="isUploading"
x-cloak x-cloak

View File

@ -360,7 +360,7 @@
<div class="flex flex-col items-center gap-4"> <div class="flex flex-col items-center gap-4">
<svg xmlns="http://www.w3.org/2000/svg" <svg xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icons-tabler-outline icon-tabler-upload size-12 text-success-500" class="icon icon-tabler icons-tabler-outline icon-tabler-upload size-12 text-success-500"
viewBox="0 0 24 24" fill="none" viewBox="0 0 36 36" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" /> <path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2" />