spinther
spinther
DDeno
Created by Alienaut on 10/23/2024 in #help
Deno installation script doesn't work
try the following:
wget https://deno.land/install.sh -O install.sh
sh install.sh
wget https://deno.land/install.sh -O install.sh
sh install.sh
5 replies
FFilament
Created by spinther on 4/21/2024 in #❓┊help
How to debug failed rows in an Exporter?
Aparantley it's a bug in the exporter. Steps to reproduce: 1. Add ->deselectAllRecordsWhenFiltered(false) to the table 2. Select random records 3. Search for a record without clearing the search field 4. Select the record found 5. Bulk export the selected records Only one record is exported successfully and the rest fail. @Dan Harrin I'll open an issue when I have time to create a reproduction repository.
2 replies
FFilament
Created by spinther on 1/27/2024 in #❓┊help
How to disable import action job retries?
This is what I ended up doing but I'm not sure if this is the best approach:
class ImportTasksJob extends ImportCsv
{

public function handle(): void
{
$user = $this->import->user;
try {
parent::handle();
} catch (ValidationException $exception) {
// Handle validation exceptions (logging, etc.)
Notification::make()
->title('Import Failed')
->body("The import job failed due to an error: {$exception->getMessage()}")
->danger()
->sendToDatabase($user);

$this->fail($exception);
} catch (Throwable $exception) {
// Handle general exceptions
Notification::make()
->title('Import Failed')
->body("The import job failed due to an error: {$exception->getMessage()}")
->danger()
->sendToDatabase($user);

$this->fail($exception);
}
}
}
class ImportTasksJob extends ImportCsv
{

public function handle(): void
{
$user = $this->import->user;
try {
parent::handle();
} catch (ValidationException $exception) {
// Handle validation exceptions (logging, etc.)
Notification::make()
->title('Import Failed')
->body("The import job failed due to an error: {$exception->getMessage()}")
->danger()
->sendToDatabase($user);

$this->fail($exception);
} catch (Throwable $exception) {
// Handle general exceptions
Notification::make()
->title('Import Failed')
->body("The import job failed due to an error: {$exception->getMessage()}")
->danger()
->sendToDatabase($user);

$this->fail($exception);
}
}
}
Ultimately, there should be a way to update the error message in the "Download information about the failed row" CSV file.
2 replies
FFilament
Created by Christian Giupponi on 1/19/2024 in #❓┊help
import csv and generate slug before save the post
public function fillRecord(): void
{
parent::fillRecord(); // Call the parent method to fill standard fields

// Manually fill additional fields
$additionalFields = [
'slug',
];
foreach ($additionalFields as $field) {
if (array_key_exists($field, $this->data)) {
$this->record->{$field} = $this->data[$field];
}
}
}

protected function beforeFill(): void
{
$this->data['slug'] = Str::slug($this->data['name']);
}
public function fillRecord(): void
{
parent::fillRecord(); // Call the parent method to fill standard fields

// Manually fill additional fields
$additionalFields = [
'slug',
];
foreach ($additionalFields as $field) {
if (array_key_exists($field, $this->data)) {
$this->record->{$field} = $this->data[$field];
}
}
}

protected function beforeFill(): void
{
$this->data['slug'] = Str::slug($this->data['name']);
}
6 replies
FFilament
Created by Chrispian on 4/13/2023 in #❓┊help
Sticky Table Headers and Columns
I'm leaving this here in case anyone wants sticky table headers. The dropdown z-index is a bit ugly but there's no other way to show it on top of the header. I only use tables in $table->columns() so I'm not sure if the thead style has side effects anywhere else.
@layer base {
thead {
@apply sticky top-0 z-10 shadow-md dark:bg-gray-800 bg-white;
}
}

@layer components {
.filament-tables-table-container {
@apply relative max-h-[calc(100vh-20rem)];
}

.filament-tables-pagination-container {
@apply sticky bottom-0 top-full dark:bg-gray-800 bg-white rounded-b-xl;
}

div .filament-dropdown-panel {
@apply z-20;
}
}
@layer base {
thead {
@apply sticky top-0 z-10 shadow-md dark:bg-gray-800 bg-white;
}
}

@layer components {
.filament-tables-table-container {
@apply relative max-h-[calc(100vh-20rem)];
}

.filament-tables-pagination-container {
@apply sticky bottom-0 top-full dark:bg-gray-800 bg-white rounded-b-xl;
}

div .filament-dropdown-panel {
@apply z-20;
}
}
@Dan Harrin thoughts on making this the default table styling considering that a better user experience can be achieved with minimal styling changes? Or maybe make it optional? We can add a class to the thead instead of targeting it directly and we can make the changes to the other existing classes. I'm not sure if it's a real issue, but one minor UX downside I have identified is that the user might not notice that the table is scrollable when 25+ records are shown by default, the table has multiple elements on top of it, and the user is already scrolling the entire page down. This might be solved by experimenting with the max-h-[calc(100vh-20rem)] subtracted rem value so that at least half of the last record is not entirely visible. Or maybe add a small indicator. @chrispian a plugin for sticky headers and columns would be very useful as well.
20 replies
FFilament
Created by spinther on 4/22/2023 in #❓┊help
Custom notifications service provider clarification
Notification inherits from ViewComponent which has a $view property. I've tried to create a class that inherits from Notification and override $view but again, the notification renders the default view. I'll move on to something else now but in case anyone knows a way to render a custom view in a specific notification, please let me know. Thanks @Dennis Koch.
5 replies
FFilament
Created by spinther on 4/22/2023 in #❓┊help
Custom notifications service provider clarification
Thanks for the reply @Dennis Koch. Unfortunately, it's not working for some reason. The following code overrides the default view ands works fine when added to a service provider.
Notification::configureUsing(function (Notification $notification): void {
$notification->view("filament.notifications.api-key");
});
Notification::configureUsing(function (Notification $notification): void {
$notification->view("filament.notifications.api-key");
});
But using the following has no effect at all, and the notification renders the default view.
Notification::make()
->view("filament.notifications.api-key")
->title("$plainTextToken")
->body("Please make sure to copy your API key and save it in a secure location, as you will not have access to it again. This is crucial to ensure the safety and proper functioning of your account.")
->persistent()
->success()
->icon('heroicon-o-key')
->iconColor("success")
->send();
Notification::make()
->view("filament.notifications.api-key")
->title("$plainTextToken")
->body("Please make sure to copy your API key and save it in a secure location, as you will not have access to it again. This is crucial to ensure the safety and proper functioning of your account.")
->persistent()
->success()
->icon('heroicon-o-key')
->iconColor("success")
->send();
Am I doing something wrong?
filament/filament v2.17.28
filament/notifications v2.17.28
filament/filament v2.17.28
filament/notifications v2.17.28
5 replies