'outside']); //權限設定 $this->canDownload=true; } public function setUp(): array { if($this->canDownload ){ $this->showCheckBox(); } $actions = []; if($this->canDownload){ $actions[]=PowerGrid::exportable(fileName: $this->tableName.'-file') ->type(Exportable::TYPE_XLS, Exportable::TYPE_CSV); } $header = PowerGrid::header() ->withoutLoading() ->showToggleColumns(); $header->includeViewOnTop('livewire.headers.machine-status'); $actions[]=$header; $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); return $actions; } public function datasource(): Builder { return MachineStatus::query()->latest(); } public function relationSearch(): array { return []; } public function fields(): PowerGridFields { return PowerGrid::fields() ->add('id') ->add('hostname') ->add('ip') ->add('cpu') ->add('memory') ->add('disk') ->add('created_at'); } public function columns(): array { $column=[]; $column[]=Column::make('Id', 'id'); $column[]=Column::make(__('machine-status.hostname'), 'hostname')->sortable()->searchable(); $column[]=Column::make(__('machine-status.Ip'), 'ip')->sortable()->searchable(); $column[]=Column::make(__('machine-status.Cpu'), 'cpu')->sortable()->searchable(); $column[]=Column::make(__('machine-status.Memory'), 'memory')->sortable()->searchable(); $column[]=Column::make(__('machine-status.Disk'), 'disk')->sortable()->searchable(); $column[]=Column::make(__('machine-status.Created at'), 'created_at')->sortable()->searchable(); return $column; } public function filters(): array { return [ Filter::datetimepicker('created_at'), Filter::inputText('hostname')->placeholder(__('machine-status.hostname')), Filter::inputText('ip')->placeholder(__('machine-status.Ip')), ]; } }