mirror of https://github.com/zlatinb/muwire
open the latest search by default
parent
c6c1ac1d93
commit
68bc0bbf30
|
@ -30,13 +30,11 @@ class SearchManager {
|
|||
this.core = core;
|
||||
}
|
||||
|
||||
void newSearch(String search) {
|
||||
UUID newSearch(String search) {
|
||||
search = search.trim();
|
||||
if (search.length() == 0)
|
||||
return;
|
||||
if (search.length() > 128) {
|
||||
// TODO: browse by persona
|
||||
} else {
|
||||
return null;
|
||||
else {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
|
||||
SearchResults searchResults = new SearchResults(uuid, search);
|
||||
|
@ -84,6 +82,7 @@ class SearchManager {
|
|||
queryEvent.setSig2(DataUtil.signUUID(uuid, timestamp, core.getSpk()));
|
||||
|
||||
core.getEventBus().publish(queryEvent);
|
||||
return uuid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,8 +44,11 @@ public class SearchServlet extends HttpServlet {
|
|||
|
||||
if (action.equals("start")) {
|
||||
String search = req.getParameter("search");
|
||||
searchManager.newSearch(search);
|
||||
resp.sendRedirect("/MuWire/Home");
|
||||
UUID newUUID = searchManager.newSearch(search);
|
||||
if (newUUID != null)
|
||||
resp.sendRedirect("/MuWire/Home?uuid=" + newUUID.toString());
|
||||
else
|
||||
resp.sendError(403, Util._t("Please enter a search keyword or hash"));
|
||||
} else if (action.equals("stop")) {
|
||||
String uuidString = req.getParameter("uuid");
|
||||
UUID uuid = UUID.fromString(uuidString);
|
||||
|
|
|
@ -845,7 +845,7 @@ function refreshStatus() {
|
|||
|
||||
if (uuid != null) {
|
||||
var newStatus = statusByUUID.get(uuid)
|
||||
if (newStatus.revision > currentSearch.revision)
|
||||
if (currentSearch == null || newStatus.revision > currentSearch.revision)
|
||||
refreshFunction(uuid)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
<script src="js/tables.js?<%=version%>" type="text/javascript"></script>
|
||||
<script src="js/certificates.js?<%=version%>" type="text/javascript"></script>
|
||||
<script src="js/search.js?<%=version%>" type="text/javascript"></script>
|
||||
<% if (request.getParameter("uuid") != null) {%>
|
||||
<script>
|
||||
uuid="<%=request.getParameter("uuid")%>"
|
||||
</script>
|
||||
<% } %>
|
||||
</head>
|
||||
<% if (groupBy.equals("sender")) { %>
|
||||
<body onload="initTranslate(jsTranslations); initConnectionsCount(); initGroupBySender(); initCertificates();">
|
||||
|
|
Loading…
Reference in New Issue