Skip to content
Snippets Groups Projects
Commit 49c5a0d1 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Améliorations de l'IHM : génération automatique des procédures d'import...

Améliorations de l'IHM : génération automatique des procédures d'import lorsqu'on active ou désactive une table.
Bouton de make-procs dans la page table maintenant.
parent ba773720
No related branches found
No related tags found
No related merge requests found
Pipeline #7916 failed
...@@ -5,6 +5,7 @@ namespace UnicaenImport\Controller\Factory; ...@@ -5,6 +5,7 @@ namespace UnicaenImport\Controller\Factory;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use UnicaenImport\Controller\TableController; use UnicaenImport\Controller\TableController;
use UnicaenImport\Form\TableForm; use UnicaenImport\Form\TableForm;
use UnicaenImport\Processus\ImportProcessus;
use UnicaenImport\Service\SchemaService; use UnicaenImport\Service\SchemaService;
use UnicaenImport\Service\TableService; use UnicaenImport\Service\TableService;
...@@ -30,6 +31,7 @@ class TableControllerFactory ...@@ -30,6 +31,7 @@ class TableControllerFactory
$controller->setServiceTable($container->get(TableService::class)); $controller->setServiceTable($container->get(TableService::class));
$controller->setServiceSchema($container->get(SchemaService::class)); $controller->setServiceSchema($container->get(SchemaService::class));
$controller->setFormTable($container->get('FormElementManager')->get(TableForm::class)); $controller->setFormTable($container->get('FormElementManager')->get(TableForm::class));
$controller->setProcessusImport($container->get(ImportProcessus::class));
return $controller; return $controller;
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace UnicaenImport\Controller; namespace UnicaenImport\Controller;
use UnicaenImport\Form\Traits\TableFormAwareTrait; use UnicaenImport\Form\Traits\TableFormAwareTrait;
use UnicaenImport\Processus\Traits\ImportProcessusAwareTrait;
use UnicaenImport\Service\Traits\SchemaServiceAwareTrait; use UnicaenImport\Service\Traits\SchemaServiceAwareTrait;
use UnicaenImport\Service\Traits\TableServiceAwareTrait; use UnicaenImport\Service\Traits\TableServiceAwareTrait;
use Zend\Mvc\Controller\AbstractActionController; use Zend\Mvc\Controller\AbstractActionController;
...@@ -19,6 +20,7 @@ class TableController extends AbstractActionController ...@@ -19,6 +20,7 @@ class TableController extends AbstractActionController
use TableServiceAwareTrait; use TableServiceAwareTrait;
use SchemaServiceAwareTrait; use SchemaServiceAwareTrait;
use TableFormAwareTrait; use TableFormAwareTrait;
use ImportProcessusAwareTrait;
...@@ -51,6 +53,7 @@ class TableController extends AbstractActionController ...@@ -51,6 +53,7 @@ class TableController extends AbstractActionController
if ($table) { if ($table) {
$table->setSyncEnabled(!$table->isSyncEnabled()); $table->setSyncEnabled(!$table->isSyncEnabled());
$this->getServiceTable()->save($table); $this->getServiceTable()->save($table);
$this->getProcessusImport()->updateViewsAndPackages();
} }
$result = [ $result = [
...@@ -89,6 +92,7 @@ class TableController extends AbstractActionController ...@@ -89,6 +92,7 @@ class TableController extends AbstractActionController
if ($form->isValid()) { if ($form->isValid()) {
try { try {
$this->getServiceTable()->save($table); $this->getServiceTable()->save($table);
$this->getProcessusImport()->updateViewsAndPackages();
} catch (\Exception $e) { } catch (\Exception $e) {
$this->flashMessenger()->addErrorMessage($e->getMessage()); $this->flashMessenger()->addErrorMessage($e->getMessage());
} }
......
<h1 class="page-header">Mise à jour des vues et procédures d'import</h1> <h1 class="page-header">Mise à jour des vues et procédures d'import</h1>
<?php <?php
echo $this->partial('unicaen-import/import/menu', ['active' => 'maj-vues-fonctions']);
echo $this->messenger()->setMessage($message, \UnicaenApp\View\Helper\Messenger::SUCCESS); echo $this->messenger()->setMessage($message, \UnicaenApp\View\Helper\Messenger::SUCCESS);
\ No newline at end of file
...@@ -33,13 +33,6 @@ $pages = [ ...@@ -33,13 +33,6 @@ $pages = [
'popover' => false, 'popover' => false,
'icon' => 'glyphicon glyphicon-import', 'icon' => 'glyphicon glyphicon-import',
], ],
'maj-vues-fonctions' => [
'url' => $this->url('import/maj-vues-fonctions'),
'label' => 'Mise à jour des vues et procédures d\'import',
'visible' => $this->isAllowed(Privileges::getResourceId(Privileges::IMPORT_VUES_PROCEDURES)),
'popover' => false,
'icon' => 'glyphicon glyphicon-wrench',
],
]; ];
?> ?>
......
...@@ -82,13 +82,34 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] ); ...@@ -82,13 +82,34 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
<?php if ($hasNonReferenced): ?> <?php if ($hasNonReferenced): ?>
<div class="alert alert-warning alert-dismissible" role="alert"> <div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<p>Des tables synchronisables ne sont pas référencées dans la liste ci-dessus.</p> <p>Des tables synchronisables ne sont pas référencées dans la liste ci-dessus.</p>
<?php if ($canEdit): ?> <?php if ($canEdit): ?>
<button class="btn btn-warning add-non-referenced">Ajouter ces tables pour les rendre synchronisables</button> <button class="btn btn-warning add-non-referenced">Ajouter ces tables pour les rendre synchronisables</button>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php
if ($this->isAllowed(Privileges::getResourceId(Privileges::IMPORT_VUES_PROCEDURES))) {
echo $this->tag('a', [
'class' => 'btn btn-info pop-ajax',
'data-submit-reload' => "true",
'href' => $this->url('import/maj-vues-fonctions'),
])->html('<span class="glyphicon glyphicon-wrench"></span> Mise à jour des vues et procédures d\'import');
}
// 'maj-vues-fonctions' => [
// 'url' => ,
// 'label' => 'Mise à jour des vues et procédures d\'import',
// 'visible' => ,
// 'popover' => false,
// 'icon' => 'glyphicon glyphicon-wrench',
// ],
?>
</div> </div>
<script> <script>
...@@ -113,19 +134,22 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] ); ...@@ -113,19 +134,22 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
synchroSwitch: function (table) synchroSwitch: function (table)
{ {
var that = this; var that = this;
var glyphSwitch = that.element.find("tr.table-ligne[data-table='" + table + "'] .glyph-switch");
glyphSwitch.addClass('loading');
glyphSwitch.removeClass('glyphicon-ok text-success');
glyphSwitch.removeClass('glyphicon-remove text-danger refuse');
$.post("<?= $this->url('import/tables/synchro-switch') ?>", {table: table}, function (data) $.post("<?= $this->url('import/tables/synchro-switch') ?>", {table: table}, function (data)
{ {
var glyphSwitch = that.element.find("tr.table-ligne[data-table='" + data.table + "'] .glyph-switch"); glyphSwitch.removeClass('loading');
if (data.result) { if (data.result) {
glyphSwitch.addClass('glyphicon-ok text-success'); glyphSwitch.addClass('glyphicon-ok text-success');
glyphSwitch.removeClass('glyphicon-remove text-danger refuse');
} else { } else {
glyphSwitch.addClass('glyphicon-remove text-danger refuse'); glyphSwitch.addClass('glyphicon-remove text-danger refuse');
glyphSwitch.removeClass('glyphicon-ok text-success');
} }
}).fail(function (jqXHR) }).fail(function (jqXHR)
{ {
glyphSwitch.removeClass('loading');
alertFlash(jqXHR.responseText, 'danger', 5000); alertFlash(jqXHR.responseText, 'danger', 5000);
console.log(jqXHR); console.log(jqXHR);
}); });
...@@ -170,6 +194,4 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] ); ...@@ -170,6 +194,4 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
}); });
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment