diff --git a/Controller/ListController.php b/Controller/ListController.php
index a4e583d1..63356974 100644
--- a/Controller/ListController.php
+++ b/Controller/ListController.php
@@ -4,6 +4,7 @@
use JMose\CommandSchedulerBundle\Entity\ScheduledCommand;
use Symfony\Component\HttpFoundation\JsonResponse;
+use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
@@ -77,9 +78,10 @@ public function toggleAction($id)
/**
* @param $id
- * @return \Symfony\Component\HttpFoundation\Response
+ * @param Request $request
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
- public function executeAction($id)
+ public function executeAction($id, Request $request)
{
$entityManager = $this->getDoctrineManager();
$scheduledCommand = $entityManager->getRepository(ScheduledCommand::class)->find($id);
@@ -90,14 +92,19 @@ public function executeAction($id)
$this->get('session')->getFlashBag()
->add('success', $this->translator->trans('flash.execute', [], 'JMoseCommandScheduler'));
+ if ($request->query->has('referer')) {
+ return $this->redirect($request->getSchemeAndHttpHost().urldecode($request->query->get('referer')));
+ }
+
return $this->redirect($this->generateUrl('jmose_command_scheduler_list'));
}
/**
* @param $id
- * @return \Symfony\Component\HttpFoundation\Response
+ * @param Request $request
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
- public function unlockAction($id)
+ public function unlockAction($id, Request $request)
{
$entityManager = $this->getDoctrineManager();
$scheduledCommand = $entityManager->getRepository(ScheduledCommand::class)->find($id);
@@ -108,6 +115,10 @@ public function unlockAction($id)
$this->get('session')->getFlashBag()
->add('success', $this->translator->trans('flash.unlocked', [], 'JMoseCommandScheduler'));
+ if ($request->query->has('referer')) {
+ return $this->redirect($request->getSchemeAndHttpHost().urldecode($request->query->get('referer')));
+ }
+
return $this->redirect($this->generateUrl('jmose_command_scheduler_list'));
}
diff --git a/Form/Type/ScheduledCommandType.php b/Form/Type/ScheduledCommandType.php
index 999b2a32..3fbbc236 100644
--- a/Form/Type/ScheduledCommandType.php
+++ b/Form/Type/ScheduledCommandType.php
@@ -105,7 +105,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'save',
SubmitType::class,
[
- 'label' => 'detail.save',
+ 'label' => 'action.save',
]
);
diff --git a/README.md b/README.md
index 9ce04e92..dc4eb9d1 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ To use it, you have to enable contrib recipes on your project : `composer config
- Locking system, to stop scheduling a command that has returned an error
- Monitoring with timeout or failed commands (Json URL and command with mailing)
- Translated in french, english, german and spanish
+- An [EasyAdmin](https://github.com/EasyCorp/EasyAdminBundle) configuration template available [here](Resources/doc/index.md#6---easyadmin-integration)
## Screenshots
![list](Resources/doc/images/scheduled-list.png)
diff --git a/Resources/doc/index.md b/Resources/doc/index.md
index 5e342869..ae7c8ba8 100644
--- a/Resources/doc/index.md
+++ b/Resources/doc/index.md
@@ -142,6 +142,46 @@ This can easily be done by using standard overrides in Symfony, as described [he
In your project, you'll want to copy the `Navbar:navbar:html.twig` template into `app/Resources/JMoseCommandSchedulerBundle/views/Navbar/navbar.html.twig`. Any changes to the file in this location will take precedence over the bundle's template file.
+### 6 - EasyAdmin integration
+
+If you want to manage your scheduled commands via [EasyAdmin](https://github.com/EasyCorp/EasyAdminBundle) here is a configuration template that you can copy/paste and change to your needs.
+
+```yaml
+easy_admin:
+ entities:
+ Cron:
+ translation_domain: 'JMoseCommandScheduler'
+ label: 'list.title'
+ class: JMose\CommandSchedulerBundle\Entity\ScheduledCommand
+ list:
+ title: "list.title"
+ fields:
+ - { property: 'id', label: 'ID' }
+ - { property: 'name', label: 'detail.name' }
+ - { property: 'command', label: 'detail.command' }
+ - { property: 'arguments', label: 'detail.arguments' }
+ - { property: 'lastExecution', label: 'detail.lastExecution' }
+ - { property: 'lastReturncode', label: 'detail.lastReturnCode' }
+ - { property: 'locked', label: 'detail.locked', type: boolean}
+ - { property: 'priority', label: 'detail.priority' }
+ - { property: 'disabled', label: 'detail.disabled' }
+ actions:
+ - { name: 'jmose_command_scheduler_action_execute', type: 'route', label: 'action.execute' }
+ - { name: 'jmose_command_scheduler_action_unlock', type: 'route', label: 'action.unlock' }
+ form:
+ fields:
+ - { property: 'name', label: 'detail.name' }
+ - { property: 'command', label: 'detail.command', type: 'JMose\CommandSchedulerBundle\Form\Type\CommandChoiceType' }
+ - { property: 'arguments', label: 'detail.arguments' }
+ - { property: 'cronExpression', label: 'detail.cronExpression' }
+ - { property: 'priority', label: 'detail.priority' }
+ - { property: 'disabled', label: 'detail.disabled' }
+ - { property: 'logFile', label: 'detail.logFile' }
+ new:
+ fields:
+ - { property: 'executeImmediately', label: 'detail.executeImmediately' }
+```
+
Usage
============
diff --git a/Resources/translations/JMoseCommandScheduler.de.xlf b/Resources/translations/JMoseCommandScheduler.de.xlf
index 541a711f..a9ce4141 100644
--- a/Resources/translations/JMoseCommandScheduler.de.xlf
+++ b/Resources/translations/JMoseCommandScheduler.de.xlf
@@ -52,6 +52,18 @@
Die Aufgabe könnte gerade ausgeführt werden. Möchtest du sie wirklich entsperren?
+
+
+ Suche
+
+
+
+ Zurück zur Liste
+
+
+
+ Stornieren
+
@@ -92,7 +104,7 @@
Deaktivieren
-
+
Speichern
@@ -107,6 +119,10 @@
Aktionen
+
+
+ Verschlossen
+
@@ -126,6 +142,19 @@
Aufgabe erfolgreich entsperrt.
+
+
+
+ Null
+
+
+
+ True
+
+
+
+ False
+