Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Extend new AbstractGridFieldComponent class #367

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^7.4 || ^8.0",
"silverstripe/framework": "^4.10",
"silverstripe/framework": "^4.11",
"silverstripe/admin": "^1",
"asyncphp/doorman": "^3.1"
},
Expand Down
6 changes: 3 additions & 3 deletions src/Controllers/QueuedJobsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ public function getEditForm($id = null, $fields = null)
$list = QueuedJobDescriptor::get()->where($filter)->sort('Created', 'DESC');

$gridFieldConfig = GridFieldConfig_RecordEditor::create()
->addComponent(new GridFieldQueuedJobExecute('execute'))
->addComponent(new GridFieldQueuedJobExecute('pause', function ($record) {
->addComponent(GridFieldQueuedJobExecute::create('execute'))
->addComponent(GridFieldQueuedJobExecute::create('pause', function ($record) {
return $record->JobStatus == QueuedJob::STATUS_WAIT || $record->JobStatus == QueuedJob::STATUS_RUN;
}))
->addComponent(new GridFieldQueuedJobExecute('resume', function ($record) {
->addComponent(GridFieldQueuedJobExecute::create('resume', function ($record) {
return $record->JobStatus == QueuedJob::STATUS_PAUSED || $record->JobStatus == QueuedJob::STATUS_BROKEN;
}))
->removeComponentsByType([
Expand Down
5 changes: 4 additions & 1 deletion src/Forms/GridFieldQueuedJobExecute.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Symbiote\QueuedJobs\Forms;

use SilverStripe\Forms\GridField\AbstractGridFieldComponent;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_ColumnProvider;
Expand All @@ -10,7 +11,9 @@
use SilverStripe\View\Requirements;
use Symbiote\QueuedJobs\Services\QueuedJob;

class GridFieldQueuedJobExecute implements GridField_ColumnProvider, GridField_ActionProvider
class GridFieldQueuedJobExecute extends AbstractGridFieldComponent implements
GridField_ColumnProvider,
GridField_ActionProvider
{
protected $action = 'execute';

Expand Down