mirror of
https://github.com/code-rhapsodie/ezdataflow-bundle.git
synced 2026-03-24 14:42:06 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca37b2438d | ||
|
|
d166f3aea8 | ||
|
|
9ed5fd3c2b | ||
|
|
f98fecdca9 |
14
CHANGELOG.md
Normal file
14
CHANGELOG.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# version 2.0.0
|
||||
|
||||
* Update to use Dataflow v2.0+
|
||||
* Add compiler pass to change the Dataflow DBAL connection factory
|
||||
* Use the DBAL connection from siteaccess
|
||||
* Add `mode` argument on `ContentStructureFactory::transform()` function
|
||||
* Add `CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactoryInterface`
|
||||
|
||||
# version 1.0.0
|
||||
|
||||
* Initial version to use Dataflow v1.0+ into eZ Platform
|
||||
* Add Admin UI
|
||||
* Add content writer
|
||||
* Add content structure
|
||||
@@ -6,6 +6,8 @@ EzDataflow bundle is intended to manage content imports from external data sourc
|
||||
|
||||
> Note: before using this bundle, please read the [Code Rhapsodie Dataflow bundle documentation](https://github.com/code-rhapsodie/dataflow-bundle/blob/master/README.md).
|
||||
|
||||
> Command line notice: When you use Dataflow commands, **use `--siteaccess` instead of `--connection`** expect for `code-rhapsodie:dataflow:dump-schema` command.
|
||||
|
||||
## User Interface (UI)
|
||||
|
||||
The UI lets you create workflow processes from any defined `DataflowTypes`, and set options to each.
|
||||
@@ -24,6 +26,8 @@ $ composer require code-rhapsodie/ezdataflow-bundle
|
||||
|
||||
### Step 2: Enable the bundle
|
||||
|
||||
> Note: The loading order between the Dataflow bundle and Ez Dataflow bundle is important. Dataflow must be loaded first.
|
||||
|
||||
#### Symfony 4 (new tree)
|
||||
|
||||
For Symfony 4, add those two lines in the `config/bundles.php` file:
|
||||
@@ -198,7 +202,8 @@ class MyDataflowType extends AbstractDataflowType
|
||||
$remoteId,
|
||||
'eng-GB',
|
||||
'article2',
|
||||
54 //Parent location id
|
||||
54, //Parent location id
|
||||
ContentStructureFactoryInterface::MODE_INSERT_OR_UPDATE //Optional value. Other choice : ContentStructureFactoryInterface::MODE_INSERT_ONLY or ContentStructureFactoryInterface::MODE_UPDATE_ONLY
|
||||
);
|
||||
});
|
||||
$builder->addWriter($this->contentWriter);
|
||||
|
||||
15
UPGRADE.md
Normal file
15
UPGRADE.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# From v1.0 to v2.0
|
||||
|
||||
When you use Dataflow commands, use `--siteaccess` instead of `--connection` except for `code-rhapsodie:dataflow:dump-schema`.
|
||||
|
||||
[BC] The return of `CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway::findForScheduled`
|
||||
and `CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway::findAllOrderedByLabel` has been changed.
|
||||
The iterable contains an associative array instead of an object.
|
||||
|
||||
[BC] In classes `CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway` and
|
||||
`CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway`, all methods return `Doctrine\ORM\Query` object has
|
||||
changed to return now a `Doctrine\DBAL\Query\QueryBuilder`
|
||||
|
||||
[BC] The return type of `CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactory::transform` has been changed
|
||||
from `CodeRhapsodie\EzDataflowBundle\Model\ContentStructure` to `mixed`. In fact only `false` or
|
||||
`CodeRhapsodie\EzDataflowBundle\Model\ContentStructure` object will be returned.
|
||||
@@ -41,13 +41,13 @@
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"code-rhapsodie/dataflow-bundle": "^1.0 || dev-master",
|
||||
"code-rhapsodie/dataflow-bundle": "^2.0 || dev-master",
|
||||
"ezsystems/ezplatform-admin-ui": "^1.0",
|
||||
"ezsystems/ezpublish-kernel": "^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7||^8",
|
||||
"doctrine/orm": "^2.4.5"
|
||||
"doctrine/dbal": "^2.0"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
@@ -56,7 +56,8 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.x-dev"
|
||||
"dev-master": "2.x-dev",
|
||||
"dev-v1.x": "1.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway;
|
||||
use CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway;
|
||||
use CodeRhapsodie\DataflowBundle\Entity\Job;
|
||||
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute;
|
||||
use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface;
|
||||
use EzSystems\EzPlatformAdminUiBundle\Controller\Controller;
|
||||
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||
use Pagerfanta\Adapter\DoctrineDbalAdapter;
|
||||
use Pagerfanta\Pagerfanta;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -51,7 +51,7 @@ class DashboardController extends Controller
|
||||
return $this->render('@ezdesign/ezdataflow/Dashboard/main.html.twig');
|
||||
}
|
||||
|
||||
public function repeating(): Response
|
||||
public function repeating(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view'));
|
||||
|
||||
@@ -62,11 +62,27 @@ class DashboardController extends Controller
|
||||
]);
|
||||
|
||||
return $this->render('@ezdesign/ezdataflow/Dashboard/repeating.html.twig', [
|
||||
'items' => $this->scheduledDataflowGateway->findAllOrderedByLabel(),
|
||||
'pager' => $this->getPager($this->scheduledDataflowGateway->getListQueryForAdmin(), $request),
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/repeating", name="coderhapsodie.ezdataflow.repeating")
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getRepeatingPage(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view'));
|
||||
|
||||
return $this->render('@ezdesign/ezdataflow/Dashboard/repeating.html.twig', [
|
||||
'pager' => $this->getPager($this->scheduledDataflowGateway->getListQueryForAdmin(), $request),
|
||||
]);
|
||||
}
|
||||
|
||||
public function oneshot(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(new Attribute('ezdataflow', 'view'));
|
||||
@@ -142,9 +158,12 @@ class DashboardController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
private function getPager(Query $query, Request $request): Pagerfanta
|
||||
private function getPager(QueryBuilder $query, Request $request): Pagerfanta
|
||||
{
|
||||
$pager = new Pagerfanta(new DoctrineORMAdapter($query));
|
||||
$pager = new Pagerfanta(new DoctrineDbalAdapter($query, function ($queryBuilder) {
|
||||
return $queryBuilder->select('COUNT(DISTINCT id) AS total_results')
|
||||
->setMaxResults(1);
|
||||
}));
|
||||
$pager->setMaxPerPage(20);
|
||||
$pager->setCurrentPage($request->query->get('page', 1));
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@ use CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway;
|
||||
use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute;
|
||||
use EzSystems\EzPlatformAdminUi\Notification\NotificationHandlerInterface;
|
||||
use EzSystems\EzPlatformAdminUiBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
/**
|
||||
* @Route("/ezdataflow/job")
|
||||
@@ -82,7 +83,8 @@ class JobController extends Controller
|
||||
}
|
||||
|
||||
return new JsonResponse([
|
||||
'redirect' => $this->generateUrl('coderhapsodie.ezdataflow.main', ['_fragment' => 'oneshot']),
|
||||
'redirect' => $this->generateUrl('coderhapsodie.ezdataflow.main', ['_fragment' => 'oneshot'],
|
||||
UrlGeneratorInterface::ABSOLUTE_URL),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use CodeRhapsodie\EzDataflowBundle\Model\ContentUpdateStructure;
|
||||
use eZ\Publish\API\Repository\ContentService;
|
||||
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
|
||||
|
||||
class ContentStructureFactory
|
||||
final class ContentStructureFactory implements ContentStructureFactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var ContentService
|
||||
@@ -28,27 +28,35 @@ class ContentStructureFactory
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param string $remoteId
|
||||
* @param string $language
|
||||
* @param string $contentType
|
||||
* @param mixed $parentLocations
|
||||
* @param array $data
|
||||
* @param string $remoteId
|
||||
* @param string $language
|
||||
* @param string $contentType
|
||||
* @param mixed $parentLocations
|
||||
* @param int $mode One of the constant ContentStructureFactoryInterface::MODE_*
|
||||
*
|
||||
* @return ContentStructure
|
||||
* @return false|ContentStructure
|
||||
*
|
||||
* @throws \CodeRhapsodie\EzDataflowBundle\Exception\InvalidArgumentTypeException
|
||||
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function transform(array $data, string $remoteId, string $language, string $contentType, $parentLocations): ContentStructure
|
||||
public function transform(array $data, string $remoteId, string $language, string $contentType, $parentLocations, int $mode = ContentStructureFactoryInterface::MODE_INSERT_OR_UPDATE)
|
||||
{
|
||||
try {
|
||||
$content = $this->contentService->loadContentByRemoteId($remoteId);
|
||||
if ($mode === static::MODE_INSERT_ONLY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ContentUpdateStructure::createForContentId($content->id, $language, $data);
|
||||
} catch (NotFoundException $e) {
|
||||
// The content doesn't exist yet, so it will be created.
|
||||
}
|
||||
|
||||
if ($mode === static::MODE_UPDATE_ONLY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new ContentCreateStructure(
|
||||
$contentType,
|
||||
$language,
|
||||
|
||||
24
src/Factory/ContentStructureFactoryInterface.php
Normal file
24
src/Factory/ContentStructureFactoryInterface.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CodeRhapsodie\EzDataflowBundle\Factory;
|
||||
|
||||
interface ContentStructureFactoryInterface
|
||||
{
|
||||
public const MODE_INSERT_OR_UPDATE = 1;
|
||||
public const MODE_INSERT_ONLY = 2;
|
||||
public const MODE_UPDATE_ONLY = 3;
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param string $remoteId
|
||||
* @param string $language
|
||||
* @param string $contentType
|
||||
* @param int|string $parentLocations Int for location id or string for remote location id
|
||||
* @param int $mode ContentStructureFactoryInterface
|
||||
*
|
||||
* @return false|\CodeRhapsodie\EzDataflowBundle\Model\ContentStructure
|
||||
*/
|
||||
public function transform(array $data, string $remoteId, string $language, string $contentType, $parentLocations, int $mode = ContentStructureFactoryInterface::MODE_INSERT_OR_UPDATE);
|
||||
}
|
||||
@@ -6,68 +6,49 @@ namespace CodeRhapsodie\EzDataflowBundle\Gateway;
|
||||
|
||||
use CodeRhapsodie\DataflowBundle\Entity\Job;
|
||||
use CodeRhapsodie\DataflowBundle\Repository\JobRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
|
||||
class JobGateway
|
||||
final class JobGateway
|
||||
{
|
||||
/** @var EntityManagerInterface */
|
||||
private $em;
|
||||
/** @var JobRepository */
|
||||
private $jobRepository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, JobRepository $jobRepository)
|
||||
public function __construct(JobRepository $jobRepository)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->jobRepository = $jobRepository;
|
||||
}
|
||||
|
||||
public function find(int $id): Job
|
||||
public function find(int $id): ?Job
|
||||
{
|
||||
return $this->jobRepository->find($id);
|
||||
}
|
||||
|
||||
public function findForScheduled(int $id): iterable
|
||||
public function getOneshotListQueryForAdmin(): QueryBuilder
|
||||
{
|
||||
return $this->jobRepository->findBy(['scheduledDataflow' => $id], ['requestedDate' => 'desc'], 20);
|
||||
return $this->jobRepository->createQueryBuilder('i')
|
||||
->andWhere('i.scheduled_dataflow_id IS NULL')
|
||||
->addOrderBy('i.requested_date', 'DESC');
|
||||
}
|
||||
|
||||
public function getOneshotListQueryForAdmin(): Query
|
||||
public function getListQueryForAdmin(): QueryBuilder
|
||||
{
|
||||
$query = $this->jobRepository->createQueryBuilder('i')
|
||||
->andWhere('i.scheduledDataflow IS NULL')
|
||||
->addOrderBy('i.requestedDate', 'DESC');
|
||||
|
||||
return $query->getQuery();
|
||||
return $this->jobRepository->createQueryBuilder('w')
|
||||
->addOrderBy('w.requested_date', 'DESC');
|
||||
}
|
||||
|
||||
public function getListQueryForAdmin(): Query
|
||||
public function getListQueryForScheduleAdmin(int $id): QueryBuilder
|
||||
{
|
||||
$query = $this->jobRepository->createQueryBuilder('w')
|
||||
->addOrderBy('w.requestedDate', 'DESC');
|
||||
|
||||
return $query->getQuery();
|
||||
}
|
||||
|
||||
public function getListQueryForScheduleAdmin(int $id): Query
|
||||
{
|
||||
$query = $this->jobRepository->createQueryBuilder('w')
|
||||
->where('w.scheduledDataflow = :schedule_id')
|
||||
return $this->jobRepository->createQueryBuilder('w')
|
||||
->where('w.scheduled_dataflow_id = :schedule_id')
|
||||
->setParameter('schedule_id', $id)
|
||||
->addOrderBy('w.requestedDate', 'DESC');
|
||||
|
||||
return $query->getQuery();
|
||||
->addOrderBy('w.requested_date', 'DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Job $job
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
*/
|
||||
public function save(Job $job)
|
||||
{
|
||||
$this->em->persist($job);
|
||||
$this->em->flush();
|
||||
$this->jobRepository->save($job);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,54 +6,44 @@ namespace CodeRhapsodie\EzDataflowBundle\Gateway;
|
||||
|
||||
use CodeRhapsodie\DataflowBundle\Entity\ScheduledDataflow;
|
||||
use CodeRhapsodie\DataflowBundle\Repository\ScheduledDataflowRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
|
||||
class ScheduledDataflowGateway
|
||||
final class ScheduledDataflowGateway
|
||||
{
|
||||
/** @var EntityManagerInterface */
|
||||
private $em;
|
||||
/** @var ScheduledDataflowRepository */
|
||||
private $scheduledDataflowRepository;
|
||||
|
||||
public function __construct(EntityManagerInterface $em, ScheduledDataflowRepository $scheduledDataflowRepository)
|
||||
public function __construct(ScheduledDataflowRepository $scheduledDataflowRepository)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->scheduledDataflowRepository = $scheduledDataflowRepository;
|
||||
}
|
||||
|
||||
public function find(int $id): ScheduledDataflow
|
||||
public function find(int $id): ?ScheduledDataflow
|
||||
{
|
||||
return $this->scheduledDataflowRepository->find($id);
|
||||
}
|
||||
|
||||
public function findAllOrderedByLabel(): iterable
|
||||
public function getListQueryForAdmin(): QueryBuilder
|
||||
{
|
||||
return $this->scheduledDataflowRepository->findBy([], ['label' => 'asc']);
|
||||
return $this->scheduledDataflowRepository->createQueryBuilder('s')
|
||||
->addOrderBy('s.label', 'ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ScheduledDataflow $scheduledDataflow
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
*/
|
||||
public function save(ScheduledDataflow $scheduledDataflow)
|
||||
{
|
||||
$this->em->persist($scheduledDataflow);
|
||||
$this->em->flush();
|
||||
$this->scheduledDataflowRepository->save($scheduledDataflow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function delete(int $id): void
|
||||
{
|
||||
$workflow = $this->find($id);
|
||||
|
||||
$this->em->remove($workflow);
|
||||
$this->em->flush();
|
||||
$this->scheduledDataflowRepository->delete($id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ services:
|
||||
_defaults:
|
||||
public: false
|
||||
|
||||
coderhapsodie.dataflow.connection: "@ezpublish.persistence.connection"
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Controller\DashboardController:
|
||||
public: true
|
||||
arguments:
|
||||
@@ -77,6 +79,8 @@ services:
|
||||
CodeRhapsodie\EzDataflowBundle\EventSubscriber\MenuSubscriber:
|
||||
tags: ['kernel.event_subscriber']
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactoryInterface: '@CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactory'
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Factory\ContentStructureFactory:
|
||||
arguments:
|
||||
$contentService: '@eZ\Publish\API\Repository\ContentService'
|
||||
@@ -97,12 +101,10 @@ services:
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Gateway\ScheduledDataflowGateway:
|
||||
arguments:
|
||||
$em: '@doctrine.orm.default_entity_manager'
|
||||
$scheduledDataflowRepository: '@CodeRhapsodie\DataflowBundle\Repository\ScheduledDataflowRepository'
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Gateway\JobGateway:
|
||||
arguments:
|
||||
$em: '@doctrine.orm.default_entity_manager'
|
||||
$jobRepository: '@CodeRhapsodie\DataflowBundle\Repository\JobRepository'
|
||||
|
||||
CodeRhapsodie\EzDataflowBundle\Tab\RepeatingTab:
|
||||
|
||||
@@ -74,3 +74,4 @@ coderhapsodie.ezdataflow.workflow.edit.submit: Save
|
||||
coderhapsodie.dataflow.update.next: 'Next execution'
|
||||
coderhapsodie.ezdataflow.workflow.edit.success: 'Dataflow schedule successfully updated.'
|
||||
coderhapsodie.ezdataflow.workflow.edit.error: 'An error occurred during the dataflow schedule update: "%message%".'
|
||||
coderhapsodie.ezdataflow.notfound: 'Requested data is not found'
|
||||
|
||||
@@ -72,3 +72,4 @@ coderhapsodie.ezdataflow.workflow.edit.submit: Sauvegarder
|
||||
coderhapsodie.dataflow.update.next: 'Prochaine exécution'
|
||||
coderhapsodie.ezdataflow.workflow.edit.success: 'La programmation du dataflow a été mis à jour avec succès.'
|
||||
coderhapsodie.ezdataflow.workflow.edit.error: 'Une erreur est survenue lors de la modification de la programmation du dataflow : "%message%".'
|
||||
coderhapsodie.ezdataflow.notfound: 'Les données demandées sont introuvables'
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{% form_theme form 'bootstrap_3_layout.html.twig' %}
|
||||
|
||||
<h2>{{ 'coderhapsodie.ezdataflow.oneshot.title'|trans }}</h2>
|
||||
|
||||
<div class="ez-table-header">
|
||||
@@ -16,6 +14,7 @@
|
||||
{{ include('@ezdesign/ezdataflow/parts/tab/job_list.html.twig', {identifier: 'ezdataflow_oneshot_history', paginate_route: 'coderhapsodie.ezdataflow.oneshot'}) }}
|
||||
|
||||
{% if form is defined %}
|
||||
{% form_theme form 'bootstrap_3_layout.html.twig' %}
|
||||
<div class="modal fade ez-modal show" id="ez-modal--new-oneshot" tabindex="-1" role="dialog" aria-modal="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
{{ include('@ezdesign/ezdataflow/parts/schedule_form.html.twig', {mode: 'oneshot'}) }}
|
||||
@@ -35,6 +34,9 @@
|
||||
contentType: false,
|
||||
success: function (result) {
|
||||
if (result.redirect) {
|
||||
if (window.location.href === result.redirect) {
|
||||
document.location.reload();
|
||||
}
|
||||
window.location = result.redirect;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{% form_theme form 'bootstrap_3_layout.html.twig' %}
|
||||
|
||||
<h2>{{ 'coderhapsodie.ezdataflow.repeating.title'|trans }}</h2>
|
||||
|
||||
<div class="ez-table-header">
|
||||
@@ -15,8 +13,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ include('@ezdesign/ezdataflow/parts/tab/schedule_list.html.twig') }}
|
||||
{{ include('@ezdesign/ezdataflow/parts/tab/schedule_list.html.twig', {identifier: 'ezdataflow_schedule_results', paginate_route: 'coderhapsodie.ezdataflow.repeating'}) }}
|
||||
|
||||
{% if form is defined %}
|
||||
{% form_theme form 'bootstrap_3_layout.html.twig' %}
|
||||
<div class="modal fade ez-modal show" id="ez-modal--new-scheduled" tabindex="-1" role="dialog" aria-modal="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
{{ include('@ezdesign/ezdataflow/parts/schedule_form.html.twig') }}
|
||||
@@ -121,6 +121,9 @@
|
||||
$.ajax(elem.href, {
|
||||
success: function (result) {
|
||||
if (result.redirect) {
|
||||
if (window.location.href === result.redirect) {
|
||||
document.location.reload();
|
||||
}
|
||||
window.location = result.redirect;
|
||||
return;
|
||||
}
|
||||
@@ -174,3 +177,4 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{% import '@ezdesign/ezdataflow/macros.twig' as macros %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container ez-main-container">
|
||||
{% if item is not null %}
|
||||
<h2>{{ 'coderhapsodie.ezdataflow.history.job.title'|trans }} n°{{ item.id }}</h2>
|
||||
|
||||
<table class="table ez-table ez-table--list">
|
||||
@@ -51,5 +53,8 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p class="ez-table-no-content">{{ 'coderhapsodie.ezdataflow.notfound'|trans }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
{% for job in pager.currentPageResults %}
|
||||
<tr>
|
||||
<td>{{ job.label }}</td>
|
||||
<td>{{ job.requestedDate|date('d/m/Y H:i:s') }}</td>
|
||||
<td>{{ job.requested_date|date('d/m/Y H:i:s') }}</td>
|
||||
<td>{{ job.count|default('-') }}</td>
|
||||
<td>{{ job.startTime ? job.startTime|date('d/m/Y H:i:s') : '-' }}</td>
|
||||
<td>{{ job.endTime ? job.endTime|date('d/m/Y H:i:s') : '-' }}</td>
|
||||
<td>{{ job.start_time ? job.start_time|date('d/m/Y H:i:s') : '-' }}</td>
|
||||
<td>{{ job.end_time ? job.end_time|date('d/m/Y H:i:s') : '-' }}</td>
|
||||
<td>{{ macros.translateStatus(job.status) }}</td>
|
||||
<td class="ez-table__cell ez-table__cell--has-action-btns text-right">
|
||||
<a href="{{ path('coderhapsodie.ezdataflow.job.details', {id: job.id}) }}" class="btn btn-icon mx-2 modal-history-details" title="{{ 'coderhapsodie.ezdataflow.history.list.view'|trans }}">
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
{% if items|length %}
|
||||
{% set id = identifier|default('ezdataflow_schedule_results') %}
|
||||
|
||||
<div id="loading_{{ id }}" class="text-center d-none">
|
||||
<svg class="ez-icon ez-icon--extra-large">
|
||||
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="/bundles/ezplatformadminui/img/ez-icons.svg#spinner"></use>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div id="{{ id }}" class="history-details-aware">
|
||||
{% if pager.currentPageResults|length %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -10,7 +19,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in items %}
|
||||
{% for item in pager.currentPageResults %}
|
||||
<tr>
|
||||
<td>{{ item.label }}</td>
|
||||
<td>{{ item.frequency }}</td>
|
||||
@@ -53,3 +62,23 @@
|
||||
{% else %}
|
||||
<p class="ez-table-no-content">{{ 'coderhapsodie.ezdataflow.workflow.list.empty'|trans }}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if pager.haveToPaginate %}
|
||||
<div class="ez-pagination justify-content-center align-items-center ez-pagination__spacing">
|
||||
{{ pagerfanta(pager, 'ez', {routeName: paginate_route, routeParams: paginate_params|default({})}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Manage ajax pagination
|
||||
$('#{{ id }}').delegate('.ez-pagination a', 'click', function (e) {
|
||||
e.preventDefault();
|
||||
$('#loading_{{ id }}').removeClass('d-none');
|
||||
$('#{{ id }}')
|
||||
.html('')
|
||||
.load(this.href + ' #{{ id }}>*', null, function () {
|
||||
$('#loading_{{ id }}').addClass('d-none');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user