Merge branch 'master' into PHRAS-3092_api-setmetadats-v3_master

This commit is contained in:
jygaulier
2020-06-23 17:02:54 +02:00
committed by GitHub
14 changed files with 212 additions and 180 deletions

View File

@@ -155,8 +155,8 @@ class LanguageController
'description notice' => $translator->trans('prod:mapboxgl: description notice'),
'title-map-dialog' => $translator->trans('prod:mapboxgl: title map dialog'),
'create new user' => $translator->trans('prod:push: create new user'),
'prod:videoeditor:subtitletab:messsage:: error' => $translator->trans('prod:videoeditor:subtitletab:messsage:: error'),
'prod:videoeditor:subtitletab:messsage:: success' => $translator->trans('prod:videoeditor:subtitletab:messsage:: success'),
'prod:videoeditor:subtitletab:message:: error' => $translator->trans('prod:videoeditor:subtitletab:message:: error'),
'prod:videoeditor:subtitletab:message:: success' => $translator->trans('prod:videoeditor:subtitletab:message:: success'),
]);
}
}

View File

@@ -13,6 +13,9 @@ use Alchemy\Phrasea\Application\Helper\DispatcherAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Event\Thesaurus as ThesaurusEvent;
use Alchemy\Phrasea\Core\Event\Thesaurus\ThesaurusEvents;
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticsearchOptions;
use Alchemy\Phrasea\WorkerManager\Event\PopulateIndexEvent;
use Alchemy\Phrasea\WorkerManager\Event\WorkerEvents;
use Doctrine\DBAL\Driver\Connection;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -1222,6 +1225,26 @@ class ThesaurusController extends Controller
]);
}
/**
* Order to populate databox
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function populate(Request $request)
{
$options = $this->getElasticsearchOptions();
$data['host'] = $options->getHost();
$data['port'] = $options->getPort();
$data['indexName'] = $options->getIndexName();
$data['databoxIds'] = [$request->get('databox_id')];
$this->getDispatcher()->dispatch(WorkerEvents::POPULATE_INDEX, new PopulateIndexEvent($data));
return $this->app->json($data);
}
/**
* @param Request $request
* @return Response
@@ -3031,4 +3054,12 @@ class ThesaurusController extends Controller
{
return $this->app['locales.available'];
}
/**
* @return ElasticsearchOptions
*/
private function getElasticsearchOptions()
{
return $this->app['elasticsearch.options'];
}
}

View File

@@ -60,6 +60,7 @@ class Thesaurus implements ControllerProviderInterface, ServiceProviderInterface
$controllers->match('newterm.php', 'controller.thesaurus:newTerm');
$controllers->match('properties.php', 'controller.thesaurus:properties');
$controllers->match('thesaurus.php', 'controller.thesaurus:thesaurus')->bind('thesaurus_thesaurus');
$controllers->match('populate', 'controller.thesaurus:populate')->bind('thesaurus_populate');
$controllers->match('xmlhttp/accept.x.php', 'controller.thesaurus:acceptXml');
$controllers->match('xmlhttp/acceptcandidates.x.php', 'controller.thesaurus:acceptCandidatesXml');