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
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ namespace UnicaenImport\Controller\Factory;
use Interop\Container\ContainerInterface;
use UnicaenImport\Controller\TableController;
use UnicaenImport\Form\TableForm;
use UnicaenImport\Processus\ImportProcessus;
use UnicaenImport\Service\SchemaService;
use UnicaenImport\Service\TableService;

@@ -30,6 +31,7 @@ class TableControllerFactory
        $controller->setServiceTable($container->get(TableService::class));
        $controller->setServiceSchema($container->get(SchemaService::class));
        $controller->setFormTable($container->get('FormElementManager')->get(TableForm::class));
        $controller->setProcessusImport($container->get(ImportProcessus::class));

        return $controller;
    }
+4 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace UnicaenImport\Controller;

use UnicaenImport\Form\Traits\TableFormAwareTrait;
use UnicaenImport\Processus\Traits\ImportProcessusAwareTrait;
use UnicaenImport\Service\Traits\SchemaServiceAwareTrait;
use UnicaenImport\Service\Traits\TableServiceAwareTrait;
use Zend\Mvc\Controller\AbstractActionController;
@@ -19,6 +20,7 @@ class TableController extends AbstractActionController
    use TableServiceAwareTrait;
    use SchemaServiceAwareTrait;
    use TableFormAwareTrait;
    use ImportProcessusAwareTrait;



@@ -51,6 +53,7 @@ class TableController extends AbstractActionController
        if ($table) {
            $table->setSyncEnabled(!$table->isSyncEnabled());
            $this->getServiceTable()->save($table);
            $this->getProcessusImport()->updateViewsAndPackages();
        }

        $result = [
@@ -89,6 +92,7 @@ class TableController extends AbstractActionController
            if ($form->isValid()) {
                try {
                    $this->getServiceTable()->save($table);
                    $this->getProcessusImport()->updateViewsAndPackages();
                } catch (\Exception $e) {
                    $this->flashMessenger()->addErrorMessage($e->getMessage());
                }
+0 −2
Original line number Diff line number Diff line
<h1 class="page-header">Mise à jour des vues et procédures d'import</h1>
<?php

echo $this->partial('unicaen-import/import/menu', ['active' => 'maj-vues-fonctions']);

echo $this->messenger()->setMessage($message, \UnicaenApp\View\Helper\Messenger::SUCCESS);
 No newline at end of file
+0 −7
Original line number Diff line number Diff line
@@ -33,13 +33,6 @@ $pages = [
        'popover' => false,
        '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',
    ],
];

?>
+105 −83
Original line number Diff line number Diff line
@@ -82,13 +82,34 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );

    <?php if ($hasNonReferenced): ?>
        <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>
            <?php if ($canEdit): ?>
                <button class="btn btn-warning add-non-referenced">Ajouter ces tables pour les rendre synchronisables</button>
            <?php endif; ?>
        </div>
    <?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>
<script>

@@ -113,19 +134,22 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );
            synchroSwitch: function (table)
            {
                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)
                {
                    var glyphSwitch = that.element.find("tr.table-ligne[data-table='" + data.table + "'] .glyph-switch");
                    glyphSwitch.removeClass('loading');
                    if (data.result) {
                        glyphSwitch.addClass('glyphicon-ok text-success');
                        glyphSwitch.removeClass('glyphicon-remove text-danger refuse');
                    } else {
                        glyphSwitch.addClass('glyphicon-remove text-danger refuse');
                        glyphSwitch.removeClass('glyphicon-ok text-success');
                    }
                }).fail(function (jqXHR)
                {
                    glyphSwitch.removeClass('loading');
                    alertFlash(jqXHR.responseText, 'danger', 5000);
                    console.log(jqXHR);
                });
@@ -170,6 +194,4 @@ echo $this->partial('unicaen-import/import/menu', ['active'=> 'tables'] );

    });



</script>