create tab in admin

This commit is contained in:
aina esokia
2020-10-26 17:08:09 +03:00
parent d0bec62dc0
commit 62f6d03ce4
2 changed files with 28 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
use Alchemy\Phrasea\WorkerManager\Event\PopulateIndexEvent; use Alchemy\Phrasea\WorkerManager\Event\PopulateIndexEvent;
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents; use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
use Alchemy\Phrasea\WorkerManager\Form\WorkerConfigurationType; use Alchemy\Phrasea\WorkerManager\Form\WorkerConfigurationType;
use Alchemy\Phrasea\WorkerManager\Form\WorkerFtpType;
use Alchemy\Phrasea\WorkerManager\Form\WorkerPullAssetsType; use Alchemy\Phrasea\WorkerManager\Form\WorkerPullAssetsType;
use Alchemy\Phrasea\WorkerManager\Form\WorkerSearchengineType; use Alchemy\Phrasea\WorkerManager\Form\WorkerSearchengineType;
use Alchemy\Phrasea\WorkerManager\Queue\AMQPConnection; use Alchemy\Phrasea\WorkerManager\Queue\AMQPConnection;
@@ -194,6 +195,24 @@ class AdminConfigurationController extends Controller
]); ]);
} }
public function ftpAction(PhraseaApplication $app, Request $request)
{
$ftpConfig = $this->getFtpConfiguration();
$form = $app->form(new WorkerFtpType(), $ftpConfig);
$form->handleRequest($request);
if ($form->isValid()) {
// save new ftp config
$app['conf']->set(['workers', 'ftp'], array_merge($ftpConfig, $form->getData()));
return $app->redirectPath('worker_admin');
}
return $this->render('admin/worker-manager/worker_ftp.html.twig', [
'form' => $form->createView()
]);
}
public function populateStatusAction(PhraseaApplication $app, Request $request) public function populateStatusAction(PhraseaApplication $app, Request $request)
{ {
$databoxIds = $request->get('sbasIds'); $databoxIds = $request->get('sbasIds');
@@ -268,6 +287,11 @@ class AdminConfigurationController extends Controller
return $this->app['conf']->get(['workers', 'pull_assets'], []); return $this->app['conf']->get(['workers', 'pull_assets'], []);
} }
private function getFtpConfiguration()
{
return $this->app['conf']->get(['workers', 'ftp'], []);
}
private function getRetryQueueConfiguration() private function getRetryQueueConfiguration()
{ {
return $this->app['conf']->get(['workers', 'retry_queue'], []); return $this->app['conf']->get(['workers', 'retry_queue'], []);

View File

@@ -77,6 +77,10 @@ class ControllerServiceProvider implements ControllerProviderInterface, ServiceP
->method('GET|POST') ->method('GET|POST')
->bind('worker_admin_metadata'); ->bind('worker_admin_metadata');
$controllers->match('/ftp', 'controller.worker.admin.configuration:ftpAction')
->method('GET|POST')
->bind('worker_admin_ftp');
$controllers->get('/populate-status', 'controller.worker.admin.configuration:populateStatusAction') $controllers->get('/populate-status', 'controller.worker.admin.configuration:populateStatusAction')
->bind('worker_admin_populate_status'); ->bind('worker_admin_populate_status');