Skip to content

Commit

Permalink
NEW Extend new AbstractGridFieldComponent class
Browse files Browse the repository at this point in the history
This makes the `GridFieldSortableRows` component `Injectable`, and allows any future enhancements in the new abstract class to automatically apply without requiring additional changes in this module.

The class is introduced in silverstripe/framework 4.11.0 so the dependency constraint needs to be updated.
  • Loading branch information
GuySartorelli committed Feb 12, 2022
1 parent a2650fa commit a4f5976
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
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
3 changes: 2 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,7 @@
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

0 comments on commit a4f5976

Please sign in to comment.