Closed APochmann closed 1 year ago
Hi, thx for the PR request. I undersand the problem, but with this solution i guess we have another problem. If "allowErrorOnFinish" is set to true this would also display e.g the download button if the job fails - which is probably not what we want.
I guess we would have to extend the Elements\Bundle\ProcessManagerBundle\Executor\Action and let the action itself decide if it should be triggered.
Eg. add a "$executeAtStates = ['finished']" property with setter and getter to the abstract method.
And in the code we could do something like this:
//adding some actions programmatically
$downloadAction = new Action\Download();
$downloadAction
->setExecuteAtStates(['finished','finished_with_errors'])
->setAccessKey('myIcon')
->setLabel('Download Icon')
->setFilePath('/public/bundles/elementsprocessmanager/img/sprite-open-item-action.png')
->setDeleteWithMonitoringItem(false);
`
Regards,
Christian
Hi Christian, thx for the response and your comment. Although I don't see the problem with failed jobs (the proposal did not touch STATUS_FINISHED, only STATUS_FINISHED_WITH_ERROR) I understand your approach and actually like it more than my proposal as it is more flexible. It does not change the bahaviour globally but is configurable per usage. I will update the PR and inform once done, just give me some days to do so
kind regards, Alois
Hi @ctippler , I've updated the PR according your proposal which makes it easier and more flexible 😉. Only six files affected by the change now:
Could you have a look at it and let me know if further adaptions are needed?
kind regards Alois
Current implementation:
The behavior of Download and OpenItem action depends on the status of the job. From the existing different status values
only STATUS_FINISHED allows showing buttons for Download and OpenItem action for jobs.
Proposal:
For some use cases it might be beneficial to be not so restrictive for the actions. An example could be the import of pimcore objects from file which might generate errors due to the content of the file. In this case STATUS_FINISHED would indicate import without any issues done and STATUS_FINISHED_WITH_ERROR would indicate at least some problems on importing the objects. The import job might have created a log file which shows all the problems in detail and now it should be possible to use the actions also for STATUS_FINISHED_WITH_ERROR do download these log files which support the user on fixing the issues.
New implementation:
This pull request addresses exact this change by introducing a new configuration item "allowErrorOnFinish" (info: "Allows jobs with errors to be treated as finished"). This is a boolean flag which means: