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\PageRegistration;
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\View;
use Filament\Support\Enums\IconSize;
use Filament\Support\Facades\FilamentView;
use Filament\Tables\Columns\TextColumn;
@ -532,42 +529,31 @@ class ListFiles extends ListRecords
->label(trans('server/file.actions.new_folder.folder_name'))
->required(),
]),
Action::make('upload')
Action::make('uploadFile')
->authorize(fn () => user()?->can(Permission::ACTION_FILE_CREATE, $server))
->hiddenLabel()->icon('tabler-upload')->iconButton()->iconSize(IconSize::ExtraLarge)
->tooltip(trans('server/file.actions.upload.title'))
->view('filament.server.pages.file-upload'),
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')
->action(function ($data) {
if ($data['url'] !== null) {
$this->getDaemonFileRepository()->pull($data['url'], $this->path);
Activity::event('server:file.pull')
->property('url', $data['url'])
->property('directory', $this->path)
->log();
}
$this->refreshPage();
})
->schema([
Tabs::make()
->contained(false)
->schema([
Tab::make('files')
->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'))
->required()
->url(),
]),
]),
]),
Action::make('search')
->authorize(fn () => user()?->can(Permission::ACTION_FILE_READ, $server))
->hiddenLabel()->iconButton()->iconSize(IconSize::ExtraLarge)

View File

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

View File

@ -360,7 +360,7 @@
<div class="flex flex-col items-center gap-4">
<svg xmlns="http://www.w3.org/2000/svg"
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">
<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" />