porting PHRAS-1578/PHRAS-1579/PHRAS-1621/PHRAS-1675/PHRAS-1404/PHRAS-1336 to 4.1

This commit is contained in:
Mike Ng
2018-01-03 15:26:43 +04:00
parent 0d7c2bd52d
commit 071ce25b31
21 changed files with 842 additions and 189 deletions

View File

@@ -36,12 +36,14 @@ class SearchEngineController extends Controller
return $this->app->redirectPath('admin_searchengine_form');
}
return $this->render('admin/search-engine/elastic-search.html.twig', [
return $this->render('admin/search-engine/search-engine-settings.html.twig', [
'form' => $form->createView(),
'indexer' => $this->app['elasticsearch.indexer']
]);
}
public function dropIndexAction(Request $request)
{
$indexer = $this->app['elasticsearch.indexer'];
@@ -87,4 +89,28 @@ class SearchEngineController extends Controller
'action' => $this->app->url('admin_searchengine_form'),
]);
}
/**
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
public function getSettingFromIndexAction(Request $request)
{
if (!$request->isXmlHttpRequest()) {
$this->app->abort(400);
}
$indexer = $this->app['elasticsearch.indexer'];
$index = $request->get('index');
if (!$indexer->indexExists() || is_null($index))
{
return $this->app->json([
'success' => false,
'message' => $this->app->trans('An error occurred'),
]);
}
return $this->app->json([
'success' => true,
'response' => $indexer->getSettings(['index' => $index])
]);
}
}