Dennis
Dennis
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
I know, I like this better
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Did you work it out @Daniel Plomp ?
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
And I don't mind sharing a few bits
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Haha it's closed I'm afraid, but you'll learn quickly enough, just keep building
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Pretty easy 😄
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Tables\Columns\TextColumn::make('status')
->badge()
->icon(function (ProjectStatus $state) {
if ($state === ProjectStatus::Building || $state === ProjectStatus::UploadingToGit) {
return 'heroicon-o-arrow-path';
}

return null;
})
->extraAttributes(['class' => 'filament-icon-spin'])
->color(fn (ProjectStatus $state): string => match ($state->value) {
'finished', 'downloaded' => 'success',
'building', 'uploading-to-git' => 'gray',
'failed' => 'danger',
default => 'primary'
})
Tables\Columns\TextColumn::make('status')
->badge()
->icon(function (ProjectStatus $state) {
if ($state === ProjectStatus::Building || $state === ProjectStatus::UploadingToGit) {
return 'heroicon-o-arrow-path';
}

return null;
})
->extraAttributes(['class' => 'filament-icon-spin'])
->color(fn (ProjectStatus $state): string => match ($state->value) {
'finished', 'downloaded' => 'success',
'building', 'uploading-to-git' => 'gray',
'failed' => 'danger',
default => 'primary'
})
I just set the icon if it's building, but that needs an animation, I've done that in CSS:
.filament-icon-spin svg {
@apply animate-spin;
}
.filament-icon-spin svg {
@apply animate-spin;
}
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Sec
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Rather easy though
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Ah yes
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
For a project (or what ever entity)
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
If you use job batches, you need to update a status column in the finally() method
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
And that updates automatically because of polling
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
The disabling, is just a disabled() methdo on the action:
->disabled(fn (Project $record) => $record->status === ProjectStatus::Building)
->disabled(fn (Project $record) => $record->status === ProjectStatus::Building)
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
If I do, it updates every 5s
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
I just check if I need to poll
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Then, on the $table property:
->poll(function () use ($table) {
if (
$table->getRecords()
->whereIn('status', [ProjectStatus::Building, ProjectStatus::UploadingToGit])
->count() > 0
) {
return '5s';
}

return null;
})
->poll(function () use ($table) {
if (
$table->getRecords()
->whereIn('status', [ProjectStatus::Building, ProjectStatus::UploadingToGit])
->count() > 0
) {
return '5s';
}

return null;
})
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
It's set to "finished"
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
in the final job
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
The status of a project is just being updated in the jobs
54 replies
FFilament
Created by Daniel Plomp on 8/22/2023 in #❓┊help
Enable/Disable button dynamically (based on Job Status)
Or how I disable it?
54 replies