Commit 5e6fefa9 authored by Matija Obreza's avatar Matija Obreza

ES admin buttons moved

parent d5396e45
...@@ -42,7 +42,7 @@ import java.util.List; ...@@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@RequestMapping("/admin") @RequestMapping("/admin/elastic")
@PreAuthorize("hasRole('ADMINISTRATOR')") @PreAuthorize("hasRole('ADMINISTRATOR')")
public class ElasticSearchController { public class ElasticSearchController {
public static final Log LOG = LogFactory.getLog(ElasticSearchController.class); public static final Log LOG = LogFactory.getLog(ElasticSearchController.class);
...@@ -64,7 +64,7 @@ public class ElasticSearchController { ...@@ -64,7 +64,7 @@ public class ElasticSearchController {
* @param model * @param model
* @return * @return
*/ */
@RequestMapping("/elastic") @RequestMapping("/")
public String viewIndexesAndAliases(Model model) { public String viewIndexesAndAliases(Model model) {
ImmutableOpenMap<String, IndexMetaData> indicesImmutableMap = client.admin().cluster() ImmutableOpenMap<String, IndexMetaData> indicesImmutableMap = client.admin().cluster()
.prepareState().execute() .prepareState().execute()
...@@ -90,10 +90,10 @@ public class ElasticSearchController { ...@@ -90,10 +90,10 @@ public class ElasticSearchController {
* *
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/elastic", params = { "regenerate" }) @RequestMapping(method = RequestMethod.POST, value = "/action", params = { "regenerate" })
public String regenerateElastic() { public String regenerateElastic() {
elasticService.regenerateIndexes(); elasticService.regenerateIndexes();
return "redirect:/admin/"; return "redirect:/admin/elastic/";
} }
/** /**
...@@ -103,12 +103,12 @@ public class ElasticSearchController { ...@@ -103,12 +103,12 @@ public class ElasticSearchController {
* @param jsonFilter * @param jsonFilter
* @throws IOException * @throws IOException
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/elastic", params = { "reindex", "filter" }) @RequestMapping(method = RequestMethod.POST, value = "/action", params = { "reindex", "filter" })
public String reindexElasticFiltered(@RequestParam(value = "filter", required = true) String jsonFilter) throws IOException { public String reindexElasticFiltered(@RequestParam(value = "filter", required = true) String jsonFilter) throws IOException {
FilterHandler.AppliedFilters filters = mapper.readValue(jsonFilter, FilterHandler.AppliedFilters.class); FilterHandler.AppliedFilters filters = mapper.readValue(jsonFilter, FilterHandler.AppliedFilters.class);
elasticService.reindex(filters); elasticService.reindex(filters);
return "redirect:/admin/"; return "redirect:/admin/elastic/";
} }
/** /**
...@@ -116,9 +116,9 @@ public class ElasticSearchController { ...@@ -116,9 +116,9 @@ public class ElasticSearchController {
* *
* @return * @return
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/elastic", params = { "clear-queues" }) @RequestMapping(method = RequestMethod.POST, value = "/action", params = { "clear-queues" })
public String clearElasticQueues() { public String clearElasticQueues() {
elasticUpdater.clearQueues(); elasticUpdater.clearQueues();
return "redirect:/admin/"; return "redirect:/admin/elastic/";
} }
} }
...@@ -9,9 +9,19 @@ ...@@ -9,9 +9,19 @@
<body> <body>
<%@ include file="/WEB-INF/jsp/admin/menu.jsp"%> <%@ include file="/WEB-INF/jsp/admin/menu.jsp"%>
<a href="<c:url value="/admin/" />" class="btn btn-default">Back</a> <form method="post" action="<c:url value="/admin/elastic/action" />">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="text" name="filter" placeholder="Genesys filter {}" value="{}" />
<button type="submit" class="btn btn-default" name="reindex">Reindex</button>
<button type="submit" class="btn btn-default" name="regenerate">Regenerate</button>
</form>
<form method="post" action="<c:url value="/admin/elastic/action" />">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<button type="submit" class="btn btn-default" name="clear-queues">Clear ES update queues</button>
</form>
<h3>Indexes and their aliases</h3> <h3>Indexes and their aliases</h3>
<c:if test="${empty indexes}"> <c:if test="${empty indexes}">
<h5>No indexes found.</h5> <h5>No indexes found.</h5>
</c:if> </c:if>
......
...@@ -33,21 +33,6 @@ ...@@ -33,21 +33,6 @@
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" /> <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</form> </form>
<h3>Full-text Search</h3>
<form method="post" action="<c:url value="/admin/elastic" />">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input type="text" name="filter" placeholder="Genesys filter {}" value="{}" />
<button type="submit" class="btn btn-default" name="reindex">Reindex</button>
<button type="submit" class="btn btn-default" name="regenerate">Regenerate</button>
</form>
<form method="post" action="<c:url value="/admin/elastic" />">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<button type="submit" class="btn btn-default" name="clear-queues">Clear ES update queues</button>
</form>
<a href="<c:url value="/admin/elastic" />" class="btn btn-default">Show indexes and aliases</a>
<h3>Country data</h3> <h3>Country data</h3>
<form method="post" action="<c:url value="/admin/refreshCountries" />"> <form method="post" action="<c:url value="/admin/refreshCountries" />">
<input type="submit" class="btn btn-default" value="Refresh country data" /> <input type="submit" class="btn btn-default" value="Refresh country data" />
......
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
><spring:message code="menu.admin.loggers" /></a> <a class="" href="<c:url value="/admin/ds2/" />"><spring:message ><spring:message code="menu.admin.loggers" /></a> <a class="" href="<c:url value="/admin/ds2/" />"><spring:message
code="menu.admin.ds2" code="menu.admin.ds2"
/></a> <a class="" href="<c:url value="/admin/kpi/" />"><spring:message code="menu.admin.kpi" /></a> /></a> <a class="" href="<c:url value="/admin/kpi/" />"><spring:message code="menu.admin.kpi" /></a>
<a href="<c:url value="/admin/elastic/" />" class="">Elasticsearch</a>
</div> </div>
</div> </div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment