Skip to content

Commit

Permalink
Exposed job statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed Mar 17, 2020
1 parent 9463289 commit 8ff4c02
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/DataObjects/QueuedJobDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,13 @@ public function getJobTypeValues()
}

/**
* @return FieldList
* List all possible job statuses, useful for forms and filters
*
* @return array
*/
public function getCMSFields()
public function getJobStatusValues(): array
{
$fields = parent::getCMSFields();
$fields->replaceField(
'JobType',
new DropdownField('JobType', $this->fieldLabel('JobType'), $this->getJobTypeValues())
);
$statuses = [
return [
QueuedJob::STATUS_NEW,
QueuedJob::STATUS_INIT,
QueuedJob::STATUS_RUN,
Expand All @@ -344,6 +341,19 @@ public function getCMSFields()
QueuedJob::STATUS_CANCELLED,
QueuedJob::STATUS_BROKEN,
];
}

/**
* @return FieldList
*/
public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->replaceField(
'JobType',
DropdownField::create('JobType', $this->fieldLabel('JobType'), $this->getJobTypeValues())
);
$statuses = $this->getJobStatusValues();
$fields->replaceField(
'JobStatus',
DropdownField::create('JobStatus', $this->fieldLabel('JobStatus'), array_combine($statuses, $statuses))
Expand Down

0 comments on commit 8ff4c02

Please sign in to comment.